Label a Linux Partition

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
# e2label /dev/sda1
Sample output:


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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 21 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
21 comments… add one
  • Jean-Francois Jan 27, 2009 @ 20:19

    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.

  • Edgar Feb 2, 2009 @ 10:43

    What if you wish to label a reiserfs disk?

  • Marco Feb 3, 2009 @ 16:48

    for reiserfs use reiserfstune -l LABEL and to display the labels of all mounted filesystems, just mount -l

  • Edgar Feb 6, 2009 @ 16:11

    Many thanks!

  • Ralph Corderoy Feb 15, 2009 @ 13:16

    The article is unclear. Must the filesystem be unmounted when e2label is used to set the label?

  • Stevie Nov 23, 2009 @ 17:07

    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

    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?

    • Patrick Dickey Aug 30, 2012 @ 1:10

      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:)

      P.S. I realize this post and comment are three years old, but the question still applies.

      • 🐧 nixCraft Aug 30, 2012 @ 5:45

        It appears that your /etc/fstab was either created by installer or modified by other sysadmin.


        e3label /dev/sda1 boot

        Edit/append in /etc/fstab:

        LABEL=boot		/boot	ext2	defaults	0 2

        And you are done. Where,

        • 0 – dump value. Zero means do not dump file system using dump(8) program.
        • 2 – pass value. This set order for checking file system using fsck at the boot time.

        In short 0 and 2 (or any other value) will not prevent you mounting the file system.

  • Chad Aug 28, 2012 @ 23:34

    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

  • MrToan Oct 13, 2012 @ 18:55

    How to delete a label of a Linux partition? please hepl me?

  • Alan Jebakumar Oct 27, 2014 @ 1:27


    Is it possible to use labeling even on a ext3 filesystem? When i used label on a ext3 fs and rebooted it, the host never came back online.

    Any idea of how it can be fixed?


  • Chad Oct 27, 2014 @ 12:02

    Did you change an existing file system label? If /etc/fstab is referencing the old label the file system won’t be found and therefore will not get mounted. Depending which file system it is and how far your system gets in the boot process you might need to boot to a live cd to correct your fstab (if that’s the problem).

    • Alan Jebakumar Oct 27, 2014 @ 21:16

      Thanks for the revert. Well, the below are the steps that i did
      1. Added a HDD, sdc.
      2. Created a partition sdc1
      3. Formatted the sdc1 partition as ext3 by mkfs.ext3
      4. Mounted the formatted partition in /vols
      5. Added a label to it by $: e2label /dev/sdc1 SambaVols
      6. Added a entry in fstab as
      Sambavols /dev/sdc1 ext3 defaults 1 2

      So when i rebooted the machine after doing these, it never came back. It said that i had to clear up the sambavols drive, as it had errors.

      Please advise.

      • Alan Jebakumar Oct 27, 2014 @ 21:17

        Let me send you a snapshot of the message in a while.

      • Chad Oct 28, 2014 @ 0:01

        Change the end of the fstab entry to 0 0. That will allow the system to boot normally. You also need to put LABEL=Sambavols instead of just Sambavols. You are using the wrong syntax. Always good to test mounting the file system before you reboot.

        • Alan Oct 28, 2014 @ 2:02

          Thanks for the note. Sure will change the values in fstab and trt rebooting. By the way, can you explain what these values mean after the defaults section?

          • Alan Oct 28, 2014 @ 2:05

            Chan, Can you also comment on how to remove a label being set to a ext3 filesystem?

            • Chad Oct 28, 2014 @ 13:19

              Set it to an empty string. FYI, those are two single quotes.

              tune2fs -L ” /dev/sda1

          • Chad Oct 28, 2014 @ 12:55

            Read the man page

            man fstab

            Normally you want the last value to be 2 for non-root file systems, but setting it to 0 will skip checking it during the boot process.

  • SAIN Jul 16, 2015 @ 18:10

    Please let me know the solution as I’m facing a situation in which my partitions are not getting mounted during startup. I’ve checked the fstab and e2lable and every thing seems to be fine but still unable to mount my partitions at startup.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum