Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 8470  / 3 Years ago, fri, september 10, 2021, 7:10:11

I am trying to get an ISO file from a bootable USB memory stick. The device name for the stick is dev/sdf1. In this answer: Convert bootable USB to ISO file , dd was suggested for copying. So I did:



sudo dd if=/dev/sdf1 of=win7.iso


However, the stick has a size of 30G, but only 12G are used. Running the command above, it creates an iso image larger than 12G, I stopped dd when the file was > 20G, since I ran out of disk space.
Is it normal that the ISO file gets so big or is there another way to achieve my goal?


More From » boot

 Answers
4

dd is a 1:1 copy, it copies the entire device regardless what's on it. If you only copy a partition (sdf1) it's unlikely to be bootable as the bootloader usually resides on sdf MBR.



If the free space is zeroed, you could save the free space by use of gzip.



To zero the free space, you may use:



mount /dev/sdf1 /mnt/tmp
dd if=/dev/zero bs=1M | split -b 1G - /mnt/tmp/zerofile
sync
rm /mnt/tmp/zerofile*
umount /mnt/tmp


To create a gzip compressed image:



dd if=/dev/sdf bs=1M | gzip > win7.img.gz


To restore from that image, it's:



gunzip < win7.img.gz | dd of=/dev/sdf bs=1M


Other alternatives are partimage or ntfsclone (in case of ntfs), which only store files, not free space, however the result may not be bootable as it's not a 1:1 copy.


[#31002] Saturday, September 11, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ibuteking

Total Points: 35
Total Questions: 128
Total Answers: 138

Location: Indonesia
Member since Thu, Oct 1, 2020
4 Years ago
;