Francesco Talamona wrote:
Yes, please.
I'm not completely new to dump, but I'd like to read about a complete
dump-backup solution.
Ciao
Francesco
Well - its not complete by any stretch of the imagination... but the
attached (hopefully not striped off by the mailing list software) is a
very brief discussion of how to do a minimal backup/restore using
xfsdump. Note that user data is *not* explicitly covered - even tho
there is no reason it cannot be backed up this way too! In addition it
does not cover incremental or cumulative backup variations - again no
reason why this cannot be used, but for a quick and simple *system*
restore, I find using only full (i.e level 0) dumps helps avoid admin
(i.e me making) mistakes.
It's worth noting that the essential logic is simply:
- dump system filesystems
- save xfsrestore binaries as a package
- boot livecd
- install xfsrestore binaries somewhere
- restore dumps
Backup and Restore System
=========================
This is a quick guide for backing up and restoring xfs dilesystems using
xfsdump/xfsrestore. It should be relatively simple to apply the ideas for other
filesystems dump tools (e.g. dumpe2fs for ext2/3).
Backup
------
1. Dump filesystems:
$ cd /data0/backup
$ xfsdump -L boot-0 -M backup1 -l0 -f boot-0.dmp /boot
$ xfsdump -L root-0 -M backup1 -l0 -f .root.0.dmp /
$ xfsdump -L var-0 -M backup1 -l0 -f var-0.dmp /var
$ xfsdump -L usr-0 -M backup1 -l0 -f usr-0.dmp /usr
2. Package dump program
$ quickpkg xfsdump
$ cp /usr/portage/packages/All/xfsdump-2.2.45.tbz2 /data0/backup
3. Record filesystem layout
$ df -m > df.out
4. Save the dumps and packages
Copy to DVD or another machine...
Restore
-------
1. Boot from the live cd
We are assuming that we are completely rebuilding the system, or are making
another one (initially) identical to the backed-up one.
2. Partition drives and create empty filesystems etc if required
$ mkfs.xfs /dev/sda1
$ mkswap /dev/sda2
$ mkfs.xfs /dev/sda3
$ mkfs.xfs /dev/sda4
$ mkfs.xfs /dev/sda6
3. Retrieve backup dump and package files from DVD or other machine
May require 2 DVDROMS (or 1 DVDROM and 1 CDROM) - one for live cd, one for
backup data.
4. Install dump program if it is not already on the live cd
Xfsdump is *not* on the live cd. You need to choose a partition you are not
using yet and create a filesystem on it, install xfsrestore there and amend the
system path to see it. (or add another tmpfs filesystem).
$ mkfs.xfs /dev/sda9
$ mkdir /xfsrestore
$ mount /dev/sda9 /xfsrestore
$ cd /xfsrestore
$ tar -jxvf xfsdump-2.2.45.tbz2
$ cd usr/bin
$ rm xfsdump xfsrestore
$ ln -s /xfsrestore/sbin/xfsdump xfsdump
$ ln -s /xfsrestore/sbin/xfsrestore xfsrestore
$ export PATH=$PATH:/xfsrestore/sbin:/xfsrestore/usr/bin
5. Restore dumps
Use the contents of df.out to figure out which dump should be restored on which
device! then temporily mount each filesystem and restore it.
$ mount /dev/sda3 /mnt2
$ xfsrestore -f /mnt/cdrom/root.0.dump /mnt2
Now root is restored we can mount the other empty filesystems and restore them.
$ mount /dev/sda1 /mnt2/boot
$ xfsrestore -f /mnt/cdrom/boot.0.dump /mnt2/boot
$ mount /dev/sda4 /mnt2/var
$ xfsrestore -f /mnt/cdrom/var.0.dump /mnt2/var
$ mount /dev/sda6 /mnt2/usr
$ xfsrestore -f /mnt/cdrom/usr.0.dump /mnt2/usr
6. Chroot, (re)install bootloader and reboot
7. Notes
Obviously you can backup user data this may too (i.e /home), altho other
methods might be simpler (mind you most dump tools let you do incremental and
cumulative relatively simply).