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?


2 Answers 2


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
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.

  • Thanks, but running the command dd if=/dev/sdf1 bs=1M | gzip > win7.img.gz still makes win7.img.gz larger than 12G, right now it is already >16G and it is still running, so I have to kill dd due to low disk space. May 28, 2013 at 14:56
  • Added an instruction to zero free space beforehand. Using split in case of Windows FAT filesystem with max file size limit. Use of=zerofile instead if there's no such limit. May 28, 2013 at 15:01

You can compress the image like this

dd if=/dev/sdf1 conv=sync,noerror bs=64K | gzip -c  > usb.img.gz

That way, it will not copy the blank parts of the usb stick.

Also dd creates a disk image, not an iso.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .