Q. How do I label a Linux partition? How do I display current label?
A. You need to use e2label or tune2fs command line to change the label on an ext2/ext3 filesystem. e2label will display or change the filesystem label on the ext2 filesystem located on device.
Display current label
If the optional argument new-label is not present, e2label will simply display the current filesystem label.
$ sudo e2label /dev/sda1
or
# e2label /dev/sda1
Sample output:
/boot
Set a new label
If the optional argument new-label is present, then e2label will set the filesystem label to be new-label. Ext2 filesystem labels can be at most 16 characters long; if new-label is longer than 16 characters, e2label will truncate it and print a warning message. To set a new label, enter:
# e2label /dev/sdb2 usbstroage
It is also possible to set the filesystem label using the -L option of tune2fs, enter:
# tune2fs -L usbstroage /dev/sdb2
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop










{ 11 comments… read them below or add one }
That’s something that I was looking for sometime already. I re-wrote the article on my own blog, with a link to this article as well.
What if you wish to label a reiserfs disk?
for reiserfs use
reiserfstune -l LABELand to display the labels of all mounted filesystems, justmount -lMany thanks!
The article is unclear. Must the filesystem be unmounted when e2label is used to set the label?
@ Ralph Corderoy,
No.
I did this and while I can see the label when I explicitly check for it using the e2label command, it doesn’t show up in /etc/fstab. Ex:
[root@Test ~]# e2label /dev/sda1
BOOT
But then:
[root@Test ~]# cat /etc/fstab
/dev/sda1 / ext3 defaults 1 1
/dev/sda2 swap swap defaults 0 0
I expected to see something like:
LABEL=BOOT /boot ext3 defaults 1 2
Did I do it wrong, or is this only when you create the label when formatting/creating the file type?
The understanding that I’ve gotten is that you need to either change the line in /etc/fstab (/dev/sda1 ext3 defaults 1 1) to the LABEL=BOOT /boot ext3 defaults 1 1, or add that line at the end of /etc/fstab.
I came to this site to find out which one it is, but obviously I didn’t get the answer. So, I’ll keep looking.
Have a great day:)
Patrick.
P.S. I realize this post and comment are three years old, but the question still applies.
@Stevie,
It appears that your /etc/fstab was either created by installer or modified by other sysadmin.
@Patrick,
Edit/append in /etc/fstab:
And you are done. Where,
In short 0 and 2 (or any other value) will not prevent you mounting the file system.
The title should read “Label a Linux File System”. Partitions are modified with a command like fdisk, which can set a BSD disk label. A partition is not required to store a file system on a disk.
For example:
# whole disk, no partition table
mkfs.ext3 /dev/sda
# logical volume, not a partition
mkfs.ext3 /dev/mapper/vg00-usr
How to delete a label of a Linux partition? please hepl me?