Roberto Ragusa wrote:
Justin W wrote:
I'm currently in the process of rewriting the script and such so that
there is not so much manual input. If I succeed, the script should be
quite portable across similar setups, but for now, you're going to have
to change many of the path names to how they apply to you.
Your approach is interesting, because (in likely conditions) you use
the fastest method to create the first copy (dd) and the fastest
method to update the backup (rsync). Then, you keep two options
for restoration: total fileystem (dd) and selective file copy.
Thanks for the encouragement. I've been running a server for close to 4
years now, but this is the first week I've had a solid backup of the
system. Though one major reason until now was the lack of necessary
hardware, the logistics of how to backup my server without taking it
down into single user mode had eluded me. The solution had finally come
once I heard some mention of LVM snapshots and read more up on them. A
priority of mine was to be able to selectively search through files (in
the case when I completely reinstall my server and just want to copy
configuration), but I also needed quick recovery just in case my hard
drive dies unexpectedly and a quick come back is needed (where I restore
an entire image).
The only tricky part I see is what happens when you enlarge
your filesystem (which I suppose you sometimes do, as you use LVM).
You have to recreate the image with dd; otherwise you have to
manually extend the image file and the filesystem contained in it.
This is possible but you have to calculate the new size very
accurately; you managed to avoid that when creating the first copy
as dd handled the end of partition for you.
It could be automated with something like
lvs -o lv_size --units=b --nosuffix --noheadings vgname/lvname
Thinking about it, the extension of the file image can be done
very quickly using dd seek=xxx (obtaining a sparse file).
I never really considered what would happen if I expanded the
partition. If I'm going through the trouble of doing that, I don't
really see a problem with recreating the backup image all over again.
It's a really simple process, and most of the time is just spent waiting
for it to complete. If I read more on dd, I'm sure there are ways to
optimize the buffer sizes and such which could speed up the copy, but as
it wasn't a big deal to me, I didn't really bother.
Best regards.
Suggestions as to how I can improve the efficiency of the dd copy or
better flags for rsync are welcome.
Justin W