fatlabel - Linux


Overview

fatlabel is a command-line utility used to manage volume labels for FAT file systems. It allows you to view, edit, and create volume labels, ensuring proper identification and organization of storage devices.

Syntax

fatlabel [options] /dev/device-node [new_volume_label]

Options/Flags

  • -v, –verbose: Enable verbose output, providing detailed information about the labeling process.
  • -n, –no-label: Remove the current volume label from the specified device.
  • -h, –help: Display a brief help message and exit.

Examples

View the current volume label:

fatlabel /dev/sdb

Change the volume label to "My USB":

fatlabel /dev/sdb My\ USB

Remove the volume label:

fatlabel -n /dev/sdb

Common Issues

  • Device not recognized: Ensure that the specified device node is correct and accessible.
  • Unsupported file system: fatlabel only works with FAT file systems. If your device uses a different file system, it cannot be labeled.

Integration

Combine with lsblk to identify devices:

sudo lsblk | grep 'part' | awk '{print "/dev/" $1}' | xargs -I{} sudo fatlabel {} "My_New_Label"

Related Commands

  • fdisk: Manage partition tables and disk partitions.
  • mkfs: Create file systems on storage devices.
  • e2label: Manage volume labels for ext2, ext3, and ext4 file systems.