Set Linux partition label for common filesystems

Labeling partitions or volumes is a file system feature.  There are typically two commands to set label name for a partition of ext2, ext3 and ext4 type. Both of these commands are from e2fsprogs.

Here are some examples for labeling different partitions in Linux.

Labeling ext2/ext3/ext4 partitions

1. Using e2label to create label.

# e2label /dev/cciss/c0d3p1 new-ssd

2. Using tune2fs to set Label.

# tune2fs -L 400GB-ssd /dev/cciss/c0d3p1

How can we show current partition’s label? With the help of these commands, we can check the label name as below,

# e2label /dev/cciss/c0d3p1
# tune2fs -l /dev/cciss/c0d3p1

Labeling Reiserfs partition with reiserfstune

The reiserfstune command is used for labeling a ReiserFS partition. Before set the Label name for a Reiserfs, it’s suggested to  unmount the filesystem first.

# reiserfstune –l LABEL_NAME /dev/sdb1

Where /dev/sdb1 is the partition formatted with ReiserFS filesystem.

Labeling a SWAP partition with mkswap

The mkswap command can be used for changing label name for a SWAP partition.

After unmounting the filesystem, following command needs to be executed to change the label of  a swap partition.

# mkswap -L LABEL_NAME /dev/sda5

Share this post

Post Comment