read-only root fs with Busybox?

Rob Landley rob at
Mon Dec 12 08:06:45 UTC 2005

On Monday 12 December 2005 00:38, Stephane Billiart wrote:
> On 08/12/05 ? ? 18:07, Jessee, Mark wrote:
> > Hi,
> >
> > I'm attempting to setup a read-only root filesystem on a Compact Flash
> > card.
> [...]
> That's also what I have been doing for quite some time now.

My firmware linux thing has a read-only root filesystem that's on squashfs, 
although flash isn't currently involved (but could be).

> > Do I need to add an entry in /etc/fstab for '/' to allow the mount
> > command to work properly? Does this work alongside the GRUB parameters?
> > Or does adding an entry for '/' in /etc/fstab with the 'ro' option mean I
> > no longer need to pass 'ro' in GRUB?
> >
> > Why does 'cat /proc/mounts' give 2 entries for '/' with 'rootfs' being
> > 'rw'?

In the 2.6.15 kernel, read 
"Documentation/filesystems/ramfs-rootfs-initramfs.txt".  rootfs is always 
mounted at /, but it's generally an empty ramfs that gets the real root 
mounted over it, and is thus inaccessable.  (You can probably do a mount -o 
remount,ro on it.)

> Personnally, I use LILO and my /etc/fstab has no entry for '/'.

Considering / has to be mounted before fstab can be found (modulo being on 
initramfs), it's a bit redundant to list root in there.  Maybe as 
documentation, but it can never be _useful_.  By the time you've got it, it's 
too late.

> Like you, I have a rootfs partition which is mounted rw, I don't have
> an explanation for this but I don't think it is an issue.

rootfs is always present in 2.6 kernels.  (Among other things, it's the 
starting and ending point for searches of the circular doubly linked list of 
kernel mount points.)  It's sort of the "idle task" of filesystems, as it 

> sokdist# cat /etc/fstab
> proc    /proc           proc    defaults 0 0
> devpts  /dev/pts        devpts  defaults 0 0
> sokdist# cat /proc/mounts
> rootfs / rootfs rw 0 0
> /dev/root / ext2 ro,nogrpid 0 0
> none /proc proc rw,nodiratime 0 0
> none /sys sysfs rw 0 0
> none /var tmpfs rw,noexec 0 0
> none /dev/pts devpts rw 0 0
> usbfs /proc/bus/usb usbfs rw 0 0

No /dev/shm?

> > Any tips on the correct configuration for a read-only root fs with
> > support for remounting read-write?
> Here is what I use to remount rw/ro at will
> mount -o remount,rw,noatime -n /dev/root /
> mount -o remount,ro -n /dev/root /

I'm fixing mount so that "mount -o remount,ro /" will actually work without 
having to specify /dev/root again, by the way...

Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.

More information about the busybox mailing list