The most reliable way to backup a freebsd system is using dump. Unfortunately is not the best for incremental backups, I use rsync for that. In this article I will describe the steps I have taken to backup my system. Please let me know if this helped you by emailing me at comments@vermatech.com
Dump backup and restore ======================= Backup ------ Complete backup consists of / /var /usr The rest of the system will be restored from a snapshot. #note: before you do the dump make sure your fstab is minimal. dump -0 -L -f - / | gzip > /export/a/root-level0-dump.gz dump -0 -L -f - /usr | gzip > /export/a/usr-level0-dump.gz dump -0 -L -f - /var | gzip > /export/a/var-level0-dump.gz
What you need to do is remove the old hard disk, install the new drive as an ide master and perform a minimal clean install of FreeBSD, setting up the partitions exactly how you want them. Be se sure to set the drive as bootable and boot from it one time as a test. You will need the dump files to restore the system. Boot with the fixit disk and create and mount the following. mkdir /target mkdir /target/root mkdir /target/var mkdir /target/usr [check your mappings] mount /dev/adxs1x /target/root mount /dev/adxs1x /target/var mount /dev/adxs1x /target/usr mkdir /backup mount [the backup drive ex. ad1s1d ] /export/backup #verify that the right fiels sytems are mounted by doing a ls #unmount and format umount /target/root umount /target/var umount /target/usr newfs /dev/adxs1x ... #mount again and restore mount /dev/adxs1x /target/root mount /dev/adxs1x /target/var mount /dev/adxs1x /target/usr #restore uses a little space in /tmp, which is located in the ramdisk when you boot with a floppy, and that gets filled pretty early. Do this to fix the problem. rm /tmp mkdir /backup/tmp ln -s /backup/tmp /tmp #Do the actual restore ( gunzip -c /backup/root-level0-dump.gz ) | ( cd /target/root ; restore -rf - ) ( gunzip -c /backup/usr-level0-dump.gz ) | ( cd /target/usr ; restore -rf - ) ( gunzip -c /backup/var-level0-dump.gz ) | ( cd /target/var ; restore -rf - ) umount /target/root umount /target/var umount /target/usr [check your mappings] tunefs -n enable /dev/adxs1x tunefs -n enable /dev/adxs1x tunefs -n enable /dev/adxs1x #reboot the system and see if its ok, Then resume with the snapshot restore.
rSnapshot backup and restore
============================
Backup
------
cd /usr/ports/sysutils/rsnapshot
make install
cp /usr/local/etc/rsnapshot.conf.default /usr/local/etc/rsnapshot.conf
# modify the configuration file to taste.
vi /usr/local/etc/rsnapshot.conf
#set the destination
backup /etc/ localhost/
backup /boot/ localhost/
backup /compat/ localhost/
backup /lib/ localhost/
backup /libexec/ localhost/
backup /root/ localhost/
backup /sbin/ localhost/
backup /service/ localhost/
backup /sys/ localhost/
backup /var/ localhost/
backup /usr/X11R6/ localhost/
backup /usr/bin/ localhost/
backup /usr/compat/ localhost/
backup /usr/games/ localhost/
backup /usr/home/ localhost/
backup /usr/include/ localhost/
backup /usr/lib/ localhost/
backup /usr/libdata/ localhost/
backup /usr/libexec/ localhost/
backup /usr/local/ localhost/
backup /usr/obj/ localhost/
backup /usr/sbin/ localhost/
backup /usr/share/ localhost/
backup /usr/sup/ localhost/
#configure all your remote backup directories currently these dont work
backup Neeraj Verma@192.168.0.11:/cygdrive/c/Documents\ and\ Settings/Neeraj\ Verma/My\ Documents/My\ Backup neeraj/
backup Neeraj Verma@192.168.0.11:/cygdrive/c/Documents\ and\ Settings/Neeraj\ Verma/My\ Documents/My\ Music neeraj/
backup Neeraj Verma@192.168.0.11:/cygdrive/c/Documents\ and\ Settings/Neeraj\ Verma/My\ Documents/My\ Pictures neeraj/
backup Neeraj Verma@192.168.0.11:/cygdrive/c/tomcat5 neeraj/
backup Neeraj Verma@192.168.0.11:/cygdrive/c/j2sdk1.4.2_08 neeraj/
#windows sometime caused errors. Ignore them with the following.
rsync_long_args --ignore-errors
# make sure you have all your remote machines setup to accept public key ssh connections.
#make sure you have cmd_ssh uncommented or else you will get:
ERROR: backup Neeraj Verma@192.168.0.11:/cygdrive/c/work/ neeraj/ - Cannot \
handle Neeraj Verma@192.168.0.11:/cygdrive/c/work/, cmd_ssh \
not defined in /usr/local/etc/rsnapshot.conf
#schedule the jobs to run every 4 hours.
vi /etc/crontab
# Backup the file system according to this schedule
0 */4 * * * root /usr/local/bin/rsnapshot hourly
30 23 * * * root /usr/local/bin/rsnapshot daily
Restore
-------
#boot with fixit disk
Restore
=======
0. mount the source
mount 192.168.0.16:/export/a /mnt
#make the target directories
mkdir -p /target/root /target/var /target/usr
mount /dev/ad0s1a /target/root
(cd /mnt/snapshots/hourly.0/localhost; tar -cf - \
etc boot compat lib libexec root sbin service sys home) | \
(cd /target/root; tar -xvf -);
mount /dev/ad0s1d /target/var;
(cd /mnt/snapshots/hourly.0/localhost; tar -cf - var) | (cd /target; tar -xvf -);
mount /dev/ad0s1f /target/usr;
(cd /mnt/snapshots/hourly.0/localhost; tar -cf - usr) | (cd /target; tar -xvf -);
Reboot and do a configuration
sysinstall
reboot