It is easy to find that ext2 filesystem labels can be set with tune2fs and e2label. GParted GUI offers to give partition labels when creating partitions of any type, but not to change the label of an existing partition.

I am only interested in MBR partitions (not GPT) and preferably console tools. In particular, I am using the JFS filesystem. Can I give it a label to be used in /etc/fstab ? Human-readable label, not the GUID?


Compare the description of an MBR partition table entry with the description of a GPT/GUID partition entry. You'll see that while the GPT/GUID partition has dedicated locations to have both an "unique partition GUID" and a "partition name", there none of those available for MBR. So you just can't do this on MBR, it's available only for GPT.

There's still an unique 32bits identifier for the whole MBR (at position 0x1B8) that might be usable, along with the partition number. It can be changed using fdisk's expert options:

# fdisk /dev/ram0
Command (m for help): x

Expert command (m for help): i

Enter the new disk identifier: 0xdf201070

Disk identifier changed from 0xdeadbeaf to 0xdf201070.

Expert command (m for help): r

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

What you should probably use, like with tune2fs for ext2, is jfs_tune to label the filesystem. For example:

# jfs_tune -L mylabel /dev/ram0p1
jfs_tune version 1.1.15, 04-Mar-2011
Volume label updated successfully.
# blkid |grep ram0
/dev/ram0: PTUUID="df201070" PTTYPE="dos"
/dev/ram0p1: LABEL="mylabel" UUID="e1805bac-44fb-4f4e-860b-64a1d303400f" TYPE="jfs" PARTUUID="df201070-01"

All "variables" output by blkid are probably usable in /etc/fstab, you should do tests.

  • jfs_tune is the proper solution, but, unfortunately I have to unmount / to use it, i.e. reboot from another disk. – MKaama Jul 10 '18 at 11:36

Use gdisk:

sudo gdisk /dev/sda

Use the c command to change a partition's name, and the w command to save your changes.

(Surely there's a command-line option for this though! Would love to be enlightened).

  • gdisk would convert my MBR into GPT, wich I do not want. – MKaama Jul 10 '18 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.