2

I have an iso image (it's a windows installation disk), but I do not want to burn dvd. I want to create a bootable usb flash drive instead. And I want to use linux tools to accomplish this task.

I have found several recipes, they suggest using dd tool as follows:

dd if=/path/to/my.iso of=/dev/sdx

(f.e. here https://www.linux.com/blog/how-burn-iso-usb-drive)

Another recipe suggest to create some partitions on usb first (f.e. Terminal: create bootable USB from iso ) and this looks very strange to me.

As I understand the flash drive is just a storage. It's just a hardware which stores/returns a block of data given the index of this block. Is it correct?

Linux provides access to this storage via /dev/sdx device (where x may be any letter, in my case device name is /dev/sdb). I can get access to any bit of data on usb stick via this device. Is this correct?

The dd command just reads the contents of file bit by bit (well, block by block) and writes the data to specified device. If the input file is large enough every single bit of data on the usb stick will be overwritten. No information about partitions, filesystem's types, etc. would survive. Is this correct? If yes, what's use to partition/format usb stick before dd command?

The result of dd command is not what I expected. After it's complete I can see the files on the usb stick from my linux machine, but the stick is not bootable and my windows can't read it at all (it suggest to format the usb drive).

I'll use some tool to create the bootable usb stick (rufus or yumi or whatever else), it's not a problem now. The problem is that I do not understand why can't I use dd for this purpose.

May be the above-mentioned recipes work not for all iso images? Please help me to understand what's going on.

2

Cloning and extraction

I have an iso image (it's a windows installation disk), but I do not want to burn dvd. I want to create a bootable usb flash drive instead. And I want to use linux tools to accomplish this task.

I have found several recipes, they suggest using dd tool as follows:

dd if=/path/to/my.iso of=/dev/sdx

This is cloning (done with dd and other cloning tools.

(f.e. here https://www.linux.com/blog/how-burn-iso-usb-drive)

Another recipe suggest to create some partitions on usb first (f.e. Terminal: create bootable USB from iso ) and this looks very strange to me.

This is done with extracting tools.

Both cloning and extraction are possible and common methods. There are several tools for both methods.

If the iso file is a hybrid iso file, you can make a boot drive by burning to a CD/DVD disk and by cloning to a mass storage device: USB pendrive, memory card, HDD or SSD. If the iso file is not a hybrid iso file, you can make a boot drive by burning to a CD/DVD disk, but it will not work from a mass storage device. But you can still use an extracting tool to make a boot device (by creating the correct partition table and extract the relevant content from the iso file to a mass storage device).

As I understand the flash drive is just a storage. It's just a hardware which stores/returns a block of data given the index of this block. Is it correct?

Yes.

Linux provides access to this storage via /dev/sdx device (where x may be any letter, in my case device name is /dev/sdb). I can get access to any bit of data on usb stick via this device. Is this correct?

Yes.

The dd command just reads the contents of file bit by bit (well, block by block) and writes the data to specified device. If the input file is large enough every single bit of data on the usb stick will be overwritten. No information about partitions, filesystem's types, etc. would survive. Is this correct? If yes, what's use to partition/format usb stick before dd command?

Yes, and for that reason, you need not partition/format usb stick before cloning. All traces of it will disappear anyway.

The result of dd command is not what I expected. After it's complete I can see the files on the usb stick from my linux machine, but the stick is not bootable and my windows can't read it at all (it suggest to format the usb drive).

Most main linux distros provide hybrid iso files, that make USB boot drives when cloned. But not all of them, for example not Knoppix (but you can treat a Knoppix iso file with isohybrid).

Windows 7-10 iso files are not hybrid iso files. So you need an extracting method (manual or with a tool) to create a USB boot drive.

I'll use some tool to create the bootable usb stick (rufus or yumi or whatever else), it's not a problem now. The problem is that I do not understand why can't I use dd for this purpose.

May be the above-mentioned recipes work not for all iso images? Please help me to understand what's going on.

Links

help.ubuntu.com/community/Installation/iso2usb

  • Drives - mass storage devices
  • Cloning and extraction
  • Do it yourself (which helps understanding what's going on)

Cloning needs no preparation

  • dd deserves the nicknames 'disk destroyer' and 'data destroyer'
  • Tools with a final checkpoint
  • If cloning does not work
1

How you use dd is determined by how the .iso file is created.

The dd command just reads the contents of file bit by bit (well, block by block) and writes the data to specified device. If the input file is large enough every single bit of data on the usb stick will be overwritten.

This is correct, but what if I ran dd if=/dev/sdb1 of=test.iso when creating the .iso? Or maybe ran something like dd if=/dev/sdb of=test.iso bs=1M seek=1 causing it to skip the first 1M of data?

dd does not care about the underlying partition scheme, this means that how you use it depends entirely on the structure of the block device and the data you are writing.

  • Well, I understand that if iso file contains some garbage the usb stick would not be bootable/usable! But my iso file is a valid iso file. And I mentioned some recipes which tell approximately "to make usb stick from iso image just use dd". Are these recipes all wrong? – lesnik Jun 19 '18 at 14:02
  • Again, dd does not have a single use case. It can be used in different ways. How you use it to write is determined by how you read the information in the first place. A simple dd if=file of=/dev/sdx is usually the correct route, but not always. – imbuedHope Jun 19 '18 at 14:05
1

If you dd to the device you will lose your usb free space since dd'ing will overwrite MBR/GPT.

Partitioning your device may allow to write your image to a partition, allowing you to keep your free space. But you will need to tweek your boot manager (grub?) to be able to start from that partition. If you partition your drive you will have sdx1, sdx2, ... allowing you to dd if=your.iso of=/dev/sdx1 or the partition you want.

The problem here is that you want to do that with a windows installation disk, and that may be a problem. If windows expects a DVD unit for the installation it may not boot or you may need to tweek that image in orther to avoid that check. On Linux things are easier since many distros allow to start the iso itself, other may need some hacks to be able to have a single USB with a lot of distros you can start from.

  • So, dd is appropriate tool to "burn" iso image into usb stick, but not for all the images? iso images of (some) Linux distros are prepared in some special way which allows the iso to start itself? And in general dd is NOT an appropriate tool for all valid iso images? – lesnik Jun 19 '18 at 14:33
  • @lesnik if you "burn" your ISO (let's say 4.4GB) in your 64GB USB stick with dd if=your.iso of=/dev/sdx you will have a "logical" USB with an ISO image burnt on it and ONLY 4.4GB of space (MBR/GPT will be overwritten removing your partitioning scheme). Grub allows starting from ISO files, so you can store many ISOs in one directory and tell grub to start one ISO or another from the boot menu. Many of those distros will allow start and installing without the need of hacking into its files, others will need you to make modifications for the installation to work. – YoMismo Jun 20 '18 at 6:38

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.