0

I'm going to create a bootable USB drive using dd, e.g.

dd bs=1M if=myiso.iso of=/dev/sdc

But I thought maybe beforehand I should fill the device with zeroes:

dd bs=1M if=/dev/zero of=/dev/sdc

Is this step necessary? What would be the advantages of filling the device with zeroes before writing, and the repercussions of not doing so?

1

When you dd you are writing whatever file system your myiso.iso is to the device. Whatever partition table myiso.iso has (and it would have to have one if the iso is of a bootable image) then that partition table if it is valid is going to represent just the size and contents of myiso.iso.

So if you have a 32GB usb stick but your myiso.iso is only 6GB, then you should only see that 6gb partition. Technically you will see whatever the partition table contained in myiso.iso says, which could be invalid for the device you are dd'ing it to. Remember that another name for dd is disk destroyer because there are no validity checks happening.

I would say it's not necessary to first fill the device with zeroes, that would not do anything for functionality of making a bootable device. Would be the same as formatting any disk whether it be to FAT32, NTFS, EXT3, you are not writing zeroes onto the entire device when deleting/creating new partitions.

The one time i can think it would be necessary to write all zeroes to the entire device is if you were giving the device away and wanted to make sure data could not be recovered from it. This would be whatever information lies outside the area of where myiso.iso was written in to on the device.

Repercussions of writing zeroes over an entire device... if a hard disk drive then none really other time it takes to do so for no functional value added. Relatively speaking for an SSD or USB flash memory however, writing zeroes to their entirety is reducing their life. To do it once in a while no big deal, but you would not want to reformat a flash memory device very often with myiso_try_number_50.iso for example. Writing zeroes to the entire device each time would serve no purpose other than wasting your time and reducing the life of the flash memory device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.