Label removable disks under Linux

If you are using removable disks such as USB pendrives, USB harddisks or Firewire disks and would like to have them mounted under /media/drivename (which does happen automatically with Ubuntu), you might want to label them so they always show up with the same name instead of disk, disk-1 and so fourth.

If you label a drive it will always mount using the same name, which facilitates using them with scripts and the like. I use an external Firewire disk for my system backup using BackupPC.

I use an XFS filesystem on that disk. To label it you use the following commands (requires the xfstools package):

# xfs_admin -l <DEVICE>

This will list you the current label. To label the disk write

# xfs_admin -L <LABEL> <DEVICE>

You can verify using your operation with

# xfs_admin -l <DEVICE>

To label disks containing ext2, ext3 or ext4 you use the e2label program and the mtools package for FAT16/32 volumes. more information can be found here.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.