|
From: Keith G. Robertson-T. <dum...@ge...> - 2007-12-20 13:27:17
|
Verily I say unto thee, that Kenneth Porter spake thusly:
> --On Thursday, December 20, 2007 12:31 AM +0000 "Keith G.
> Robertson-Turner" <dum...@ge...> wrote:
>> It really is that simple. All you have to do is format your
>> drive(s) with LVM, and remember to leave some unused slack at the
>> end (I leave about 1GB, which has always been enough for that very
>> busy server).
>
> My verify (restore) reports this:
>
> Level 0 dump of / on segw2.mpa.lan:/dev/mapper/VolGroup00-LogVol00
>
> Does that imply I'm already using LVM? (It's using the default
> partitioning with CentOS 5.)
Yes it does. You can confirm with the "lvdisplay" command, which will
display the properties of any/all logical volumes. Then "mount" (no
args) to show what filesystems are mounted. You should see what is
mounted on /dev/mapper/{xxx}. As you are already using LVM, then you
really should be using snapshots when backing up - it's so much less
hassle than trying to back up a live system, and it pretty much
guarantees consistent results.
For those unfamiliar with lvm commands, I recommend the Red Hat GUI
"system-config-lvm" which is included with CentOS and Fedora as well.
If it complains about unmounting the volumes first, then you can simply
boot a CentOS live disc and do it from there instead (I know for a fact
that system-config-lvm *is* included on their live discs, because I've
used them in the past as my rescue discs). You will only need to do this
*once*, to create some slack space.
Under "logical view" choose one of the volumes (you probably only have
one) that's the biggest with the most available space, click on the
"edit properties" button, change the drop-down selector that currently
reads "extents" to something more readable like "gigabytes", move the
slide bar down to leave about 1GB "remaining space", then click on OK.
Once you have some slack-space at the end of the hard drive, you can use
it to create a snapshot filesystem with:
mkdir -p /mnt/snapshots
lvcreate -l100%FREE -s -n LogVol00-snapshot /dev/VolGroup00/LogVol00
mount -t ext3 /dev/VolGroup00/LogVol0-snapshot /mnt/snapshots
That then "freezes" the state of the LogVol00 filesystem as a "snapshot"
on LogVol00-snapshot, and you can dump LogVol00-snapshot without fear of
its contents changing. When you're finished you just unmount it then:
lvremove -f /dev/VolGroup00/LogVol0-snapshot
That should resolve your "disappearing files" problem.
One word of caution: I recommend that you don't use the machine heavily
during the period that the snapshot is in use, since it will rapidly
fill up and become invalidated (i.e. stop being a snapshot). If the
normal background processes on your machine make more than 1GB of
changes during the time it takes to dump the filesystem, then you'll
need a bigger slack-space at the end. Like I said, on my very busy
server, with things like squid and MySQL running, I never use more than
about 250MB of the snapshot's available space during the dump. You'll
need to experiment with the slack-space a little, to see what suits you
best. It can be any size you like. The bigger it is, the less likely you
are to run out of space before the backup is complete, but obviously you
lose usable drive space as well.
--
Regards,
Keith G. Robertson-Turner
|