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 was thinking about how to keep write access to my Raspberry Pi's root file system (residing on a SD card) at a minimum. Of course, /var is a primary candidate for being kept somewhere else.

I have a NAS storage in my home network. In order to get proper handling of file ownership, permissions etc. I was thinking about mounting an image file (located on the NAS), via the loopback device, to /var.

1) Can I do this by just adding the appropriate lines to /etc/fstab and be done with it, or is /var needed too early in the boot process for this to work out? What should I be aware of?

2) Am I thinking too complicated and is there a much easier way to achieve this? (NFS mounting is another option, but I haven't activated this one on the NAS yet as, to be honest, the NFS admin interface on the NAS sucks - and I have no idea if this would actually change anything.)

Any thoughts would be appreciated: Can I mount system directories like /var from the network, and what would I have to take care of?

share|improve this question
add comment

2 Answers 2

You may want to have a look at this:

https://wiki.archlinux.org/index.php/Using_tmpfs_for_/var/*

Some extract:

Using tmpfs for high read/write activitiy folders like /var/{log,tmp,etc,etc} can be considered useful for both increasing performance or life span of storage devices. This can be done with altering /etc/fstab, in this case you will lose those files on next reboot, but a number of the /var/ directory content want to be kept for most usages like /var/log , /var/tmp eg.

This can be achieved with daemon scripts.

share|improve this answer
    
As memory on the device is already rather cramped (especially as I am running a media server and a filtering firewall on it), putting /var on tmpfs isn't really a solution I would favor. Nice hint, though. –  DevSolar Jul 27 '12 at 16:05
add comment
up vote 0 down vote accepted

There is a blog entry on how to put the entire root filesystem on NFS, and boot the Raspberry from there:

http://var-blog-messages.blogspot.co.uk/2012/05/set-up-your-raspberry-pi-like-pro.html

The generic documentation on how to boot your root file system via NFS is here:

http://www.tldp.org/HOWTO/NFS-Root.html

Will give it a try and write a quick summary if successful.

Edit: Nothing much to summarize. Works like a charm.

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.