zfs and portage’s var directories
While /var is usually for non-crucial content, caches[3], pid files, etc, portage has a different idea [1]:
/var/db/pkg Portage stores the state of your system
/var/lib/portage The versions for the applications you have explicitly installed
These directories store the current tree state, there is no way recreating them if they are deleted.[2]
So if you plan to use ZFS with separate / and /var to take a snapshot of /, install some packages and then rollback the snapshot as you changed your mind, your / and /var will be out of sync!
/var/db/pkg and /var/lib/portage has to be on /.
mkdir /usr/var_db_pkg /usr/var_lib_portage cp -r /var/lib/portage /usr/var_lib_portage cp -r /var/db/pkg /usr/var_db_pkg rm -rf /var/lib/portage /var/db/pkg ln -s /usr/var_lib_portage /var/lib/portage ln -s /usr/var_db_pkg /var/db/pkg
[1] https://wiki.gentoo.org/wiki/Directories
[2] Or at least it is painfull. To avoid the initial circular-dependency hell, issue:
emerge --nodeps dev-lang/perl dev-lang/python dev-libs/libxml2 dev-util/cmake dev-util/pkgconfig sys-apps/acl ys-apps/systemd sys-devel/automake sys-libs/glibc sys-libs/ncurses sys-libs/zlib virtual/libudev
[3] what you'd have to recreate: powertop's calibration measurements, gentoolkit's busybox and initramfs
Leave a comment