How to create multiple partitions on a USB pen drive

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.


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