Relocate folders to tmpfs

Suppose you want to relocate /var/lib/mylib/ to tmpfs for saving flash life because of heavy writing, you will edit /etc/default/voyage-util, and set:

VOYAGE_SYNC_DIRS="var/lib/mylib"

Reboot after done.

During boot, this setting will be pick up by /etc/rcS.d/S36voyage-sync, which will:

  1. create var/lib/mylib under the root of tmpfs (/lib/init/rw)
  2. copy current content of /var/lib/mylib to /lib/init/rw/var/lib/mylib
  3. use mount –bind to redirect access of /var/lib/mylib to /lib/init/rw/var/lib/mylib

During shutdown, it will:

  1. create a temp folder /.sync/var/lib/mylib
  2. rsync all content in tmpfs to the temp folder
  3. umount the tmpfs, making /var/lib/mylib normal
  4. rsync all content from /.sync/var/lib/mylib back to /var/lib/mylib
voyage/relocate_folders_to_tmpfs.txt · Last modified: 2010-06-10 14:13 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0