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