Make a backup
Before we do anything, it's a good idea to backup your system. So I'm doing it here (using ZFS pools). I'll first make recursive snapshots on
zroot and
storage, so I can rollback if necessary.
# zfs snapshot -r zroot@before_updating20110318
# zfs snapshot -r storage@before_updating20110318
I'm backing up my
storage pool to a HDD in an e-SATA HDD dock. I backup my SSD root mirror
zroot to
storage regularly, so all I need to do is backup what's on
storage.
Insert the HDD, which has had a pool created on it called
backup06, and two filesystems,
backup06/filesystems and
backup06/pools. Turn it on, and the HDD is detected by FreeBSD 8.1.
# zpool import backup06
Now here's where I show off the script in my sig (which I really need to get included into ports, but one thing at a time). To backup everything including snapshots and properties, and force the destination to have 2 copies to guard against bad sectors, and lzjb compression in order to reduce the size, all while allowing restore of the original properties easily, all I do is the following (whether it is the first time, second time, or nth time):
# zxfer -dFkPvb -o copies=2,compression=lzjb -N storage/home backup06/filesystems
# zxfer -dFkPvb -o copies=2 -N storage/distfiles backup06/filesystems
# zxfer -dFkPvb -o copies=2 -N storage/packages backup06/filesystems
# zxfer -dFkPvb -o copies=2,compression=lzjb -R storage/zrootbackup backup06/pools
Note that I could probably just do:
# zxfer -dFkPvb -o copies=2,compression=lzjb -R storage backup06/pools
Not sure why I'm not, to be honest. I will figure that out when I finish my guide to installing, backing up and restoring a FreeBSD root mirror system.
Export the backup pool, and turn the HDD dock off.
# zpool export backup06
Syncing my sources
Before we can build from source, we need to get that source from somewhere. I'll check the
handbook. Note that I'm somewhat following on from dcbdbis's
post as well.
I am going to be using
csup, which is a faster reimplementation of
net/cvsup. We are using it because
- it's efficient in terms of only getting the files we need compared to anonymous CVS
- using email, and PGP to prevent forged CTM deltas seems complicated. I also can't really find anything on it in the forums, googling
Code:
site:forums.freebsd.org ctm
comes up with nothing.
- unlike net/cvsup, there are no dependencies.
- If we use a host mirror, there is no load on FreeBSD core infrastructure.
The only potential downside I can see is that AFAIK using a local mirror means that you trust their checksums, which would have higher probability of being compromised than using the original FreeBSD site. It would be nice to get the checksums from there and fetch the other files locally, not sure if that is possible. Would appreciate any enlightenment about this from someone who knows more than I do.
So, let's follow the cvsup
link (and we'll just use "csup" instead in commands).
We are going to start with the standard supfile, and modify if necessary.
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile_20110318
Now edit
/root/supfile_20110318.
Lines changed:
Code:
*default release=cvs tag=RELENG_8_2
*default host={local [url=http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html#CVSUP-MIRRORS]mirror[/URL]}
Now we run csup. No need to specify -g as csup doesn't appear to have a gui.
# csup /root/supfile_20110318
It took about 10 minutes or so to complete. Do it again, just for kicks, and you'll find that it should take about 5 seconds, if that. So we are finished syncing source. Now it's time to "
rebuild".