After failing to copy a file bigger than 4G to my 8G USB flash drive, I formatted it as ext3. While this is working fine for me so far, it will cause problems if I want to use it to copy files to someone which does not use Linux.

I am thinking of formatting it as UDF instead, which I hope would allow it to be read (and possibly even written) on the three most popular operating systems (Windows, MacOS, and Linux), without having to install any extra drivers. However, from what I found on the web already, there seem to be several small gotchas related to which parameters are used to create the filesystem, which can reduce the compability (but most of the pages I found are about optical media, not USB flash drives).

I would like to know:

  • Which utility should I use to create the filesystem? (So far I have found mkudffs and genisoimage, and mkudffs seems the best option.)
  • Which parameters should I use with the chosen utility for maximum compability?
  • How compatible with the most common versions of these three operating systems UDF actually is?
  • Is using UDF actually the best idea? Is there another filesystem which would have better compatibility, with no problematic restrictions like the FAT32 4G file size limit, and without having to install special drivers in every single computer which touches it?
link|improve this question
1  
Related question: serverfault.com/questions/55089/… – CesarB Jan 2 '10 at 3:03
feedback

4 Answers

up vote 12 down vote accepted

The command I used was mkudffs --media-type=hd --blocksize=512. The default blocksize for mkudffs is 2048, which is wrong for a USB flash drive (which uses 512-byte sectors). Since the block size is used to find the filesystem metadata, using a wrong block size can make it not be recognized as a UDF filesystem (since the anchor will not be where the filesystem driver is expecting). Note that the mkudffs man page is wrong; 512 is a valid value for the block size (and the code explicitly accepts it).

I zeroed completely the drive before using mkudffs, to avoid any leftover superblocks or other metadata which could confuse the operating systems' filesystem type detection (at least zeroing the first sector should be needed, to obliterate the partition table; the first few sectors are not used by UDF, and a leftover partition table could really confuse things). I also used the whole drive instead of a partition; this should be more compatible.

The result of my testing so far:

  • Linux with the most recent kernel (2.6.31, from Ubuntu 9.10): works.
  • Linux with an older kernel: needs the bs=512 option to mount, because it incorrectly used 2048 instead of the device sector size (fixed in commit 1197e4d).
  • Windows Vista: works.
  • A brand-new Mac: works.
  • Windows XP: can read fine, but gives "access denied" when trying to write; also seems to think the disk is full.

While I have not so far tried to create a file larger than 4G in it, I see no reason why it would not work.

Given that it worked perfectly on all recent operating systems (only having to mount manually on Linux, which will not be needed anymore as soon as Ubuntu 9.10 and Fedora 12 are out), and worked read-only in Windows XP (which was a surprise to me; I was expecting it to not recognize the filesystem at all), using UDF instead of FAT32 or NTFS in big USB flash drives seems a good idea.

link|improve this answer
works great, no need for fancy mount options on karmic or windows 7 – Matt Joiner Dec 29 '09 at 13:53
how did you format/partition the drive? I have zeroed my 32GB USB drive, using dd if=/dev/zero of=/dev/sdb bs=1M, which leaves it without any partition table. – romeovs Apr 6 at 11:00
@romeovs Then create a new partition table. You can use gparted for this if you want something graphical. I belive you can mount the device (instead of a partition) as well, but I'm not sure which OSs work and which don't if you do this. – Hugo Apr 25 at 22:59
@romeovs: I did not partition the drive. That is the whole point of zeroing it, to remove the partition table and old filesystem leftovers and put the UDF filesystem in the whole unpartitioned drive. Creating a partition table would only risk confusing things. – CesarB May 1 at 16:52
feedback

I can confirm that this works nicely on Solaris 10 and OpenSolaris machines, too for what it's worth.

link|improve this answer
feedback

I seem to recall having done that, the problem I found is that the linux version I had mounted it read only, as the driver had not been built for r/w. It did work in windows, and I think mac.

Yeah, a good solution is hard to find. For a while I had an external drive with a fat32 partition that had drivers for win and mac, a mac partition, and a big ext3 partition. It worked, but it meant installing drivers. Neat trick was it was also bootable on a mac (fw&usb), you have to leave space and take some notes, then you can add partitions via the command line and a mac partition table as well.

The world needs a free, usable by everything, file system. ZFS would be a nice choice. :-)

link|improve this answer
ZFS would be nice to have, but would confuse a lot of people. It is also a bit overkill for external media, don't you think? More suited for giant file servers, from what I can tell. – Mike Cooper Sep 12 '09 at 2:52
1  
Well, ZFS does check summing and error recovery, which makes a lot of sense for flaky consumer stuff. :-D We are all storing enough these days that bit rot will eat something eventually (see the study Sun did on the issue that lead to ZFS, also note the undetected error rate for the encoding on HD). We need a real fs that everything can use, and fatX isn't it. Not here yet, really. – Ronald Pottol Sep 23 '09 at 23:31
feedback

NTFS, with NTFS-3G you can write to it using Linux and take a look at http://macntfs-3g.blogspot.com/ for your Mac.

link|improve this answer
1  
This seems to involve extra drivers for Mac. – Mike Cooper Sep 12 '09 at 1:53
If he doesn't want to use FAT he is stuck and NTFS-3G works on Mac already he needs what I linked for write. – user10547 Sep 12 '09 at 2:22
1  
One slight problem is that it is not my Mac. I would rather not have to install a driver in other people's computers. – CesarB Sep 26 '09 at 13:35
feedback

Your Answer

 
or
required, but never shown

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