Moving ZFS datasets around eases the transition from CVSup to Subversion
I upgraded some of my virtual machines during my summer holiday. They are all running ZFS, but were neglected for so long that they were still updating their source and ports trees using CVSup. I began pondering how to migrate to Subversion with the least fuzz possible. Luckily, I had anticipated the switch to Subversion, and all my VM’s had a fairly recent version of Subversion already installed.
Here’s the relevant part of the ZFS layout:
zroot/usr/ports zroot/usr/ports/distfiles zroot/usr/ports/packages zroot/usr/ports/workdirs zroot/usr/src
As you can see, I use separate filesystems for the downloaded source code archives, for packages created by myself, and for temporary storage while compiling the ports. (Set WRKDIRPREFIX=/usr/ports/workdirs
in /etc/make.conf
.)
I began by renaming zroot/usr/ports
to zroot/usr/oports
, and zroot/usr/src
to zroot/usr/osrc
:
zfs rename zroot/usr/ports zroot/usr/oports zfs rename zroot/usr/src zroot/usr/osrc
Thus producing this partial hierarchy:
zroot/usr/oports zroot/usr/oports/distfiles zroot/usr/oports/packages zroot/usr/oports/workdirs zroot/usr/osrc
Creating the new filesystems to house the Subversion working copies was simply:
zfs create -o compression=gzip-9 zroot/usr/ports zfs create -o compression=gzip-9 zroot/usr/src
So far, so good:
zroot/usr/oports zroot/usr/oports/distfiles zroot/usr/oports/packages zroot/usr/oports/workdirs zroot/usr/osrc zroot/usr/ports zroot/usr/src
I could then proceed with checking out the working copies of the source and port trees:
svn co svn://svn0.us-west.freebsd.org/base/stable/8 /usr/src svn co svn://svn0.us-west.freebsd.org/ports/head /usr/ports
And now for the magic part:
zfs rename zroot/usr/oports/distfiles zroot/usr/ports/distfiles zfs rename zroot/usr/oports/packages zroot/usr/ports/packages zfs rename zroot/usr/oports/workdirs zroot/usr/ports/workdirs
Thus resulting in this partial ZFS layout:
zroot/usr/oports zroot/usr/osrc zroot/usr/ports zroot/usr/ports/distfiles zroot/usr/ports/packages zroot/usr/ports/workdirs zroot/usr/src
Adequate planning of the ZFS filesystem hierarchy at an earlier stage proved to be essential for this transition. There was no need to spend lots of time moving a large number of files from one filesystem to another. If this were on a UFS based system, you would usually only move a few (sub)directories, similar to the rename operations I performed. The filesystems I moved in the last step naturally preserved their value of off
for the ZFS compression
property.
After having copied my kernel configuration file and my CVS control directories, and properly placed them in their new home, it was time to say goodbye to CVSup:
zfs destroy zroot/usr/oports zfs destroy zroot/usr/osrc zfs destroy zroot/var/db/sup