Recover empty space from NTFS partition in .img file [on hold]
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 Modifying files inside a snapshot (qemu img file) and 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.
filesystems ntfs disk-image
New contributor
put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Jeff Schaller, JigglyNaga, Romeo Ninov 12 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Jeff Schaller, JigglyNaga
add a comment |
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 Modifying files inside a snapshot (qemu img file) and 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.
filesystems ntfs disk-image
New contributor
put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Jeff Schaller, JigglyNaga, Romeo Ninov 12 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Jeff Schaller, JigglyNaga
3
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
1
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
1
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
1
I have posted it on su
– JoSSte
18 hours ago
add a comment |
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 Modifying files inside a snapshot (qemu img file) and 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.
filesystems ntfs disk-image
New contributor
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 Modifying files inside a snapshot (qemu img file) and 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.
filesystems ntfs disk-image
filesystems ntfs disk-image
New contributor
New contributor
edited 19 hours ago
New contributor
asked 20 hours ago
JoSSte
1044
1044
New contributor
New contributor
put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Jeff Schaller, JigglyNaga, Romeo Ninov 12 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Jeff Schaller, JigglyNaga
put on hold as off-topic by Rui F Ribeiro, RalfFriedl, Jeff Schaller, JigglyNaga, Romeo Ninov 12 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Jeff Schaller, JigglyNaga
3
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
1
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
1
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
1
I have posted it on su
– JoSSte
18 hours ago
add a comment |
3
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
1
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
1
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
1
I have posted it on su
– JoSSte
18 hours ago
3
3
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
1
1
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
1
1
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
1
1
I have posted it on su
– JoSSte
18 hours ago
I have posted it on su
– JoSSte
18 hours ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
3
The question is about the internals and manipulating windows file systems
– Rui F Ribeiro
19 hours ago
@RuiFRibeiro thank you for retagging my question. I have updated the title as well, om order to avoid misconceptions.
– JoSSte
19 hours ago
1
You could try mounting it on Win VM which can be downloaded from MS site. Then simply use Windows' own defrag and resize the partitions. And after that trim the image file.
– raspi
19 hours ago
1
Windows people do not hang here much, you might be luckier asking this in superuser than here
– Rui F Ribeiro
19 hours ago
1
I have posted it on su
– JoSSte
18 hours ago