How to use the command 'mlabel' (with examples)
- Linux
- December 25, 2023
The mlabel
command is used to set an MS-DOS volume label for FAT and VFAT filesystems. It allows you to assign a name to a filesystem for easy identification. This command is particularly useful when working with external storage devices such as USB drives or memory cards.
Use case 1: Set a filesystem label
Code:
mlabel -i /dev/sda ::"new_label"
Motivation: Setting a filesystem label is useful when you want to identify a specific drive or partition. By assigning a label, you can easily differentiate between multiple storage devices connected to your system.
Explanation:
mlabel
: This is the command itself.-i /dev/sda
: Specifies the device on which the filesystem label should be set.::"new_label"
: The new label to assign to the filesystem. The::
indicates that the label is for the root directory of the filesystem.
Example output:
Volume label for /dev/sda successfully set to "new_label".
Conclusion:
The mlabel
command provides a straightforward way to set a filesystem label, making it easier to identify specific drives or partitions.