LinuxCommandLibrary

fatlabel

Change the label on a FAT filesystem

TLDR

Get the label of a FAT32 partition

$ fatlabel [/dev/sda1]
copy

Set the label of a FAT32 partition
$ fatlabel [/dev/sdc3] "[new_label]"
copy

SYNOPSIS

fatlabel device [new-label]

PARAMETERS

device
    The path to the block device (e.g., /dev/sdb1) containing the FAT filesystem whose label is to be read or modified.

new-label
    An optional string specifying the new volume label for the FAT filesystem. If omitted, the current label is displayed.

DESCRIPTION

fatlabel is a utility from the dosfstools package used to query or modify the volume label of FAT (FAT12, FAT16, FAT32) filesystems. When invoked with only a device argument, it displays the current volume label. If an additional argument (the desired new label) is provided, it attempts to set the filesystem's label to that value.

The label can be up to 11 characters long and is case-insensitive. This command is particularly useful for identifying USB drives, SD cards, or other removable media formatted with a FAT filesystem. It operates directly on the block device and requires appropriate permissions, typically root, to write a new label.

CAVEATS

  • Requires root privileges to modify the label.
  • Labels are limited to 11 characters and are case-insensitive.
  • Only works with FAT (FAT12, FAT16, FAT32) filesystems. Using it on other filesystem types (e.g., ext4, NTFS) will result in an error.
  • Ensure the device is not mounted or used by other processes when modifying the label to prevent data corruption, though reading is generally safe.

LABEL CHARACTERS

FAT volume labels typically consist of uppercase letters, numbers, and some special characters. Lowercase letters entered will often be converted to uppercase by the filesystem. Invalid characters may be rejected or converted.

HISTORY

fatlabel is part of the dosfstools project, a collection of utilities for creating, checking, and maintaining FAT filesystems on Linux and other Unix-like systems. The project originated to provide robust tools for interoperability with DOS/Windows filesystems, which were prevalent on removable media. fatlabel specifically addresses the need to manage the volume label, a common attribute for identifying disk partitions in the FAT ecosystem. Its functionality has been stable for a long time, evolving with FAT standards (FAT12, FAT16, FAT32) without significant changes to its core interface.

SEE ALSO

mkfs.fat(8), fsck.fat(8), dosfslabel(8), mtools(1)

Copied to clipboard