Fix Read-Only USB and Delete Files (Linux)
1 min read
Problem
Trying to delete files from a USB drive results in:
rm: cannot remove '<file>': Read-only file system
Root Cause
This is NOT a file permission issue.
The filesystem (USB) was mounted as read-only (ro) due to:
- Filesystem corruption
- Unsafe removal
- I/O errors
Step 1 — Confirm Read-Only Mount
mount | grep KINGSTON
If you see:
(ro, ...)
→ The filesystem is read-only.
Step 2 — Exit the Mounted Directory
cd /
Step 3 — Check Processes Using the Mount
lsof | grep KINGSTON
If needed:
fuser -km /media/enkiel/KINGSTON
Step 4 — Unmount the USB
sudo umount /dev/sdb1
If it fails:
sudo umount -l /dev/sdb1
Step 5 — Repair Filesystem
sudo fsck.vfat -a /dev/sdb1
If needed:
sudo fsck.vfat -r /dev/sdb1
Step 6 — Remount
udisksctl mount -b /dev/sdb1
Verify:
mount | grep KINGSTON
Expected:
(rw, ...)
Step 7 — Delete Files
Single file:
rm /media/enkiel/KINGSTON/DCIM/Camera/<filename>
Delete ALL contents (recommended):
find /media/enkiel/KINGSTON/DCIM/Camera -mindepth 1 -delete
Alternative:
rm -rf /media/enkiel/KINGSTON/DCIM/Camera/*
Step 8 — Verify Disk Usage
df -h /media/enkiel/KINGSTON
Optional — Check Logs
sudo dmesg | tail -50
Final Advice
If this repeats:
- Backup immediately
- Reformat:
sudo mkfs.vfat /dev/sdb1 - Replace the USB if errors persist