Recover empty space from NTFS partition in .img file












0















I have a snapshot of an old computers harddisk saved as an .img file. I have mounted it with sudo mount -o loop,offset=209715200 /usr/nasShare/Backups/hpster.img /mnt/tmp which works beautifully.



Here is the layout of the disk: (result of sudo fdisk -l /usr/nasShare/Backups/hpster.img)



Device                            Boot     Start       End   Sectors   Size Id Type
/usr/nasShare/Backups/hpster.img1 * 2048 409599 407552 199M 7 HPFS/NTFS/exFAT
/usr/nasShare/Backups/hpster.img2 409600 937510911 937101312 446.9G 7 HPFS/NTFS/exFAT
/usr/nasShare/Backups/hpster.img3 937510912 976560127 39049216 18.6G 7 HPFS/NTFS/exFAT
/usr/nasShare/Backups/hpster.img4 976560128 976771119 210992 103M c W95 FAT32 (LBA)


I am trying to recover any relevant files, so that I can delete the image, but am faced with an issue of not enough free space on the host system. I gather that the issue is that the "empty" space on the device is not empty in the file.



According to du -h /mnt/tmp I am using 252G



I have read several articles like https://unix.stackexchange.com/questions/199673/modifying-files-inside-a-snapshot-qemu-img-file and https://unix.stackexchange.com/questions/278877/shrinking-raspberry-pi-sd-img-via-ubuntu-server-cli



and the gist of it seems to be:




umount, resize, fdisk/parted, partprobe, fsck, and mount to check all is ok




But I am unsure whether these tools will work on an NTFS partition.





Update:



I have read an article about resizing an NTFS partition, but when I attempt running sudo ntfsresize --info /usr/nasShare/Backups/hpster.img2



I get the following error:




ERROR(2): Failed to check '/usr/nasShare/Backups/hpster.img2' mount
state: No such file or directory Probably /etc/mtab is missing. It's
too risky to continue. You might try an another Linux distro.




(This is a repost from https://unix.stackexchange.com/questions/492401/recover-empty-space-from-ntfs-partition-in-img-file)










share|improve this question



























    0















    I have a snapshot of an old computers harddisk saved as an .img file. I have mounted it with sudo mount -o loop,offset=209715200 /usr/nasShare/Backups/hpster.img /mnt/tmp which works beautifully.



    Here is the layout of the disk: (result of sudo fdisk -l /usr/nasShare/Backups/hpster.img)



    Device                            Boot     Start       End   Sectors   Size Id Type
    /usr/nasShare/Backups/hpster.img1 * 2048 409599 407552 199M 7 HPFS/NTFS/exFAT
    /usr/nasShare/Backups/hpster.img2 409600 937510911 937101312 446.9G 7 HPFS/NTFS/exFAT
    /usr/nasShare/Backups/hpster.img3 937510912 976560127 39049216 18.6G 7 HPFS/NTFS/exFAT
    /usr/nasShare/Backups/hpster.img4 976560128 976771119 210992 103M c W95 FAT32 (LBA)


    I am trying to recover any relevant files, so that I can delete the image, but am faced with an issue of not enough free space on the host system. I gather that the issue is that the "empty" space on the device is not empty in the file.



    According to du -h /mnt/tmp I am using 252G



    I have read several articles like https://unix.stackexchange.com/questions/199673/modifying-files-inside-a-snapshot-qemu-img-file and https://unix.stackexchange.com/questions/278877/shrinking-raspberry-pi-sd-img-via-ubuntu-server-cli



    and the gist of it seems to be:




    umount, resize, fdisk/parted, partprobe, fsck, and mount to check all is ok




    But I am unsure whether these tools will work on an NTFS partition.





    Update:



    I have read an article about resizing an NTFS partition, but when I attempt running sudo ntfsresize --info /usr/nasShare/Backups/hpster.img2



    I get the following error:




    ERROR(2): Failed to check '/usr/nasShare/Backups/hpster.img2' mount
    state: No such file or directory Probably /etc/mtab is missing. It's
    too risky to continue. You might try an another Linux distro.




    (This is a repost from https://unix.stackexchange.com/questions/492401/recover-empty-space-from-ntfs-partition-in-img-file)










    share|improve this question

























      0












      0








      0








      I have a snapshot of an old computers harddisk saved as an .img file. I have mounted it with sudo mount -o loop,offset=209715200 /usr/nasShare/Backups/hpster.img /mnt/tmp which works beautifully.



      Here is the layout of the disk: (result of sudo fdisk -l /usr/nasShare/Backups/hpster.img)



      Device                            Boot     Start       End   Sectors   Size Id Type
      /usr/nasShare/Backups/hpster.img1 * 2048 409599 407552 199M 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img2 409600 937510911 937101312 446.9G 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img3 937510912 976560127 39049216 18.6G 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img4 976560128 976771119 210992 103M c W95 FAT32 (LBA)


      I am trying to recover any relevant files, so that I can delete the image, but am faced with an issue of not enough free space on the host system. I gather that the issue is that the "empty" space on the device is not empty in the file.



      According to du -h /mnt/tmp I am using 252G



      I have read several articles like https://unix.stackexchange.com/questions/199673/modifying-files-inside-a-snapshot-qemu-img-file and https://unix.stackexchange.com/questions/278877/shrinking-raspberry-pi-sd-img-via-ubuntu-server-cli



      and the gist of it seems to be:




      umount, resize, fdisk/parted, partprobe, fsck, and mount to check all is ok




      But I am unsure whether these tools will work on an NTFS partition.





      Update:



      I have read an article about resizing an NTFS partition, but when I attempt running sudo ntfsresize --info /usr/nasShare/Backups/hpster.img2



      I get the following error:




      ERROR(2): Failed to check '/usr/nasShare/Backups/hpster.img2' mount
      state: No such file or directory Probably /etc/mtab is missing. It's
      too risky to continue. You might try an another Linux distro.




      (This is a repost from https://unix.stackexchange.com/questions/492401/recover-empty-space-from-ntfs-partition-in-img-file)










      share|improve this question














      I have a snapshot of an old computers harddisk saved as an .img file. I have mounted it with sudo mount -o loop,offset=209715200 /usr/nasShare/Backups/hpster.img /mnt/tmp which works beautifully.



      Here is the layout of the disk: (result of sudo fdisk -l /usr/nasShare/Backups/hpster.img)



      Device                            Boot     Start       End   Sectors   Size Id Type
      /usr/nasShare/Backups/hpster.img1 * 2048 409599 407552 199M 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img2 409600 937510911 937101312 446.9G 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img3 937510912 976560127 39049216 18.6G 7 HPFS/NTFS/exFAT
      /usr/nasShare/Backups/hpster.img4 976560128 976771119 210992 103M c W95 FAT32 (LBA)


      I am trying to recover any relevant files, so that I can delete the image, but am faced with an issue of not enough free space on the host system. I gather that the issue is that the "empty" space on the device is not empty in the file.



      According to du -h /mnt/tmp I am using 252G



      I have read several articles like https://unix.stackexchange.com/questions/199673/modifying-files-inside-a-snapshot-qemu-img-file and https://unix.stackexchange.com/questions/278877/shrinking-raspberry-pi-sd-img-via-ubuntu-server-cli



      and the gist of it seems to be:




      umount, resize, fdisk/parted, partprobe, fsck, and mount to check all is ok




      But I am unsure whether these tools will work on an NTFS partition.





      Update:



      I have read an article about resizing an NTFS partition, but when I attempt running sudo ntfsresize --info /usr/nasShare/Backups/hpster.img2



      I get the following error:




      ERROR(2): Failed to check '/usr/nasShare/Backups/hpster.img2' mount
      state: No such file or directory Probably /etc/mtab is missing. It's
      too risky to continue. You might try an another Linux distro.




      (This is a repost from https://unix.stackexchange.com/questions/492401/recover-empty-space-from-ntfs-partition-in-img-file)







      ntfs disk-image






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 9:20









      Jonas Stumph StevnsvigJonas Stumph Stevnsvig

      1507




      1507






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390439%2frecover-empty-space-from-ntfs-partition-in-img-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390439%2frecover-empty-space-from-ntfs-partition-in-img-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          Puebla de Zaragoza

          Change location of user folders through cmd or PowerShell?