Label a Linux Partition

www‮uttual.‬ri.com
Label a Linux Partition

To label a Linux partition, you can use the e2label command. The e2label command is used to display or change the label of an ext2, ext3, or ext4 filesystem.

To label a partition using the e2label command, you will need to specify the device file of the partition and the label that you want to use. For example, to label the /dev/sda1 partition as MYPARTITION, you can use the following command:

$ sudo e2label /dev/sda1 MYPARTITION

This will label the /dev/sda1 partition as MYPARTITION.

Note that you will need to have root privileges to use the e2label command. You can use the sudo command to execute the e2label command with root privileges.

You can also use the tune2fs command to label a partition. The tune2fs command is used to modify the filesystem parameters of an ext2, ext3, or ext4 filesystem. To label a partition using the tune2fs command, you can use the -L option followed by the label that you want to use. For example, to label the /dev/sda1 partition as MYPARTITION, you can use the following command:

$ sudo tune2fs -L MYPARTITION /dev/sda1

This will label the /dev/sda1 partition as MYPARTITION.

Note that you will need to have root privileges to use the tune2fs command. You can use the sudo command to execute the tune2fs command with root privileges.

You can use the lsblk command to list the block devices on your system, including the device files and labels of the partitions. To list the block devices on your system, you can use the following command:

$ lsblk

This will list the block devices on your system, including the device files and labels of the partitions. You can use this command to verify that the partition has been labeled correctly.

Created Time:2017-10-29 22:08:50  Author:lautturi