Sunday 13 December 2015

How to list partition labels in Linux

This is a small post on how we can view list of assigned labels for partitions in Linux OS. We some times assign meaningful labels to partitions so that we can name them in /etc/fstab file for readability. For example most of the time we label boot partition with label as “boot”.
So how can we see available or assigned labels for partitions in Linux? It is possible, we have couple of commands like e2label to see label assigned to that partition.
Through e2label command
e2label device-name
Example:
root@linuxnix-209:/home/linuxnix# e2label /dev/sda1
boot
root@linuxnix-209:/home/taggle#
Through blkid command
blkid
output:
/dev/sda1: UUID="26299cdc-ea26-4fcd-a111-9af875d58a81" TYPE="ext4" LABEL="boot"
Through /dev folder mappings
ls -l /dev/disk/by-label/
Output:
root@linuxnix-209:/home/linuxnix# ls -l /dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10 Nov 18 13:08 boot -> ../../sda1
This /dev/disk/by-label folder and blkid are more useful to list all assigned labels.



No comments:

Post a Comment