Temporary Ramfossils


The relationship between venti and fossil enables unique workflows. One of the most useful is making a ramdisk copy of a fossil filesystem and entering a namespace rooted into it. ANTS provides helper scripts for this. To begin, you need to know the rootscore you want to work with. You can find your most recent rootscore with a command like:

ns% fossil/last /dev/sdF0/fossil

If you want to make sure that your are working with an absolutely current copy, create a new archival snapshot in the fscons:

ns% con /srv/fscons
prompt: fsys main snap -a
prompt: archive vac:9d47bc23a178c36a96c4c1980ab3a2a7b210c6ad
prompt: >>> q

Once you have selected a rootscore, use the ramfossil command to create a ramdisk with a 100mb buffer for the fossil and initialize it to that rootscore:

ns% ramfossil 9d47bc23a178c36a96c4c1980ab3a2a7b210c6ad

You should see output like this:

200000+0 records in
200000+0 records out
fsys: dialing venti at tcp!127.1!17034

Now you can use the rerootwin -f command to root into that fossil, and then re-create a standard namespace environment inside it:

ns% rerootwin -f ramfossil
ns% service=con
ns% . $home/lib/profile
cpu% grio -s

This sequence performs a chroot-style operation with rerootwin, then runs your profile to reacquire the standard binds it contains, and then starts grio to provide you with a workspace. Within this subrio, you have a copy of your full root and a normal environment, but changes you make will only affect the temporary ramdisk fossil. You can write/change up to 100mb of data before the ramdisk fossil cache fills up.

The ramfossil has a standard control console at /srv/ramfscons. If you wish to save changes you make inside the ramrooted environment, you can issue an fsys main snap -a command and then preserve the generated rootscore. This will not affect your original root filesystem.

Sometimes, it is useful to test changes in the ramfossil, and then make your main fs a copy of the saved ramfs changes. You can do this by saving the rootscore of the ramfs to a file in 9fat, entering the ants boot/admin namespace, halting the main disk fossil, using flfmt -v with the saved rootscore to reset the main fossil to be identical to the ramfossil, then rebooting. Use caution with an operation like this.


Something that is not very well publicized is that you can move files around in /srv without breaking the connections of programs using them. If you wish to run multiple simultaneous ramfossils in this manner, you can use either ants rfork V to give you a clean /srv space, or you can move the existing /srv files to a different location.

ns% cd /srv
ns% mv ramdisk oldramdisk
ns% mv ramfossil oldramfossil
ns% mv ramfscons oldramfscons

This does not disrupt the environment rooted into the ramfossil. Now you could start another ramfossil without namespace collisions. You may also wish to do things change the size of the file created for fossil by the dd command in the ramfossil script or adjust the names that are created.