First, I zeroed completely the drive before creating the UDF filesystem with:
dd if=/dev/zero of=/dev/sdx bs=512
This is 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). You could also use the count=1
switch on the dd command, in order to more-quickly zero just the first 512 bytes of the drive (where the MBR usually is located within), though this was not tested.
To create the file system, the command I used was:
mkudffs --media-type=hd --blocksize=512 /dev/sdx
mkudffs
command will become available on Debian-based Linux distros (such as Ubuntu) after installing a udftools
package:
sudo apt-get install udftools
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 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.
Although I did not do it myself, I would try recommend the following:
Get yourself a USB stick (16G or more) with the base Ubuntu, and set it up with the appropriate partition. If you're using the default Ubuntu disk partitioning (everything under /), that should be easy.
Copy all files form all directories to the UST stick
run grub-install on the new device, such as /dev/sdb1:
cd /boot/grub
grub-install /dev/sdb
You should be able to boot from your new USB stick.
Best Answer
I personally have installed Debian (not ubuntu) to a thumb drive before and absolutely loved it. It makes it very convenient and i wouldn't have it any other way.
I personally used ext2 as I was too worried about the writing affects of journaling that would eventually kill my stick.
I can tell you that with ext2, i have been up and running for roughly 9 months almost none stop. I haven't noticed any problems nor real slowdowns due to my usage.
The only recommendation i have is to run fsck everyweek. This should allow you to see the 'bad sectors' of the drive and it will continue to work around them. That being said, i still do not have any bad sectors and it's working like a charm.
I'd highly recommend a thumb drive linux (next i'm going to try fedora instead of debian) for anyone who travels often and doesn't want to be tied down to using what is available where you are.