[kwlug-disc] Partimage on a mounted partition.

Chris Irwin chris at chrisirwin.ca
Tue Apr 24 12:24:32 EDT 2012


On Tue, Apr 24, 2012 at 09:48, Joe Wennechuk
<youcanreachmehere at hotmail.com> wrote:
>
> I am scripting some system backups, and have been using dd to make the images.
>
> I am liking the partimage, but I can not unmount the partitions because they are on running systems.
>
> I am seeing this when I google....
>
> Command-line option:
>
> Code:
> -m,  --allowmnt      don't fail if the partition is mounted. Dangerous !
>
> Can anyone explain what pitfalls might occur if I use this switch?

It looks like partimage works on the device, rather than on a mounted
filesystem. The potential problem would be you're reading bits from
the disk as other things are being overwritten.

Lets say you have bigfile.zip, and you start the backup. partimage
sees bigfile.zip takes up 40MB, and starts reading it. While it is
being read, bigfile.zip is updated, and is now 45MB. What happens is
undefined:

1. If your zip software built a new bigfile.zip, then renamed it over
the original, then you'd possibly get the old copy of bigfile.zip
2. If your zip software actually mucked about with bigfile.zip
in-place, you might get a corrupted file in your backup

Even in case #1, once the original bigfile.zip file is "gone", it's
space could be overwritten (ex: by a transaction log indicating the
new bigfile.zip contents), thus again causing corrupted data.

Generally, when you're backing up data at the device level, you want
to guarantee nothing else is changing that data at the same time. It
can be overwritten because it *might* be okay (/usr/local should not
change during your backup window, for example), but that is really
your call to make.

The easiest solution to this problem would be LVM. You can snapshot
the logical volume, fsck the snapshot, cleanly back it up, and remove
the snapshot. You can guarantee the backup is as the disk was at one
point, rather than a moving target over time.

As an aside, partimage doesn't appear to support ext4. Just FYI if
you're building new systems.

--
Chris Irwin
<chris at chrisirwin.ca>




More information about the kwlug-disc mailing list