2

I have partitions that I would like to rename. What are the terminal commands to do this?

kos
  • 35,891

2 Answers2

4

You can re-label file systems with Gnome Disks:

Gnome Disks option menu Gnome Disks rename dialogue

If you really want to use the command line, the command depends on the affected file system type. For ext2/3/4 it's

sudo e2label <DEVICE> <NEW_LABEL>

In a similar fashion there are fatlabel, exfatlabel, ntfslabel, btrfs filesystem label, swaplabel for other file system types with the same command syntax.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

From the command line install the labeling program depending on the filesystem type. Here are all the different installation commands for each filesystem type:

sudo apt-get install mtools             # MS-DOS
sudo apt-get install ntfsprogs          # NTFS
sudo apt-get install e2fsprogs          # Ext2
sudo apt-get install jfsutils           # JFS
sudo apt-get install reiserfsprogs      # ReiserFS
sudo apt-get install xfsprogs           # XFS

Identify your partition using:

sudo fdisk -l

Then, for an example partition sdX:

  • for FAT32:

    sudo mlabel -i /dev/sdX ::"new_label"
    
  • for NTFS:

    sudo ntfslabel /dev/sdX new_label
    
  • for exFAT:

    sudo exfatlabel /dev/sdX new_label
    
  • for ext2/3/4:

    sudo e2label /dev/sdX new_label
    
GAD3R
  • 3,507