Gentoo Archives: gentoo-user

From: gandalf@××××××××××.uk
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Clone live system as a simple backup?
Date: Wed, 07 Mar 2012 13:57:10
Message-Id: 612c6e461165dfa7a04d0a8459f2e90d.squirrel@derek.d-danks.co.uk
In Reply to: [gentoo-user] Clone live system as a simple backup? by Mark Knecht
1 > Hi,
2 > I'm interested in the idea of cloning a live, complicated hardware
3 > system onto a single external hard drive as a simple backup. I would
4 > like this external drive to be completely bootable. What's the best
5 > way to approach doing this? I was considering just doing a Gentoo
6 > install from scratch but figured maybe there's a way to clone enough
7 > of the live system to get me there less painfully?
8 >
9 > The system I'm playing with has five 500MB hard drives with most
10 > partitions in linked together in various forms of RAID. (1, 5 & 6)
11 > That said, the total storage that this system presents KDE and the
12 > users is about 600GB.
13 >
14 > I have an external 1TB eSATA drive which is therefore large enough
15 > to hold everything on this system, albeit without the reliability of
16 > RAID which is fine for this purpose.
17 >
18 > The system looks more or less like:
19 >
20 > /dev/sda1 -> /boot (50MB)
21 > /dev/sdb1 -> /boot copy
22 > /dev/sdc1 -> /boot copy
23 >
24 > c2stable ~ # df
25 > Filesystem 1K-blocks Used Available Use% Mounted on
26 > rootfs 51612920 31862844 17128276 66% /
27 > /dev/root 51612920 31862844 17128276 66% /
28 > rc-svcdir 1024 92 932 9% /lib64/rc/init.d
29 > udev 10240 476 9764 5% /dev
30 > shm 6151284 0 6151284 0% /dev/shm
31 > /dev/md7 389183252 350247628 19166232 95% /VirtualMachines
32 > tmpfs 8388608 0 8388608 0% /var/tmp/portage
33 > /dev/sda1 54416 29516 22091 58% /boot
34 > c2stable ~ # cat /proc/mdstat
35 > Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5]
36 > [raid4]
37 > md6 : active raid5 sdb6[1] sdc6[2] sda6[0]
38 > 494833664 blocks super 1.1 level 5, 64k chunk, algorithm 2 [3/3]
39 > [UUU]
40 >
41 > md7 : active raid6 sdb7[1] sdc7[2] sda7[0] sdd2[3] sde2[4]
42 > 395387904 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5]
43 > [UUUUU]
44 >
45 > md3 : active raid6 sdb3[1] sdc3[2] sda3[0] sdd3[3] sde3[4]
46 > 157305168 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5]
47 > [UUUUU]
48 >
49 > md126 : active raid1 sdc5[2] sda5[0] sdb5[1]
50 > 52436032 blocks [3/3] [UUU]
51 >
52 > unused devices: <none>
53 > c2stable ~ #
54 >
55 > /dev/md3 is a second Gentoo installation that doesn't need to be
56 > backed up at this time. md6 is an internal RAID used to back up md7
57 > daily. It doesn't need to be backed up, but if the machine totally
58 > failed killing all the drives that wouldn't survive so currently I
59 > back up md126 to md6 daily, and then back up md6 weekly to an external
60 > eSATA drive.
61 >
62 > What I'd like to do is clone
63 >
64 > 1) /boot (sda1) including grub and everything required to make it bootable
65 > 2) back up the system portions of dev/md126 (/ )
66 > 3) Add some swap space on the external drive
67 > 4) back up /dev/md7 which is all of my VMs
68 > 5) back up /home to a separate partition on the external drive
69 > 6) back up some special things like /var/lib/portage/world and
70 > /usr/portage/packages
71 >
72 > My thought is that this drive is basically bootable, but over time
73 > gets out-of-sync with the system. However should the system fail I've
74 > got a bootable external drive with all the binary packages required to
75 > get it running again quickly. However I can always boot the drive, do
76 > an emerge -ek @world, and basically be back to where I am as of the
77 > last backup.
78 >
79 > The external drive will look something like:
80 >
81 > /dev/sdg1 -> /boot
82 > /dev/sdg2 -> swap
83 > /dev/sdg3 -> / (not including /home, /usr/portage/distfiles, etc)
84 > /dev/sdg5 -> /usr/portage/packages
85 > /dev/sdg6 -> /dev/md7
86 >
87 > etc....
88 >
89 > I will of course have to modify grub.conf and /etc/fstab to work
90 > from this drive but that's no big deal.
91 >
92 > What are folks best ideas about how to approach doing something like
93 > this?
94 >
95 > Thanks,
96 > Mark
97 >
98 >
99 Hi,
100 Why don't you something like bind mount the folders you want to copy
101 and rsync them to the eSATA disk, after creating a similar partition
102 layout on it. Remember to exclude system files like /proc/*, /dev/*
103 and /sys/* as well as the ones you want to exclude yourself from the
104 rsync. When you want to sync the clone again just do the same again
105 and rsync the changes.
106
107 Regards,
108 Derek

Replies

Subject Author
Re: [gentoo-user] Clone live system as a simple backup? Joshua Murphy <poisonbl@×××××.com>