I was looking for the same thing you are trying todo last week. I used
partimage and was not happy with it, so I just used tar, and why not? Its
tried and true, and I think its about 30 years old.
I use this for our production mail (qmail) server. I have tested by fdisking
the whole drive and restoring. I had no problems or errors using the
restored server. These are the steps I took. Modify for your needs.
-- To 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/sda of=/etc/mbr.bak bs=512 count=1
3) back up the operating system:
# mount /boot ## if its not already
# cd /
# tar zcvf - . --exclude='./proc' --exclude='./sys'
--exclude='./lost+found' | ssh some_host "cat > backup_server.tar.gz"
-- To Restore
1) boot live cd
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 zpvxf -
-j Decompress with bzip2
-p Preserve permissions
-v Verbose
-x Extract
-f File
5) create proc and sys
# mkdir /proc
# mkdir /sys
6) 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.
7) reboot
--end
Michael Irey
System Administrator
................................................
SightWorks, Inc.
Portland, Oregon
Web: http://www.sightworks.com
SightWorks : Creative Internet Technologies
On Friday 02 September 2005 02:16 am, Luca Dell'Oca wrote:
> Hi all,
> I have a couple of gentoo servers that I cannot shutdown for
> maintenance. In the past, I've used Acronis trueimage on my windows
> machines in order to create images of the drives, and I love the fact I
> do not need to shutdown the machine to create the image, and the image
> can be saved on the same partition I'm ghosting.
> I've tried several program for linux, but none of them seem to have the
> same features: partimage can backup live systems, but it cannot create
> the file on the same partition I'm ghosting and it creates different
> files for every partition, and all the other softwares have their own
> liveCD to boot from, but in this way I have to shutdown the server.
>
> Acronis has a linux version of trueimage, but it needs X to run, and I
> do not want to install it on a mail or web server, and gentoo is not
> supported, so I think it could be a PITA to install it.
>
> Any suggestion, maybe also some script able to copy also the mbr?
>
> Thanks,
> Luca, Italy
--
[email protected] mailing list