3

I bought a bunch of USB sticks that I want to give as a gift to friends and clients, with some files on them. I'd like to have the files non-erasable (though I realise they can format the drive, I know that most of them won't, it's just to prevent accidental deletion of the files), while keeping the rest of the space free for them to use as they prefer.

I was told that the best option would be to make two partitions, one of them read-only, and the other read-write. I can do that with the max file system, but I need something that works cross-platform.

I thought I found my answer here https://apple.stackexchange.com/a/24120/31048 (create an ISO9660 "DVD/CD Master" and burn it on the drive using diskutil command line), but it produces something that can't be mounted anywhere.

Any ideas?

Thanks!

EDIT I found a solution, but it doesn't solve everything. First, the CDR format that Utility Disk creates is not usable as it is, you need to convert it to ISO

hdiutil makehybrid -iso -joliet -o IMAGE.iso IMAGE.cdr

and then to DMG, using the following command:

hdiutil convert -format UDRW -o IMAGE.dmg IMAGE.iso

If you then burn the DMG file into the correct drive

sudo dd if=IMAGE.dmg of=/dev/rdisk1 bs=1m

It will work as expected: read only partition, compatible cross-platform. THe only problem I have left is this: the method described above formats the whole drive and creates one read-only partition, while the rest of the free space on the pen drive can't be used.

If I create two partitions, like this:

diskutil list
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.1 GB     disk1
   1:       Microsoft Basic Data UNTITLED 1              299.9 MB   disk1s1
   2:       Microsoft Basic Data UNTITLED 2              1.8 GB     disk1s2

And run this command:

sudo dd if=IMAGE.dmg of=/dev/rdisk1s1 bs=1m

It does write the IMAGE on the first partition, but it's unreadable. Is there a way to have both a read-only partition and another one that can be used as a normal VFAT, to copy/delete files in?

Thanks.

0

You must log in to answer this question.

Browse other questions tagged .