Labeling a hard-drives under unix system gives a user a better way so organize block system's devices. Labels are allowed within /etc/fstab files so instead of refering to a partition /dev/sda1 you can provide LABEL=MY_BACKUP . We are going to mention two ways on how to label partition.


The first method is by using e2label command

# blkid /dev/hdb1
/dev/hdb1: UUID="50722b6b-dfd8-4faf-bb27-220fd69b0deb"

this will show current partition label ( if any ) and UUID of the partition. Now to change or add label with e2label:

# e2label /dev/hdb1 "MY_BACKUP"
# blkid /dev/hdb1
/dev/hdb1: UUID="50722b6b-dfd8-4faf-bb27-220fd69b0deb"

Other way on how to label partition with a name is to use tune2fs command

#blkid /dev/hdb1
/dev/hdb1: UUID="50722b6b-dfd8-4faf-bb27-220fd69b0deb" TYPE="ext3" LABEL="MY_BACKUP"
# tune2fs -L "SECRET" /dev/hdb1
tune2fs 1.41.3 (12-Oct-2008)
# blkid /dev/hdb1
/dev/hdb1: UUID="50722b6b-dfd8-4faf-bb27-220fd69b0deb" TYPE="ext3" LABEL="SECRET"


Now we can refer to a /dev/hdb1 partition as SECRET within /etc/fstab as follows:

LABEL=SECRET /mount/point           ext3    defaults        0       2

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top