How to Fix “Read Only Filesystem” Error When Using chown to Change Folder Ownership on Secondary Drive


2 views

When attempting to change ownership of folders on secondary storage devices using chown, many Linux users encounter the frustrating "Read Only filesystem" error. This typically occurs when:

  • The filesystem is mounted as read-only
  • Disk errors forced a read-only remount
  • Permission issues prevent write operations
  • The drive wasn't properly unmounted previously

Here's how to properly change ownership while avoiding the read-only error:

# First check current mount status
mount | grep /dev/sdX

# If mounted read-only, remount with write permissions
sudo mount -o remount,rw /mount/point

# Now perform the ownership change
sudo chown -R username:groupname /path/to/folder

# Verify the changes
ls -ld /path/to/folder

Case 1: Filesystem Errors

If the drive has errors, Linux may mount it as read-only:

# Check for filesystem errors
sudo fsck /dev/sdX

# Repair if needed (unmount first)
sudo umount /dev/sdX
sudo fsck -y /dev/sdX

Case 2: Improper NTFS Permissions

For NTFS-formatted drives:

# Mount with proper permissions
sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0022 /dev/sdX /mount/point

# Then change ownership
sudo chown -R $USER:$USER /mount/point/folder

Add to /etc/fstab for automatic proper mounting:

/dev/sdX /mount/point ntfs defaults,uid=1000,gid=1000,dmask=027,fmask=137 0 0
  • Always check dmesg after mount errors
  • Verify disk health with smartctl -a /dev/sdX
  • For external drives, ensure proper power supply
  • Consider filesystem conversion if errors persist

When attempting to modify ownership permissions on secondary storage devices using chown, many Linux/Unix users encounter the "Read Only filesystem" error. This occurs because:

  • The filesystem might be mounted with read-only permissions
  • The drive could have filesystem errors forcing read-only mode
  • SELinux or other security modules might be restricting changes
  • The filesystem might not support Unix-style ownership (common with FAT/NTFS)

First, check the current mount status:

mount | grep "/dev/sdX"

If you see ro (read-only) in the output, you'll need to remount the drive:

sudo mount -o remount,rw /mount/point

For NTFS/FAT32 drives (common in dual-boot scenarios):

# Install ntfs-3g if needed
sudo apt install ntfs-3g

# Remount with proper permissions
sudo umount /dev/sdX1
sudo mount -t ntfs-3g -o uid=1000,gid=1000 /dev/sdX1 /mount/point

When dealing with ACLs or special permission cases:

# Check current ACLs
getfacl /path/to/folder

# Set recursive ownership with ACL preservation
sudo chown -R username:groupname /path/to/folder
sudo find /path/to/folder -type d -exec chmod 755 {} \;
sudo find /path/to/folder -type f -exec chmod 644 {} \;

If problems persist after remounting:

  1. Run filesystem checks: sudo fsck /dev/sdX1
  2. Check dmesg for errors: dmesg | grep sdX
  3. Verify disk health: sudo smartctl -a /dev/sdX

Here's a complete workflow for an external USB drive:

# Identify the device
lsblk

# Unmount if mounted
sudo umount /dev/sdb1

# Check filesystem
sudo fsck /dev/sdb1

# Mount with write permissions
sudo mount -o rw,uid=1000 /dev/sdb1 /media/external

# Change ownership recursively
sudo chown -R admin:admin /media/external/project_folder