3

In my search for the ideal filesystem to share files between a lot of computer with a lot of different OS'es I accepted this answer and installed a UDF filesystem on my USB stick.

First I blanked the disk, to make sure there are no leftovers to confuse a system that's reading the drive:

dd if=/dev/zero of=/dev/sdb bs=1M

Then I formatted the drive, using udftools from arch linux's AUR:

sudo mkudffs --media-type=hd --blocksize=512 /dev/sdb

Obviously, the drive was in /dev/sdb.

Now my question is, since the drive doesn't have any traditional partitions or even a partition table as far as I know, it does not have a UUID. Therefore, I can not add it to the fstab, which I find rather annoying.

What can I do to fix this (e.g. is there an alternative way to set default mount point and options, or an alternate partitioning option)?

  • You object to using /dev/sdb in the first field? – Kyle Jones Apr 8 '12 at 0:31
  • @KyleJones, a USB stick is unlikely to have a consistent /dev/sdX name. – cjm Apr 8 '12 at 4:36
  • 1
    Are you sure it doesn't have a UUID? Try running blkid without any options – Jodie C Apr 8 '12 at 4:49
  • @cjm Most of the time it will. The few other times the mount will fail. – Kyle Jones Apr 8 '12 at 5:49
3

Choose a blocksize of at least 2K (which is the default) and add --vid= to your mkudffs parameters. (The blkid from util-linux doesn't seem to cope with smaller blocksizes.)

$ mkudffs --media-type=hd --vid=my-drive /dev/sdj
$ blkid /dev/sdj
/dev/sdj: LABEL="my-drive" TYPE="udf"

Now you can use LABEL=my-drive in /etc/fstab.

  • although the other answers were correct too, this one gave me the most hands on approach, so I chose it. – romeovs Apr 8 '12 at 10:41
  • 1
    For those who, like me, don't know how to mount a drive by label, see here. – RolfBly May 29 '15 at 20:08
3

If you need blocksize=512 for Windows compatibility, there is a fix to util-linux that updates blkid to recognize vid as label on any block size. It has not gotten into a released version yet; it was committed on March 1, 2013. There is also a bug in the udf kernel module that prevents it from using a partition larger than 128G - the fix for that was committed to mainline in early February and has just been committed to the 3.0-stable, 3.4-stable, and 3.8-stable branches.

2

Make sure that you use --blocksize=512 (unless you have native 4k disk). UDF blocksize must matches logical (sector) size of the disk which is 512 bytes. Older mkudfffs versions are unable to detect logical sector size and fallback to value CD/DVD value 2048 (which cause problems for other OS as they do not expect CD/DVD blocksize on hard disks).

blkid from the util-linux v2.30 provides UUID also for UDF filesystems, so just upgrade util-linux to new version and then you can use UUID in /etc/fstab. UUID is calculated from the UDF Volume Set Identifier which has by UDF definition, first 16 characters unique, non-trivial, non-fixed and suitable to guarantee unique identifier.

Also mkudffs since version 1.1 has option --uuid= for specifying own UUID.

0

Alternatively, you can put on an FS label, and then mount using the LABEL= option. This definitely works, but it doesn't meet your UUID criteria.

0

Does your distribution have /dev/disk/by-* symlinks?

Among them, you could probably find a way to identify the USB-stick-with-UDF in a way that won't vary like /dev/sd* could.

-1

Well, UUID is not a parition-only attribute, actually.

man mkudffs mentions:

  • --lvid=logical-volume-ident — Specify the logical volume identifier.
  • --vid=volume-ident — Specify the volume identifier.
  • --vsid=volume-set-ident — Specify the volume set identifier.

Have you tried using any of it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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