Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created my own PXE/NFS network boot server on Ubuntu 12.04 as explained here. I can write to files on client side if I change /etc/exports file like this on server side:

/srv/ubuntulivecd/        *(rw,async,no_root_squash,no_subtree_check) 

I want to change files only locally. I mean this shouldn't change the file on NFS partition if I write to the file on local. If i change rw(read-write) option to ro(read-only), I can't change files (as expected) because of permissions. Is there a way to change files locally or temporary(all files have to be removed after reboot or power off) on client side ?

share|improve this question
up vote 0 down vote accepted

In the client, you can copy the files to tmpfs (the same a live-cd boots to). You need to set a union type FS (aufs) between the RO filesystem on NFS and a tmpfs RW filesystem on your local machine.

example for tmps:
$ mount -t tmpfs no_device /tmp

now everything you do on /tmp will work on ramfs

example for union:
$ ls dir1
$ ls dir1/subdir
$ ls dir2
$ ls dir2/subdir
$ mkdir dir_union
$ mount -t aufs -o dirs=dir1=rw:dir2=ro no_device dir_union
$ ls dir_union
$ ls dir_union/subdir
file1 file2

notice the dir1=rw and dir2=ro. now you can $ rm dir_union/subdir/file2 , which should be ro, but in the union you can modify it and you will get no error. In fact only the differencies are mapped. If you do

$ ls -la dir_union
file1 .wh.file2

where .wh.file2 is a file that mappes the differencies.

The same with a CD rom:

$ mount -o ro /dev/cdrom /mnt/cdrom
mount -t tmpfs no_device /mnt/rw
mount -t aufs -o dirs=/mnt/rw=rw:/mnt/cdrom=ro no_device /mnt/union

Here you will see all the original files of the CD-rom in /mnt/union. If you modify them, the differencies are mapped, the files can be changed in /mnt/union, but the original files in /mnt/cdrom stay unchanged.

Now, as exercice, do it for a NFS mount ;)


share|improve this answer

Your Answer


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.