Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

migrated from stackoverflow.com Jul 31 '12 at 14:32

This question came from our site for professional and enthusiast programmers.

2 Answers

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.
share|improve this answer
    
You can do "partially write" with a union overlay of some sort –  Flexo Jul 30 '12 at 21:23
    
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 Jul 30 '12 at 21:26
    
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? –  kittyhawk Jul 30 '12 at 21:26
    
@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 Jul 30 '12 at 21:28
add comment

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/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.