Labeling Partitions with LABEL and PARTLABEL

So working on a system that had incorrect partitioning configured.  In /etc/fstab the partitions were configured with:

PARTLABEL=data1 /data1 ext4 defaults 0 0
PARTLABEL=data2 /data2 ext4 defaults 0 0

but the partitions did not have PARTLABELS set. The LABEL and PARTLABEL can be viewed with:

lsblk -o name,label,partlabel,mountpoint,size,uuid

To set the label property use:

e2label /dev/sdb1 mylabel

To set the partlabel on a GPT partition first install gdisk:

yum install gdisk

Then run it on the disk you wish to amend – I’m using sdb but you should change that for your own circumstances:

gdisk /dev/sdb

To change the partlabel enter ‘c’ and provide the label you want to use. Then ‘w’ to write the changes, followed by ‘y’ if you are positive you are amending the correct device.

 

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>