From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S5cRg-0007uZ-KB for garchives@archives.gentoo.org; Thu, 08 Mar 2012 12:27:48 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CB803E07F2; Thu, 8 Mar 2012 12:27:31 +0000 (UTC) Received: from ksp.sk (element.ksp.sk [158.195.16.154]) by pigeon.gentoo.org (Postfix) with ESMTP id 04C87E0789 for ; Thu, 8 Mar 2012 12:26:26 +0000 (UTC) Received: by ksp.sk (Postfix, from userid 1004) id 11A934C252; Thu, 8 Mar 2012 13:26:26 +0100 (CET) Date: Thu, 8 Mar 2012 13:26:45 +0100 From: YoYo Siska To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Clone live system as a simple backup? Message-ID: <20120308122645.GB25729@ksp.sk> References: <612c6e461165dfa7a04d0a8459f2e90d.squirrel@derek.d-danks.co.uk> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-YoYo: 47 X-Exotic-Header-Data: 47/2 User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 042aafbf-aa01-44d8-ad18-dad76e530686 X-Archives-Hash: e195d0ee0493942b7f453e4446fe633b On Wed, Mar 07, 2012 at 02:47:08PM -0500, Joshua Murphy wrote: > On Wed, Mar 7, 2012 at 8:55 AM, wrote: > >> Hi, > >> =A0 =A0I'm interested in the idea of cloning a live, complicated har= dware > >> system onto a single external hard drive as a simple backup. I would > >> like this external drive to be completely bootable. What's the best > >> way to approach doing this? I was considering just doing a Gentoo > >> install from scratch but figured maybe there's a way to clone enough > >> of the live system to get me there less painfully? > >> > >> =A0 =A0The system I'm playing with has five 500MB hard drives with m= ost > >> partitions in linked together in various forms of RAID. (1, 5 & 6) > >> That said, the total storage that this system presents KDE and the > >> users is about 600GB. > >> > >> =A0 =A0I have an external 1TB eSATA drive which is therefore large e= nough > >> to hold everything on this system, albeit without the reliability of > >> RAID which is fine for this purpose. > >> > >> =A0 =A0The system looks more or less like: > >> > >> /dev/sda1 -> /boot (50MB) > >> /dev/sdb1 -> /boot copy > >> /dev/sdc1 -> /boot copy > >> > >> c2stable ~ # df > >> Filesystem =A0 =A0 1K-blocks =A0 =A0 =A0Used Available Use% Mounted = on > >> rootfs =A0 =A0 =A0 =A0 =A051612920 =A031862844 =A017128276 =A066% / > >> /dev/root =A0 =A0 =A0 51612920 =A031862844 =A017128276 =A066% / > >> rc-svcdir =A0 =A0 =A0 =A0 =A0 1024 =A0 =A0 =A0 =A092 =A0 =A0 =A0 932= =A0 9% /lib64/rc/init.d > >> udev =A0 =A0 =A0 =A0 =A0 =A0 =A0 10240 =A0 =A0 =A0 476 =A0 =A0 =A097= 64 =A0 5% /dev > >> shm =A0 =A0 =A0 =A0 =A0 =A0 =A06151284 =A0 =A0 =A0 =A0 0 =A0 6151284= =A0 0% /dev/shm > >> /dev/md7 =A0 =A0 =A0 389183252 350247628 =A019166232 =A095% /Virtual= Machines > >> tmpfs =A0 =A0 =A0 =A0 =A0 =A08388608 =A0 =A0 =A0 =A0 0 =A0 8388608 =A0= 0% /var/tmp/portage > >> /dev/sda1 =A0 =A0 =A0 =A0 =A054416 =A0 =A0 29516 =A0 =A0 22091 =A058= % /boot > >> c2stable ~ # cat /proc/mdstat > >> Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] > >> [raid4] > >> md6 : active raid5 sdb6[1] sdc6[2] sda6[0] > >> =A0 =A0 =A0 494833664 blocks super 1.1 level 5, 64k chunk, algorithm= 2 [3/3] > >> [UUU] > >> > >> md7 : active raid6 sdb7[1] sdc7[2] sda7[0] sdd2[3] sde2[4] > >> =A0 =A0 =A0 395387904 blocks super 1.2 level 6, 16k chunk, algorithm= 2 [5/5] > >> [UUUUU] > >> > >> md3 : active raid6 sdb3[1] sdc3[2] sda3[0] sdd3[3] sde3[4] > >> =A0 =A0 =A0 157305168 blocks super 1.2 level 6, 16k chunk, algorithm= 2 [5/5] > >> [UUUUU] > >> > >> md126 : active raid1 sdc5[2] sda5[0] sdb5[1] > >> =A0 =A0 =A0 52436032 blocks [3/3] [UUU] > >> > >> unused devices: > >> c2stable ~ # > >> > >> =A0 =A0/dev/md3 is a second Gentoo installation that doesn't need to= be > >> backed up at this time. md6 is an internal RAID used to back up md7 > >> daily. It doesn't need to be backed up, but if the machine totally > >> failed killing all the drives that wouldn't survive so currently I > >> back up md126 to md6 daily, and then back up md6 weekly to an extern= al > >> eSATA drive. > >> > >> =A0 =A0What I'd like to do is clone > >> > >> 1) /boot (sda1) including grub and everything required to make it bo= otable > >> 2) back up the system portions of dev/md126 (/ ) > >> 3) Add some swap space on the external drive > >> 4) back up /dev/md7 which is all of my VMs > >> 5) back up /home to a separate partition on the external drive > >> 6) back up some special things like /var/lib/portage/world and > >> /usr/portage/packages > >> > >> My thought is that this drive is basically bootable, but over time > >> gets out-of-sync with the system. However should the system fail I'v= e > >> got a bootable external drive with all the binary packages required = to > >> get it running again quickly. However I can always boot the drive, d= o > >> an emerge -ek @world, and basically be back to where I am as of the > >> last backup. > >> > >> The external drive will look something like: > >> > >> /dev/sdg1 -> /boot > >> /dev/sdg2 -> swap > >> /dev/sdg3 -> / (not including /home, /usr/portage/distfiles, etc) > >> /dev/sdg5 -> /usr/portage/packages > >> /dev/sdg6 -> /dev/md7 > >> > >> etc.... > >> > >> =A0 =A0I will of course have to modify grub.conf and /etc/fstab to w= ork > >> from this drive but that's no big deal. > >> > >> =A0 =A0What are folks best ideas about how to approach doing somethi= ng like > >> this? > >> > >> Thanks, > >> Mark > >> > >> > > Hi, > > =A0 =A0Why don't you something like bind mount the folders you want t= o copy > > and rsync them to the eSATA disk, after creating a similar partition > > layout on it. Remember to exclude system files like /proc/*, /dev/* > > and /sys/* as well as the ones you want to exclude yourself from the > > rsync. When you want to sync the clone again just do the same again > > and rsync the changes. > > > > Regards, > > Derek > > > > >=20 > As an added note on this, rsync's --one-file-system (-x) flag is handy > for avoiding grabbing unneeded things, but will typically leave you > without the base few device nodes needed to boot the backup, those can > either be grabbed from a stage3, or created with (courtesy of Linux > From Scratch's section "6.2.1. Creating Initial Device Nodes"): >=20 > mknod -m 600 ${backup}/dev/console c 5 1 > mknod -m 666 ${backup}/dev/null c 1 3 The best way to copy a filesystem without any sub-mounts is to mount-bind it to some directory and copy it from there: mkdir /tmp/root mount --bind / /tmp/root rsync -a /tmp/root/ /mnt/backup/ Note that copying a rw filesystem (especially /) on a running system isn't a very clean operation.. yoyo