6

doing lsblk -o type,name,label,partlabel

  • LABEL is at the partition level, and is set via mkfs -L <label> when creating the file system, it is this one used in fstab for mounting
  • PARTLABEL can be set via parted <block device> -name <partlabel>

Is there a way to change the partition label used for mounting without blowing away the existing file system? I want to modify just LABEL for existing partitions that would be either ext4, xfs, or ntfs.

ron
  • 6,575
  • 1
    I don't really get your question as the last two sentences contradict each other. First you ask how to change "partition label", so partlabel. But then you say you want to modify LABEL, which is the label. So which one it is? – Hi-Angel Dec 02 '22 at 13:48

3 Answers3

5

e2label for ext2/ext3/ext4 and ntfslabel for ntfs file system.

man ntfslabel:

  ntfslabel - display/change the label on an ntfs file system

SYNOPSIS

ntfslabel [options] device [new-label]

man e2label:

  e2label - Change the label on an ext2/ext3/ext4 filesystem

SYNOPSIS

e2label device [ volume-label ]

GAD3R
  • 66,769
4

The LABEL is a property of the file-system. You change it with the tool appropriate to the file-system:

tune2fs -L volume-label device
ntfslabel  device new-label
xfs_admin -L label device

The file-system needs to be unmounted.

Hermann
  • 6,148
-1

There is also fatlabel for Fat filesystems. It can be used like

fatlabel /dev/sda1 'NewLabel'

and changes the label for an existing FAT partition.

Rovanion
  • 959
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Toby Speight Nov 12 '23 at 15:21
  • Does it not answer the question of how one changes the /label/ for a filesystem of the type fat? – Rovanion Nov 13 '23 at 12:04
  • True, but the question explicitly stated I want to modify just LABEL for existing partitions that would be either ext4, xfs, or ntfs. If you highlight the difference more prominently and add a usage example on how to apply the tool, your answer may still be useful, though. – AdminBee Nov 17 '23 at 12:55