Excellent! Just the thing I need to shore up my backups at home. However, here at work I think it'd need a little sprucing up for the software RAID sets.
Thanks! Rich -----Original Message----- From: Michael Irey [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 30, 2005 7:59 PM To: [email protected] Subject: Re: [gentoo-server] Quick restores On Wednesday 30 November 2005 1:59 pm, A. Khattri wrote: > > Im wondering if anyone has written a script (or maybe there's a tool to do > this) that will make binary packages of everything installed on a server > which can then be used to perform very quick restores in the event of a > major failure? > I use the following to do a quick and complete restore for a remote gentoo server at 1and1. ---------------------------------------- | Linux Backup and Bare Metal Recovery | ---------------------------------------- -- Backup 1) save metadata about how the disk is partitioned. # sfdisk -l > /etc/partition.bak # cp /etc/fstab /etc/fstab.bak 2) back up master boot record (MBR) # dd if=/dev/hda of=/etc/mbr.bak bs=512 count=1 3) back up the operating system: # mount /boot ## if its not already # cd / # tar -jcf --anchored --exclude '/sys' --anchored --exclude '/proc' --anchored --exclude '/lost+found' - / | ssh target "cat > filename.tar.bz2" TODO: ssh -> ftp for 1and1 -- Restore 1) boot rescue mode ( debian 2.6 at 1and1 ) 2) partition drive(s) # ssh backupserver 'cat /etc/partition.bak' Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 8 9- 72261 83 Linux /dev/sda2 9 133 125 1004062+ 82 Linux swap / Solaris /dev/sda3 134 9728 9595 77071837+ 83 Linux /dev/sda4 0 - 0 0 0 Empty # sfdisk /dev/sda << EOF 0,9,83,* 9,125,82 134,9595,83 ,,0; EOF notes: sfdisk reads lines of the form <start> <size> <id> <bootable> <c,h,s> <c,h,s> where each line fills one partition descriptor. 3) create file systems # mke2fs /dev/sda1 # mke2fs -j /dev/sda3 # mkswap /dev/sda2 # mkdir /mnt/gentoo # mkdir /mnt/gentoo/boot # swapon /dev/sda2 # mount -t ext3 /dev/sda3 /mnt/gentoo # mount /dev/sda1 /mnt/gentoo/boot 4) restore OS and data # cd /mnt/gentoo # ssh target "cat filename.tar.bz2" | tar jpvxf - notes: -j Decompress with bzip2 -p Preserve permissions -v Verbose -x Extract -f File TODO: ssh -> ftp for 1and1 5) restore MBR # dd if=/mnt/gentoo/etc/mbr.bak of=/dev/sda bs=512 count=1 notes: one could run grub-install --no-floppy /dev/sda instead. --end -- Michael Irey System Administrator ...................................................................... SightWorks, Inc. 5331 SW Macadam Avenue, Suite 348 Portland, Oregon 97239 Web: http://www.sightworks.com SightWorks : Creative Internet Technologies -- [email protected] mailing list -- [email protected] mailing list
