Running filesystem backup?

Matthias Schniedermeyer ms at citd.de
Mon Jun 22 07:59:34 GMT 2009


On 21.06.2009 14:54, Rafa? Radecki wrote:
> Hi all. I currently have a problem. I try to make a backup of a running /
> filesystem to a second disc. I've read tha some people use rsync for it. I
> mount the second harddisc at /mnt/hdb1 and issue a command:
> 
> rsync -vaHx --progress --numeric-ids --delete \
>     --exclude-from=asylum_backup.excludes --delete-excluded \
>     / /mnt/hdb1

That's more or less exactly what i do when i migrate my boot/root-disc.
Altough i don't exclude anything when i migrate my root-filesystem.

Biggest difference is that i mount the root-filesystem to another 
mount-point, so that that instance doesn't have mounts mounted which can 
hide things.

> Then I shutdown the system, remove the first disc and try to boot the
> system with a rescue cd to install grub through grub-install.

Which isn't really necessary. A 'device.map' is all it takes to convince 
GRUB to see the hard-disc world you like it to see. ;-)

> I chroot to the second disc (the filesystem which I copied earlier through
> rsync) and try to use grub-install but someting isn't ok with /proc, /sys,
> .etc. They are empty.

/proc & /sys are mount-points with virtual-kernel-filesystems.
They are mounted on the root-filesystem provided of the rescue-system 
and are not mounted (automatically) on your root-filesystem.

I never needed them to mounted just for installing grub, but if you need them:
mount --bind /proc <mountpoint>/proc
mount --bind /sys <mountpoint>/sys

And if you use udev and your <mountpoint>/dev isn't fully populated:
mount --bind /dev <mountpoint>/dev

You do that before chroot.

> I thought that rsync copied the whole / filesystem but was that really? What

rsync can't mount filesystems, that is out of it's scope.

The other thing that is out of rsync-scope is "/etc/fstab", which you 
MAY have to fix (on the copy).
And you also MAY have to fix the GRUB-menu.
But you only should have to do that if the partitions differ and/or if 
the new HDD would have another device. (hda vs. hdb, hda vs. sda)

> do you think about backuping running / filesystems with rsync? Could it be
> an appropriate tool in that context or not? I want to make a copy which in
> case of the first disks' failure could be used quite fast (for example only
> with gub-install to repair MBR).

As i said, i have used rsync to migrate my filesystems several times 
over the years.





Bis denn

-- 
Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.



More information about the rsync mailing list