Boot Read Only Debian With Some Exceptions

0

I have an embedded system booting Debian off from a CF card. To minimize the potential for unrecoverable corruption when non-graceful shutdowns occur, I can boot the filesystem readonly by configuring it in fstab. However, there are a handful of directories that I would like to keep read/ write. How do I keep most of my filesystem readonly with a few exceptions?

For example /dev/hda1 mounted at / is my CF card which is readonly. I have a directory, /root (within /) in which I want to be read/write.

kittyhawk

Posted 2012-07-30T21:16:48.187

Reputation: 201

Answers

0

You cannot mount a filesystem "partially read-write," that makes no sense. You will have to move the directories you want to keep writable to...

  • Separate individual volumes, and mount them separately, or
  • One separate volume, mount it, and then mount --bind the directories where they belong.

cdhowie

Posted 2012-07-30T21:16:48.187

Reputation: 368

You can do "partially write" with a union overlay of some sort – Flexo – 2012-07-30T21:23:44.487

Yes, but I have yet to find a decent, stable, and widely-supported union filesystem (which is a real shame) and therefore I don't feel comfortable recommending one. – cdhowie – 2012-07-30T21:26:00.043

That's fine for directories where I want everything to be read-write. However, the issue is that I might want to let the user make edits to /etc/network/interfaces but nothing else in /etc. How do I pull this off? – None – 2012-07-30T21:26:44.830

@kittyhawk By setting an appropriate permissions mask, presumably. You can also use chattr +i on individual files to make them read-only, even to root. Of course, root can chattr -i at any time to remove the flag. – cdhowie – 2012-07-30T21:28:02.820

0

take a look at Voyage Linux, it's a Debian distribution specially made to run on embedded devices. On /etc/default/voyage-util you can configure which directories are mounted rw (on RAM) and Voyage syncs them to CF on reboot

http://linux.voyage.hk/

Lluís

Posted 2012-07-30T21:16:48.187

Reputation: 113