backup strategies

Eric Schuele e.schuele at computer.org
Mon Oct 31 07:51:29 PST 2005


Csaba Henk wrote:
> Thanks for all the tips and answers, I will consider the mentioned
> alternatives.
> 
> Yet I have one more question...
> 
> On Sun, Oct 30, 2005 at 01:22:35PM -0600, Eric Schuele wrote:
> 
>>dump(8) will create a snapshot of a live filesystem, dump the snapshot 
>>and then remove the snapshot, if given the correct flags ('-L').
> 
> 
> Can even a full bakcup done safely on a live filesystem by "dump -L"?
> 
> As dump(8) says when explaining the -L flag:
> 
>  To obtain a consistent dump image, dump takes a snapshot of the file
>  system in the .snap directory in the root of the file system being
>  dumped and then does a dump of the snapshot.
> 
> I don't see how the temporary snapshot can improve the
> reliability/consistency/correctness of the dump. Could someone explain
> this?
> 

How do snapshots work and how do they provide the consistency necessary 
for a dump?

(Well, I'm probably not the best one to answer this, but I'll take a swing.)

Basically, when taking a snapshot... any new activity on the filesystem 
in question is suspended.  All presently executing syscalls are allowed 
to finish.  The filesystem is synchronized as if unmounting, and then a 
snapshot file is created.  At this point filesystem activity is resumed.

The real magic is in the snapshot file.  The file is a snapshot of the 
filesystem metadata at the time the snapshot was taken.  From this point 
on... as long as the snapshot exists on your machine... it tracks the 
changes that occur within the filesystem from the time you took the 
snapshot to the present.  What this means is the snapshot file holds 
pointers to the data on your filesystem.  As that data changes (since 
the snapshot), the old data gets claimed by the snapshot... and the new 
data is written to disk.  Same with deleting data... the deleted data 
gets claimed by the snapshot and the filesystem looses it.  Any 
unchanged data is simply referred to (in the snapshot file) as pointers 
to the existing data on the actual filesystem, and any new data need not 
be mentioned in the snapshot file.

So the snapshot can be taken very quickly... and requires a bit of 
maintenance by the OS during its lifetime.  But if you create it, dump 
it and remove it.  The OS need not worry about it for long.

SoftUpdates are required on the filesystem.

HTH.

-- 
Regards,
Eric


More information about the freebsd-questions mailing list