How to create multiple partitions on a USB pen drive

5,041

Solution 1

AFAIK, GParted doesn't support ISO-9660. Certainly it's not listed in the View->File System Support dialog box. This isn't surprising, really, since ISO-9660 is intended for use on optical discs, not on hard disk partitions. I don't consider this a bug in GParted.

As to Windows' inability to access the partition, that's probably a matter of Microsoft's programmers deciding it was too odd a thing to do. It's conceivable that there's a third-party driver that will enable Windows to mount such a partition, but I haven't searched for such a thing. Even if you find it, though, Windows is still limited to using one partition per USB flash drive, so in your scenario you'll be able to access just one partition from Windows.

The real question is: What are you trying to accomplish? That is, what is your ultimate goal in setting up a USB flash drive in this way? There may be some other way to do it.

Solution 2

Is "of=/dev/sdb" a typo? shouldn't that be /dev/sdb1? Looks like you're dd-ing form the beginning of the drive, irrespective of the partition map you just built

Share:
5,041

Related videos on Youtube

Harry
Author by

Harry

Updated on September 18, 2022

Comments

  • Harry
    Harry almost 2 years

    I would like to be able to create 2 partitions on my USB pen drive: 1 readonly (cdrom) partition, and 1 writable partition (FAT32).

    What I have tried so far with no success:

    1. Using /sbin/gparted on Linux, I created two FAT32 partitions on the pen drive.

    2. Next, I created a small iso image (~300KB in size) , like so:

      $ genisoimage -V myLabel -rJ -o /tmp/my.iso /path/to/data
      
    3. Next, I dd'ed this iso to the first FAT32 partition, like so:

      $ dd if=/tmp/my.iso of=/dev/sdb1 bs=1M conv=notrunc
      $ sync
      

      (Here, /dev/sdb corresponds to my pen drive.)

    Results:

    1. The Nautilus file manager can see both the CDROM and the FAT32 partitions just fine. But gparted shows the overwritten (CDROM) partition's file-system type as 'unknown'!

    2. Just like gparted, Windows 7 is unable to recognize the file-system on the first (CDROM) partition (that Windows is hardwired to see anyway), and so prompts me to format it!

    I'm unable to understand why Nautilus can show my partitions just fine but not gparted and Windows.

    • Harry
      Harry over 10 years
      How? Through some program?
    • Aleix Mercader
      Aleix Mercader over 10 years
      With gparted or any other partitioning tool. What I mean is that a partition that has an ISO-9660 filesystem on it should not be marked as FAT32.
    • Harry
      Harry over 10 years
      At first, I thought that was it. But turns out, it isn't. I first verified in a hex editor that, earlier, the partition-type values for my partitions was 0x0b (FAT32) each. After my edit, I re-verified that the new partition-type values were 0x96 and 0x0b respectively, as you suggested. But the same old behavior: gparted showing file-system type as 'unknown'.
    • Harry
      Harry over 10 years
      Could it be that gparted and Windows both expect the partition extents to be consistent with the file-system sitting between those extents. My original sdb1 size was 33 MiB, but my.iso is only 330KB with notrunc option being used. So the extends in the 1st partition entry are not consistent with the contents as a result. Is this worth trying?
    • ganesh
      ganesh over 10 years
      I recently ran into similar problems when trying to answer this question. There is absolutely no clear sane reason why the windows side would not work with multiple partitions, but apparently it gets explicitly blocked on flash drives. (Mind you, NOT on USB drives, just the USB flashdrive subset).
    • ganesh
      ganesh over 10 years
      (Too long to post in one single comment: resumed) Possibly relevant information can be found here, here and here.
    • Aleix Mercader
      Aleix Mercader over 10 years
      If changing the type is not working, I would assume that Windows doesn't know how to mount an ISO 9660 partition. Try to run file -s /dev/sdb1 from Linux, see if if reports the correct filesystem. You could also try filling sdb1 with zeros before writing the image, in case any leftover data at the end of the partition confuses Windows or gparted.
    • Harry
      Harry over 10 years
      @AleixMercader file -s ... gives: /dev/sdb1: # ISO 9660 CD-ROM filesystem data 'mycd. (Note: The label I had actually specified in the genisoimage command was: 'mycd'. The trailing quote in the label outputted by file is missing - I hope something weird is not going on there.) I'll try zeroing out sdb1 next. But, are you sure, I don't have to mess with partition extents in the partition entry for sdb1?
    • Aleix Mercader
      Aleix Mercader over 10 years
      I don't know about the extents, but my guess is that if Windows doesn't even like multiple partitions in USB flash drives, it may as well hate CD filesystems in them.
  • pabouk - Ukraine stay strong
    pabouk - Ukraine stay strong over 10 years
    Is not the linked utility intended for special U3 USB flash drives? Also please add essential information about the linked article into the answer. The link can stop functioning.
  • slhck
    slhck over 10 years
    Please don't use answers to ask for new questions. If you have a new question, please ask one here: superuser.com/questions/ask
  • Mads Skjern
    Mads Skjern over 7 years
    It is possible to dd fx a Linux iso image to a USB pen. It works perfectly well for installing Ubuntu and Lubuntu; I have not tried with others. If you start up GParted while that USB pen is in, GParted will give an error message, that the drive has a GPT signature, but no partition table. I think such a widely used tool should at least recognize that it's an iso9660, and give a more appropriate/correct response to the user.
  • Rod Smith
    Rod Smith over 7 years
    The format of Ubuntu's (and many other Linux distributions') .iso files is a Frankenstein's Monster mish-mash. It's designed to be interpreted both as an ISO-9660 filesystem when written to an optical disc and as a partitioned disk when written to a USB drive. To do this, it makes liberal use of quirks in how the data structures are laid out, creating a hybrid that's arguably illegal, but that happens to work. It's unreasonable to expect GParted or other tools designed to work with legal disks to work correctly with such a bizarre format. None of this is related to Harry's problem, BTW.
  • Mads Skjern
    Mads Skjern over 7 years
    Very interesting! And that explains a lot. Do you happen to have a source where I can read more about this?
  • Rod Smith
    Rod Smith over 7 years
    I don't know much about this topic, but I'm pretty sure that isohybrid is one tool that is (or can be) used to create these Frankenstein's Monster setups.