2

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
  • 779
  • 1
  • 12
  • 28
  • 1
    Try changing the type of partition /dev/sdb1 to 96h (ISO-9660). – Aleix Mercader Oct 03 '13 at 12:52
  • How? Through some program? – Harry Oct 03 '13 at 12:59
  • 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. – Aleix Mercader Oct 03 '13 at 13:04
  • 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 Oct 03 '13 at 13:54
  • 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? – Harry Oct 03 '13 at 13:55
  • I recently ran into similar problems when trying to answer [this question](http://superuser.com/questions/652042/two-partitions-on-usb-drive/652043?noredirect=1#comment820804_652043). 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). – Hennes Oct 03 '13 at 14:14
  • (Too long to post in one single comment: resumed) Possibly relevant information can be found [here](http://superuser.com/questions/391176/flipping-the-removable-media-bit-alternatives-to-bootit), [here](http://superuser.com/questions/400560/windows-7doesnt-recognize-second-partition-on-removable-disk/400617#400617) and [here](http://www.rmprepusb.com/tutorials/multipartufd). – Hennes Oct 03 '13 at 14:15
  • 1
    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. – Aleix Mercader Oct 03 '13 at 14:16
  • @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? – Harry Oct 03 '13 at 14:26
  • 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. – Aleix Mercader Oct 03 '13 at 14:46

3 Answers3

2

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.

Rod Smith
  • 21,455
  • 3
  • 43
  • 55
  • 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. – Mads Skjern Oct 19 '16 at 22:10
  • 1
    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. – Rod Smith Oct 20 '16 at 13:52
  • Very interesting! And that explains a lot. Do you happen to have a source where I can read more about this? – Mads Skjern Oct 20 '16 at 15:08
  • I don't know much about this topic, but I'm pretty sure that [isohybrid](http://www.syslinux.org/wiki/index.php?title=Isohybrid) is one tool that is (or can be) used to create these Frankenstein's Monster setups. – Rod Smith Oct 20 '16 at 19:25
1

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

jerm
  • 206
  • 1
  • 2
  • Yes, you're right. That was a typo in my question above. But in the real, I was specifying it as `/dev/sdb1`. I have now corrected the typo in the question. Thanks! – Harry Oct 03 '13 at 12:39
0

You can do what you need with USB CD ROM Read Only Partition Maker. The problem is, the software is for Windows and it seems to be a little old.

This is the information in the post:

This simple but very powerful and small tools is widely used for formatting and create or management the partiotion size for the DM Controllers. This tools may used for several even for all models if the DM controllers. This is very good utility for creating CD ROM or Read only partition. This tools is widely used for TwinMOS K2 USB Drives also SanDisk USB, Transcent, Apacer USB and so on. If you found you USB has the DM controller after checking with the ChipGenius then select the right version of the tools and apply it.

DM UDisk AP - utility to format, create a CD-ROM and hidden partitions for DM controllers. The archive additionally applied manual in Chinese

gmopx
  • 1
  • 1
  • Is not the linked utility intended for special [U3](https://en.wikipedia.org/wiki/U3) USB flash drives? Also please add essential information about the linked article into the answer. The link can stop functioning. – pabouk - Ukraine stay strong Dec 10 '13 at 17:42
  • Please don't use answers to ask for new questions. If you have a new question, please ask one here: http://superuser.com/questions/ask – slhck Dec 10 '13 at 20:40