← Back to team overview

sslug-teknik team mailing list archive

Re: backup af filer der ændres løbende

 

On Tue, 28 Jul 2009 19:44:09 +0200
Donald J Axel <donax@xxxxxx> wrote:

> > Og hvordan forholder man sig generelt til problemstillingen, at
> > en fil på systemet ændres netop i det tidsinterval der tages
> > backup af den specifikke fil?
> 
> I nyeste version af ext4 skulle der komme en snap-shot facilitet,
> hvor man ligesom i en database kan sige hvad tilstanden er på
> tidspunkt XXX. Skriv/læs transaktioner noteres i en logfil.

Det er et spændende emne du har bragt op. Jeg ville lige checke,
hvor langt udviklingen med ext4 er og opdater, at der er meget
kritiske bemærkninger om *både* ext3 og ext4, som selvfølgelig
fungerer meget godt under normale omstændigheder, men som i
tilfælde af nedbrud kan forårsage de forfærdeligste datatab, OGSÅ
på RAID!!!

----

Ved at Google på dm_snap og filesystem snapshot fandt jeg bl.a.
følgende råd fra
http://arstechnica.com/open-source/news/2004/10/linux-20041013.ars
File system snapshots with LVM

[---]

What is LVM?

LVM stands for Logical Volume Manager.

My employer uses mail server software called CommunigatePro written
by Stalker Software. CGatePro runs on many, many operating systems
and is very configurable. The software stores its data
at /var/CommuniGate by default and that's the only directory you
ever have to backup.

The goal is to get a Mail server that will never be taken offline
for nightly backups (as our old system used to). We found Linux,
XFS, LVM, and snapshots to be perfect for this situation What is
snapshotting?

Snapshotting is a way to take a "point-in-time" image of a
filesystem. What this allows you is to do is access files that
would normally be locked so you can back them up. The process is as
follows:

   1. Freeze the file system
   2. Take the snapshot
   3. Mount the snapshot
   4. Unfreeze the real filesystem
   5. Take a backup of the snapshot
   6. Unmount and destroy the snapshot

Freezing the file system

Freezing the file system is to prevent writing to the disk while
the snapshot is taken. This freezes all activity to and from the
filesystem to reduce the risk of problems. To do this we use
xfs_freeze (included in the xfs userspace tools).

    xfs_freeze -f /var/CommuniGate

[Det svarer til unmount eller remount - ingen kan skrive.
Forhåbentlig er xfs_freeze lavet sådan at xfs afslutter
transaktioner (som ved umount, der laver en sync og sætter
filsystemet i en "renset" tilstand (clean, ses med dumpe2fs).

Taking the snapshot

When you take the snapshot, you're essentially creating a new LVM
device that appears to be a duplicate of the "real" filesystem at a
point in time. To do this we create another LVM device (using
lvcreate) with an argument of -s to indicate we want a snapshot and
the -n argument to name it.

    lvcreate -l 500 -s -n mysnaps /dev/cgpro/prod







-- 
Donald Axel <donax@xxxxxx>


References