Is it possible to mount a loopback file as read-only, and redirect all writes to RAM?
|
It is possible using a union filesystem layer like aufs. Demo: Create a filesystem image
Mount it, populate it
Mount it read-only
A small RAM filesystem
Combine both
That mount option to create a new "branch" ( (See the aufs(5) man page for all the details.) Now all that's done, here's what you have:
So the writes "stop" in the You could have used a plain directory (on a read/write filesystem), or possibly a directory under This technique (or variations thereof) is used by some distribution LiveCD. The Wikipedia aufs entry lists a few. |
|||||||
|
I finally figured out how to do this with the root filesystem (in Ubuntu 11.04)!The steps for making a system bootable are simple. I used this guide in combination with this guide and a bunch of web searches to figure out how to get it working properly, without bugs. Summary:
If everything went well, when you reboot, you will be doing so into a temporary file system. The RAM part will be at Nevertheless, if you have booted into a temporary system but need to make a permanent change, you can re-mount the
to make it writable, and then you can make whatever modifications needed to that directory. |
||||
|
|
|
Yes, by unionfs, see unionfs.filesystems.org. You have mount first read-only filesystem, and as second read-write RAM filesystem through unionfs. In Ubuntu you can find the unionfs-fuse package, which is another implementation of the same things, but in user space, not as a kernel module. |
||||
|
|
