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 [label] [-c ]

PARAMETERS


    The device name representing the FAT filesystem (e.g., /dev/sda1).

[label]
    The new volume label to set. If omitted, the current label is displayed.

-c
    Specify the codepage. Useful if the device has a nonstandard codepage.

DESCRIPTION

The `fatlabel` command allows you to display or modify the volume label of a FAT12, FAT16, or FAT32 filesystem. It is particularly useful for removable media like USB drives and memory cards, where labels can aid in identification and organization. Without any parameters, `fatlabel` displays the current volume label. If a new label is provided as an argument, `fatlabel` will attempt to set the label on the specified device. The filesystem needs to be unmounted for modification to be successful. Note that label length is limited, and invalid characters are usually rejected, but behavior can vary slightly depending on the specific FAT implementation. Using the `-c` option allows to specify device code page.

CAVEATS

The filesystem must be unmounted before attempting to change the volume label. Failure to unmount will typically result in an error or data corruption. The maximum label length is limited to 11 characters. Invalid characters in the label name may be silently stripped or rejected.

EXAMPLES

Displaying the current label:
fatlabel /dev/sdb1

Setting a new label:
fatlabel /dev/sdb1 MyUSBDrive
Make sure /dev/sdb1 is unmounted

RETURN CODES

A return code of 0 typically indicates success. Non-zero return codes signal an error, such as the device not being found, the filesystem being mounted, invalid parameters, or insufficient permissions.

HISTORY

The `fatlabel` command is part of the `dosfstools` package, which provides utilities for creating, checking, and manipulating FAT filesystems. It has been around for quite a long time, and its main goal is to simplify the management of FAT filesystems.

SEE ALSO

mkfs.fat(8), mount(8), umount(8)

Copied to clipboard