Setting Linux Partition Labels
When choosing labels, use meaningful names that are easy to remember. They are case sensitive and can be a maximum of 16 bytes in length. For grub2 search to work properly, labels must not contain embedded spaces.
Most recent Linux distributions including Ubuntu, Suse and Fedora use the btrfs filesystem by default for their root partitions. You can set the label for the root partition using the btrfs command.
This must be done from within a Linux system. The gparted utility is available for all popular distributions and makes it easy to obtain information about your disks and partitions. You can also use gparted to set the label for your Linux swap partition.
gpartd can't set the label for the currently mounted Linux root partition, but it can be used to obtain the physical address needed below.
This example assumes the Linux root partition is on drive 0, partition 3.
Using gpartd we find that the physical address of the partition is /dev/sda3.
For btrfs filesystem, use the following commands to set the partition label.
From a Linux command line enter:
sudo btrfs filesystem label /dev/sda3
The current disk label, if any, for that partition will be displayed.
Entering:
sudo btrfs filesystem label /dev/sda3 ubuntu-24.04
Will set the disk label to ubuntu-24.04
For older Linux ext4 filesystems:
From a Linux command line enter:
sudo e2label /dev/sda3
The current disk label, if any, for that partition will be displayed.
Entering:
sudo e2label /dev/sda3 ubuntu-24.04
Will set the disk label to ubuntu-24.04
To label your EFI partition, use the Linux fatlabel command.
Entering:
sudo fatlabel /dev/sda1 EFI-PART
Will set the EFI partition disk label to EFI-PART
Setting Labels For Other Operating Systems
To set a label on a fat or NTFS filesystem from within Microsoft Windows, go to My Computer, right-click on the drive and click Properties to label the partition.
From within Mac OS-X you can use Finder and right-click on the drive. Then click Get Info to set the label.
Created with the Personal Edition of HelpNDoc: Free Qt Help documentation generator