When dealing with EXT3 filesystems, the "Read-only file system" error during file deletion typically indicates one of these scenarios:
1. Filesystem errors forcing remount as read-only
2. Physical write protection (like USB lock switches)
3. Permission issues masked as read-only errors
4. Mount options overriding device capabilities
Before attempting fixes, always verify the actual mount status:
# Check /proc/mounts for real status
cat /proc/mounts | grep sdb1
# Verify block device state
hdparm -r /dev/sdb1
# Check filesystem errors
dmesg | grep EXT3
Method 1: Forced Remount
When the filesystem is clean but erroneously mounted read-only:
mount -o remount,rw /dev/sdb1 /media/usbdisk
# If that fails with "write-protected" error:
mount -o remount,rw,force /dev/sdb1
Method 2: Filesystem Repair
For filesystem errors triggering protective read-only mode:
umount /dev/sdb1
fsck.ext3 -p /dev/sdb1
mount -w /dev/sdb1 /media/usbdisk
When standard fixes fail, consider these approaches:
# Check for hardware write protection
hdparm -r0 /dev/sdb1
# Alternative deletion method using debugfs
debugfs -w /dev/sdb1
debugfs: rm /path/to/file
debugfs: quit
- Always properly unmount USB drives
- Regularly check filesystem integrity
- Consider using EXT4 for better error recovery
- Implement proper backup solutions
When attempting to delete files on a Linux system, you might encounter the frustrating "Read-only file system" error even when your mount
command shows the filesystem as mounted with read-write (rw) permissions. This discrepancy between reported and actual permissions often indicates deeper filesystem issues.
The first step is to verify the actual mount status beyond what mount
shows:
cat /proc/mounts | grep sdb1
# Sample output showing the real status:
# /dev/sdb1 /media/usbdisk ext3 ro,relatime,data=ordered 0 0
The issue typically occurs when:
- The filesystem encountered errors and remounted itself as read-only
- Physical media problems exist (bad sectors on HDD, failing flash cells on SSD/USB)
- The filesystem wasn't properly unmounted previously
- Hardware write-protection is enabled
Try remounting the filesystem with write permissions:
mount -o remount,rw /media/usbdisk
# For specific device:
mount -o remount,rw /dev/sdb1
If you receive errors about write protection:
hdparm -r0 /dev/sdb1 # Disable read-only flag for disks
When remounting fails, filesystem repair is necessary:
umount /dev/sdb1
fsck -y /dev/sdb1
mount /dev/sdb1 /media/usbdisk
If the filesystem remains read-only but you need to delete files:
# Method 1: Use dd to zero out files
dd if=/dev/zero of=/media/usbdisk/problem-file bs=1M count=1
# Method 2: Change permissions first (if possible)
chattr -i /media/usbdisk/problem-file
rm -f /media/usbdisk/problem-file
To avoid this issue:
- Always properly unmount devices (
umount
or eject) - Regularly check filesystem health (
smartctl
for HDDs) - Consider using more robust filesystems like ext4 or btrfs
- Implement proper backup strategies
For physically write-protected media (like SD cards with lock switches):
# Check if hardware write protection is enabled
hdparm -r /dev/sdb1
# Output should show "readonly = 0" for writable