mlabel
Create or change an MS-DOS filesystem label
TLDR
Set a filesystem label
SYNOPSIS
mlabel [-V] [-s] [-c] [-N serial_number] drive: [new_label]
PARAMETERS
-V
Displays the version information for the mlabel command.
-s
Shows the current volume label of the specified drive. This option is mutually exclusive with setting or clearing a label.
-c
Clears the current volume label, effectively removing it and leaving the volume without a label. This option is mutually exclusive with setting a new label.
-N serial_number
Sets the volume serial number. This is an 8-character hexadecimal number that uniquely identifies the volume. If not specified, a default or existing serial number is kept.
drive:
The MS-DOS drive specifier (e.g., a:, c:) that you wish to label or query. This parameter is mandatory for any operation other than displaying the version.
[new_label]
The desired new volume label for the specified drive. It can be up to 11 characters long. If this argument is omitted, mlabel will display the current label instead of setting a new one. Characters are automatically converted to uppercase, and invalid characters are stripped.
DESCRIPTION
mlabel is a command-line utility used to manage volume labels for MS-DOS filesystems, such as FAT partitions or traditional floppy disks. It is an essential component of the mtools software suite, which enables Linux and other Unix-like operating systems to interact with DOS media without requiring a kernel-level mount.
When invoked with a drive specifier (e.g., a:) and a new_label, mlabel sets or changes the volume label of the specified drive. If the new_label argument is omitted, the command will display the current volume label of the drive. The volume label is limited to 11 characters and is automatically converted to uppercase by mlabel. The utility relies on the mtools configuration files to map drive letters to their corresponding physical devices.
CAVEATS
mlabel is designed exclusively for use with MS-DOS (FAT12, FAT16, FAT32) filesystems. It will not work with native Linux filesystems like ext4, XFS, or Btrfs.
The command's functionality is dependent on the proper configuration of mtools, which defines the mapping between MS-DOS drive letters (e.g., a:) and actual Linux device files (e.g., /dev/fd0, /dev/sda1). These mappings are typically found in /etc/mtools.conf or ~/.mtoolsrc.
Volume labels are limited to 11 characters. mlabel automatically converts labels to uppercase and strips characters that are not valid in MS-DOS volume labels.
HISTORY
mlabel is an integral part of the mtools software suite, which was developed to facilitate seamless interaction between Unix-like operating systems (such as Linux) and MS-DOS filesystems. Its inception dates back to the early days of personal computing, when MS-DOS was prevalent and direct access to DOS-formatted media (like floppy disks) was often necessary for data exchange.
The primary motivation behind mtools, and consequently mlabel, was to allow users to manipulate MS-DOS files and directories without needing to mount the entire filesystem through the kernel. This provided a lightweight and convenient way to manage DOS media directly from the command line, establishing mlabel as a stable and consistent utility within the mtools package for decades.