Why is my filesystem being mounted read-only in linux?
- by Tim
I am trying to set up a small linux system based on Gentoo on a VirtualBox machine, as a step towards deploying the same system onto a low-spec Single Board Computer. For some reason, my filesystem is being mounted read-only.
In my /etc/fstab, I have:
/dev/sda1 / ext3 defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
none /dev/shm tmpfs defaults 0 0
However, once booted /proc/mounts shows
rootfs / rootfs rw 0 0
/dev/root / ext3 ro,relatime,errors=continue,barrier=0,data=writeback 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
udev /dev tmpfs rw,nosuid,relatime,size=10240k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0
none /dev/shm tmpfs rw,relatime 0 0
usbfs /proc/bus/usb usbfs rw,nosuid,noexec,relatime,devgid=85,devmode=664 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
(the above may contain errors: there's no practical way to copy and paste)
The partition at /dev/hda1 is clearly being mounted OK, since I can read all the data, but it's not being mounted as described in fstab. How might I go about diagnosing / resolving this?
Edit: I can remount with mount -o remount,rw / and it works as expected, except that /proc/mounts reports /dev/root mounted at / rather than /dev/sda1 as I'd expect.
If I try to remount with mount -a I get
mount: none already mounted or /sys busy
mount: according to mtab, sysfs is already mounted on /sys
Edit 2: I resolved the problem with mount -a (the same error was occuring during startup, it turned out) by changing the sysfs and proc lines to
proc /proc proc [...]
sysfs /sys sysfs [...]
Now mount -a doesn't complain, but it doesn't result in a read-write root partition. mount -o remount / does cause the root partition to be remounted, however.