0

This question already has an answer here:

I have a usb-drive which I want to use both as storage (for windows too) and as a (Linux) Bootable. So I have to image the ISO of the linux distribution that I have into a specific partition of my usb drive. Suppose the drive is sdc and I have made two partitions: sdc1 for storage(NTFS) in the beginning and sdc2 (FAT32) following that (I use GParted).

I know that for the simple case of just making the drive bootable we use dd as :

    dd if=name.iso of=/dev/sdc bs=512k

That would of course image the iso in the drive, not the specific partition,making it impossible to use the usb as storage. I thought of using /dev/sdc2 as the destination instead of /dev/sdc but after googling I concluded that's not how it's supposed to work. So why can't I just use /dev/sdc2 ? I tried both:

Writing to /dev/sdc changes any partitions I have made and it creates 2 partitions in the beginning and leaves the rest unallocated, as it's supposed to.Writing to /dev/sdc2 doesn't "mess" with the partitions I have and it just writes in the second partition.

So what do I have to do? Do I have to partition the drive in another way (I've read this How do I partition a USB drive so that it's bootable and has a Windows-compatible data storage partition?) ?

Having done the partition correctly, how must I use dd to write in a specific partition?

marked as duplicate by Rui F Ribeiro, Stephen Rauch, Archemar, Anthon, Romeo Ninov Jul 5 '17 at 7:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

dd-ing the ISO to a partition doesn't work because the ISO itself contains a partition table, as you discovered. But what you can do is create your partitions after the fact.

  1. dd the ISO to the entire USB disk (ex. sdc)
  2. Add any additional partitions using a partitioning tool.

You mentioned the ISO creates two partitions, so that means you can create at most two additional primary partitions.

  • If I dd the iso first, then it creates the two partitions in the beginning. Windows only sees the first partition on a drive.Can I move these to the end and then add another primary partition in the beginning? – Dimitris Jul 4 '17 at 19:49
  • Oh, Windows, why must you be so difficult! Hmm... With the ISO dd'd and the drive connected to your PC, do you see any symlinks in /dev/disk/by-* pointing to the two partitions? My first thought was no, that the bootloader is expecting the partitions to be as they are. But, perhaps it's using either a partition or filesystem label to detect them. If the latter is the case, then the partition order won't matter. – Emmanuel Rosa Jul 4 '17 at 20:17

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