Rename Drive Labels via Terminal
Change partition labels for ext4, FAT32, NTFS, and other filesystems using command-line tools. Useful for organizing drives and fixing Dropbox sync paths.
What This Guide Achieves
| Goal | Status |
|---|---|
| Identify current partition labels | Done |
| Rename ext4 partitions | Done |
| Rename FAT32/vfat partitions | Done |
| Rename NTFS partitions | Done |
| Verify label changes | Done |
| Understand when labels matter (Dropbox, mount points) | Done |
The Problem (Windows User Perspective)
On Windows, you right-click a drive in File Explorer → Rename. On Linux, partition labels are managed through terminal commands. Labels matter because:
- They appear in your file manager sidebar (e.g., “bigd”, “mmh”)
- They affect auto-mount paths (e.g.,
/media/mohsin/bigd) - Some apps (like Dropbox) use the full path for sync folders — renaming a label changes the path and can break sync
Step 1 — Check Current Labels
lsblk -f
Example output:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
├─nvme0n1p1 vfat FAT32 CC7B-BEEC 479.8M 1% /boot/efi
├─nvme0n1p2 ext4 1.0 cf696143-5dbf-4fd8-9c71-0b108da83d67 93.8G 9% /
├─nvme0n1p3 ext4 1.0 8e32494c-dd42-4b8c-85cf-e75958ea5d30 82.3G 7% /home
├─nvme0n1p4 ext4 1.0 mmh faa88c3a-6e1f-4236-8709-ef21c56d68e9 107.3G 26% /media/mohsin/mmh
└─nvme0n1p5 ext4 1.0 bigd 02df1ded-31df-41c9-8d16-90bd0bce7edc 26G 71% /media/mohsin/bigd
The LABEL column shows the current name. If it’s blank, the partition has no label.
Step 2 — Unmount the Partition
You must unmount a partition before renaming its label.
# Unmount by mount point
sudo umount /media/mohsin/bigd
# Or unmount by device name
sudo umount /dev/nvme0n1p5
Warning: Do not unmount
/(root) or/home— these are active system partitions. Only rename labels on data partitions that are not currently in use.
Verify it’s unmounted:
lsblk -f | grep bigd
# Should show no MOUNTPOINTS
Step 3 — Rename the Label
The command depends on the filesystem type (shown in the FSTYPE column of lsblk -f).
ext4 (Most common on Linux)
sudo e2label /dev/nvme0n1p5 "NewLabel"
Example:
sudo e2label /dev/nvme0n1p5 "Dropbox"
FAT32 / vfat (USB drives, EFI partitions)
sudo fatlabel /dev/sda1 "NewLabel"
If fatlabel is not installed:
sudo apt install mtools
sudo mlabel -i /dev/sda1 ::"NewLabel"
NTFS (Windows-formatted drives)
sudo ntfslabel /dev/sda1 "NewLabel"
If ntfslabel is not installed:
sudo apt install ntfs-3g
exFAT
sudo exfatlabel /dev/sda1 "NewLabel"
If exfatlabel is not installed:
sudo apt install exfatprogs
Step 4 — Verify the Change
lsblk -f | grep NewLabel
Or check by device:
sudo e2label /dev/nvme0n1p5
# Should print: NewLabel
Step 5 — Remount the Partition
# Mount by label (creates /media/mohsin/NewLabel automatically)
udisksctl mount -b /dev/nvme0n1p5
# Or mount manually
sudo mkdir -p /media/mohsin/NewLabel
sudo mount /dev/nvme0n1p5 /media/mohsin/NewLabel
Verify:
lsblk -f | grep NewLabel
# Should show MOUNTPOINTS as /media/mohsin/NewLabel
Complete Example: Rename “bigd” to “Dropbox”
# 1. Check current state
lsblk -f | grep bigd
# 2. Unmount
sudo umount /media/mohsin/bigd
# 3. Rename (ext4)
sudo e2label /dev/nvme0n1p5 "Dropbox"
# 4. Verify
sudo e2label /dev/nvme0n1p5
# Output: Dropbox
# 5. Remount
udisksctl mount -b /dev/nvme0n1p5
# 6. Final check
lsblk -f | grep Dropbox
# Should show: nvme0n1p5 ext4 1.0 Dropbox ... /media/mohsin/Dropbox
Important Notes
Labels affect mount paths
When you rename a partition, the auto-mount path changes:
| Before | After |
|---|---|
/media/mohsin/bigd | /media/mohsin/Dropbox |
If Dropbox (or any app) is synced to the old path, it will show “Can’t sync” or “Folder moved” errors. You must update the app’s settings to point to the new path.
Label length limits
| Filesystem | Max Label Length |
|---|---|
| ext4 | 16 characters |
| FAT32 | 11 characters |
| NTFS | 32 characters (UTF-16) |
| exFAT | 15 characters |
Labels vs UUIDs
- Labels are human-readable names (e.g., “Dropbox”, “Backup”)
- UUIDs are unique identifiers that never change (e.g.,
02df1ded-31df-41c9-8d16-90bd0bce7edc) - For permanent mounting in
/etc/fstab, UUIDs are preferred because labels can be changed or duplicated
To find a partition’s UUID:
lsblk -f | grep Dropbox
# or
sudo blkid /dev/nvme0n1p5
Removing a label
To remove a label entirely (make it blank):
# ext4
sudo e2label /dev/nvme0n1p5 ""
# FAT32
sudo fatlabel /dev/sda1 ""
# NTFS
sudo ntfslabel /dev/sda1 ""
Make Partitions Auto-Mount at Boot
By default, internal partitions that aren’t in /etc/fstab are mounted dynamically by udisks2 — they only activate when you click on them in your file manager after login. This means cloud storage clients (Dropbox, MEGA, rclone) that point to symlinks or mount points on those partitions will break after every restart.
The Fix: Add the partition to /etc/fstab
First, find the partition’s UUID:
sudo blkid /dev/nvme0n1p4
# Output: /dev/nvme0n1p4: LABEL="mmh" UUID="faa88c3a-..." TYPE="ext4"
Add an entry to /etc/fstab:
sudo nano /etc/fstab
Add this line (replace the UUID with yours):
UUID=faa88c3a-6e1f-4236-8709-ef21c56d68e9 /media/mohsin/mmh ext4 defaults,nofail 0 2
| Field | Meaning |
|---|---|
UUID=... | Identifies the partition (use UUID, not /dev/ path — won’t change across reboots) |
/media/mohsin/mmh | Where you want it mounted |
ext4 | Filesystem type |
defaults | Standard mount options (rw, exec, auto) |
nofail | Boot continues even if this partition is missing |
0 | Don’t include in dump backups |
2 | fsck check order (1 for root, 2 for everything else) |
Test without rebooting:
sudo mount -a
ls /media/mohsin/mmh
If you see your files, the partition will mount automatically at every boot.
Why this matters for cloud storage
| Guide | What breaks without fstab |
|---|---|
| Dropbox | Symlink ~/Dropbox → partition path is dangling until partition is clicked in Nemo |
| MEGA | Same — symlink ~/MEGA → partition path is dangling |
| Google Drive (rclone) | FUSE mountpoint on the partition fails with “Transport endpoint is not connected” |
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
umount: target is busy | Files are open on the partition | Close all files/apps using the drive, or use sudo lsof +D /media/mohsin/bigd to find what’s using it |
e2label: command not found | Missing e2fsprogs | sudo apt install e2fsprogs |
fatlabel: command not found | Missing mtools | sudo apt install mtools |
ntfslabel: command not found | Missing ntfs-3g | sudo apt install ntfs-3g |
| Label doesn’t appear in file manager | Icon cache or udisks needs refresh | Run udisksctl monitor or restart your file manager |
| Dropbox shows “Folder moved” after rename | Path changed from /media/mohsin/bigd to /media/mohsin/NewName | Open Dropbox Preferences → Sync → move folder to the new path |
| Cloud storage shows error after restart (Dropbox “Can’t sync”, rclone “Transport endpoint not connected”) | Partition not auto-mounted — udisks2 requires clicking the drive in Nemo | Add the partition to /etc/fstab (see section above) |
Related Guides
- First Boot Checklist — Initial system setup
- Linux Filesystem Hierarchy — Where things go and why
- Dropbox: Custom Install Directory — Set up Dropbox on a specific drive
Discussion