Disk /dev/sdb: 927.5 GiB, 995875618816 bytes, 1945069568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc4094bc2

Device     Boot     Start        End    Sectors   Size Id Type
/dev/sdb1            2048     718847     716800   350M  c W95 FAT32 (LBA)
/dev/sdb2          718848  269154303  268435456   128G  7 HPFS/NTFS/exFAT
/dev/sdb4       269156350 1945067519 1675911170 799.1G  f W95 Ext'd (LBA)
/dev/sdb5       403374080 1945067519 1541693440 735.1G  6 FAT16
/dev/sdb6       269156352  403374079  134217728    64G 83 Linux

I have formatted /dev/sdb5 as udf with

mkfs.udf --utf8 -l UDFStore /dev/sdb5

on Gentoo. But blkid doesn't list /dev/sdb5. How can I reliably mount my UDF partition at startup in /etc/fstab when device enumeration changes due to additional connected USB devices at startup.

  • Does fdisk -l shows it Feb 4 '19 at 18:51
  • I abandoned UDF.
    – Necktwi
    Feb 6 '19 at 5:50
  • Apart from mounting issues, I faced with sticky files those won't delete and compiling the kernel on it failed.
    – Necktwi
    Feb 6 '19 at 6:00

Aside from device names, you can mount filesystems using their UUID or label.

For example, if when you created the filesystem you labeled it UDFStore, you can add an /etc/fstab entry like this: LABEL=UDFStore /data udf defaults 0 0

  • that didn't work. lsblk shows no label for /dev/sdb5. Stupid of me for voting up without testing. Ur answer felt very obvious! huh!
    – Necktwi
    Sep 8 '18 at 16:41
  • Plug in the device, then, run find /dev/disk. You'll see paths corresponding to your disks and partitions. Look through the directories by-label, by-partlabel, and by-id. Those are reliable paths, one of which may correspond to the UDF partition. To use filesystem or partition ID's, you can run lsblk -o NAME,FSTYPE,LABEL,PARTLABEL,PARTUUID and match those ID's with the appropriate path from the find command above, by looking for device files in the by-uid and by-uuid directories. Then in /etc/fstab` substitute /dev/sdb5 with the reliable path of your choice. Sep 9 '18 at 3:20
  • lsblk for my udf partition reports no FSTYPE,LABEL,PARTLABEL and PARTUUID
    – Necktwi
    Sep 9 '18 at 3:40
  • See if this helps: unix.stackexchange.com/questions/35973/… Sep 9 '18 at 6:35
  • Though the solution mentioned there is for entire hard disk, can I still mkudffs --media-type=hd --vid=UDFStore /dev/sdb5? Does it destroy data?
    – Necktwi
    Sep 9 '18 at 6:55

But blkid doesn't list /dev/sdb5.

That is probably because of blkid cache. Use -p to bypass cache and specify also block device. E.g.

$ blkid -p /dev/sdb5

It should print something like this:

VOLUME_ID="UDFStore" UUID="5c587177a6c9eba4" VOLUME_SET_ID="5c587177a6c9eba4LinuxUDF" LABEL="UDFStore" LOGICAL_VOLUME_ID="UDFStore" VERSION="2.01" TYPE="udf" USAGE="filesystem"

Then you can use printed UUID to specify your entry in /etc/fstab.

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.