Finding out which disk is which on Ubuntu

June 9, 2019

My file server often has various disks swapped in and out. It can get confusing which /dev/sd? corresponds to which drive. While reading the man page of findfs, I stumbled on this:

The complete overview about filesystems and partitions you can get for example by:
  lsblk –fs
  partx –show
  blkid

These three things (along with judicious use of e2label and the other *label commands) is going to make my life a lot easier!

Advertisements

Setting disk labels in Linux

June 5, 2010

Back in December, I wrote about setting UUIDs so multiple disks could be mounted in the same place using /etc/fstab.

I’ve since decided that was dumb. Disks should have unique UUIDs – Linux may use that for more than just mounting the file system. Luckily, there is a better option: the disk label.

Mounting a disk using the disk label is very similar to mounting using UUIDs. First, you need to give the disk a label. I think you can do that when you mkfs, but it’s pretty cheap to do it after you’ve already bulit the file system using:

e2label /dev/sdb1 mylabel

(substituting whatever device you want for /dev/sdb1 and whatever label you want for mylabel. This will work for ext2, ext3 and ext4 – if you’re using another file system, it should have its own label utility.)

Then, rather than specifying UUID= in /etc/fstab, specify:

LABEL=mylabel

Your disk will mount automatically, but still have a unique ID. Sounds better to me.

Sun has a useful tutorial at: http://wikis.sun.com/display/BigAdmin/Using+Disk+Labels+on+Linux+File+Systems