remounting FS with read write rights

5,960

The block device is read-only. You can't mount a filesystem read-write on a read-only device.

You can make the block device read-write by running blockdev --setrw /dev/sda1. This won't work on devices that are intrinsically read-only because the driver has no write support (e.g. CD-ROM drive) but it should work for a device that appears as a hard disk like /dev/sda.

Note that the readonliness of the block device has nothing to do with the permissions of the file /dev/sda1. That file is a way through which the device is accessed, and there can be multiple files pointing to the same device with different ownership and permissions. The read-only attribute that matters here is the one at the kernel level, applying to the device itself.

Beware that there may well be a good reason for the block device to be read-only. For example, it's possible that the kernel detected a write error and made the device read-only to prevent further corruption. Review your kernel logs carefully for any error concerning /dev/sda.

Share:
5,960

Related videos on Youtube

4m1nh4j1
Author by

4m1nh4j1

This is not a bio.

Updated on September 18, 2022

Comments

  • 4m1nh4j1
    4m1nh4j1 over 1 year

    Looking for the read only file system:

    grep "\sro[\s,]" /proc/mounts
    /dev/disk/by-uuid/2c04d594-b11d-4b02-b1b3-3d9f0b66b73c / ext3 ro,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
    

    So the / is set to ro, I am trying to remount it with rw, but I had the following error:

    mount -o rw,remount /
    mount: cannot remount block device /dev/sda1 read-write, is write-protected
    

    This is demsg output:

    [34061773.342769] EXT3-fs (sda1): error: ext3_remount: Abort forced by user
    [34061833.727155] EXT3-fs (sda1): error: ext3_remount: Abort forced by user
    [34061857.687599] EXT3-fs (sda1): error: ext3_remount: Abort forced by user
    [34062099.291484] EXT3-fs (sda1): error: ext3_remount: Abort forced by user
    [34062503.763273] EXT3-fs (sda1): error: ext3_remount: Abort forced by use
    

    Any ideas ?

    • Jesse K
      Jesse K over 8 years
      Is it safe to assume you're using a standard hard drive? If so, I'd start with two things. - Check the logs for any prior write errors which may have caused it to go ro - Check the device for any r/w lock, they're rare, but some devices do have them
    • 4m1nh4j1
      4m1nh4j1 over 8 years
      I just made a full fsck, so I don't think I still have errors.
    • Jesse K
      Jesse K over 8 years
      If there's a hardware issue, fsck will not fix it, though it might be able to relocate bad blocks. Did you get any output after running the fsck?