Gentoo Archives: gentoo-server

From: Michael Irey <michael@××××.org>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] Imaging software for a production server
Date: Tue, 06 Sep 2005 04:43:04
Message-Id: 200509052141.24227.michael@irey.org
In Reply to: [gentoo-server] Imaging software for a production server by Luca Dell'Oca
1 I was looking for the same thing you are trying todo last week. I used
2 partimage and was not happy with it, so I just used tar, and why not? Its
3 tried and true, and I think its about 30 years old.
4
5 I use this for our production mail (qmail) server. I have tested by fdisking
6 the whole drive and restoring. I had no problems or errors using the
7 restored server. These are the steps I took. Modify for your needs.
8
9 -- To Backup
10
11 1) save metadata about how the disk is partitioned.
12
13 # sfdisk -l > /etc/partition.bak
14 # cp /etc/fstab /etc/fstab.bak
15
16
17 2) back up master boot record (MBR)
18
19 # dd if=/dev/sda of=/etc/mbr.bak bs=512 count=1
20
21
22 3) back up the operating system:
23
24 # mount /boot ## if its not already
25 # cd /
26 # tar zcvf - . --exclude='./proc' --exclude='./sys'
27 --exclude='./lost+found' | ssh some_host "cat > backup_server.tar.gz"
28
29
30 -- To Restore
31
32 1) boot live cd
33
34
35 2) partition drive(s)
36
37 # ssh backupserver 'cat /etc/partition.bak'
38 Disk /dev/sda: 9729 cylinders, 255 heads, 63 sectors/track
39 Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting
40 from 0
41
42 Device Boot Start End #cyls #blocks Id System
43 /dev/sda1 * 0+ 8 9- 72261 83 Linux
44 /dev/sda2 9 133 125 1004062+ 82 Linux swap /
45 Solaris
46 /dev/sda3 134 9728 9595 77071837+ 83 Linux
47 /dev/sda4 0 - 0 0 0 Empty
48
49
50 # sfdisk /dev/sda << EOF
51 0,9,83,*
52 9,125,82
53 134,9595,83
54 ,,0;
55 EOF
56 notes:
57 sfdisk reads lines of the form <start> <size> <id> <bootable>
58 <c,h,s> <c,h,s>
59 where each line fills one partition descriptor.
60
61
62 3) create file systems
63
64 # mke2fs /dev/sda1
65 # mke2fs -j /dev/sda3
66 # mkswap /dev/sda2
67
68 # mkdir /mnt/gentoo
69 # mkdir /mnt/gentoo/boot
70
71 # swapon /dev/sda2
72 # mount -t ext3 /dev/sda3 /mnt/gentoo
73 # mount /dev/sda1 /mnt/gentoo/boot
74
75 4) restore OS and data
76
77 # cd /mnt/gentoo
78 # ssh target "cat filename.tar.bz2" | tar zpvxf -
79 -j Decompress with bzip2
80 -p Preserve permissions
81 -v Verbose
82 -x Extract
83 -f File
84
85 5) create proc and sys
86
87 # mkdir /proc
88 # mkdir /sys
89
90 6) restore MBR
91
92 # dd if=/mnt/gentoo/etc/mbr.bak of=/dev/sda bs=512 count=1
93 notes:
94 one could run grub-install --no-floppy /dev/sda instead.
95
96 7) reboot
97
98 --end
99
100 Michael Irey
101 System Administrator
102 ................................................
103 SightWorks, Inc.
104 Portland, Oregon
105
106 Web: http://www.sightworks.com
107 SightWorks : Creative Internet Technologies
108
109
110
111 On Friday 02 September 2005 02:16 am, Luca Dell'Oca wrote:
112 > Hi all,
113 > I have a couple of gentoo servers that I cannot shutdown for
114 > maintenance. In the past, I've used Acronis trueimage on my windows
115 > machines in order to create images of the drives, and I love the fact I
116 > do not need to shutdown the machine to create the image, and the image
117 > can be saved on the same partition I'm ghosting.
118 > I've tried several program for linux, but none of them seem to have the
119 > same features: partimage can backup live systems, but it cannot create
120 > the file on the same partition I'm ghosting and it creates different
121 > files for every partition, and all the other softwares have their own
122 > liveCD to boot from, but in this way I have to shutdown the server.
123 >
124 > Acronis has a linux version of trueimage, but it needs X to run, and I
125 > do not want to install it on a mail or web server, and gentoo is not
126 > supported, so I think it could be a PITA to install it.
127 >
128 > Any suggestion, maybe also some script able to copy also the mbr?
129 >
130 > Thanks,
131 > Luca, Italy
132 --
133 gentoo-server@g.o mailing list

Replies

Subject Author
Re: [gentoo-server] Imaging software for a production server Joey <japanoy@×××××××××××.com>