BackupPC-users

Re: [BackupPC-users] Is there any way for BackupPC to restore hard links properly?

2008-11-10 02:08:18
Subject: Re: [BackupPC-users] Is there any way for BackupPC to restore hard links properly?
From: Craig Barratt <cbarratt AT users.sourceforge DOT net>
To: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
Date: Sun, 9 Nov 2008 23:06:25 -0800
Jeffrey writes:

> Looking at the code and the structure of the storage and attrib files,
> it doesn't seem like there is any way for BackupPC to record and
> restore hard links.

Not true.  Hardlinks are stored without using hardlinks.

Hardlinks are stored just like symlinks.  The attribute type is
BPC_FTYPE_HARDLINK and the contents of the file is the path of
the file being linked to.

For example, if there are 4 links to a file, one instance (it
doesn't matter which - depends on the Xfer Method) will be stored
as a regular file.  The remaining three instances will be stored
as type BPC_FTYPE_HARDLINK with pointers to the first file.

Note that this is independent of the hardlinks used to de-duplicate.

There is one subtlety with rsync: it also needs to remember if a
regular file is the target of (other) hardlinks so that the correct
file list can be generated during a restore.  This is done by using
an extra bit in the file's mode stored in the attrib file.

This results in one subtle bug that can't be easily fixed: if you
switch the Xfer method from tar to rsync, old backups that have
hardlinks stored with tar won't be correctly restored with rsync.
The workaround is generate a tar file and extract it, or switch
the Xfer method back to tar before you do the restore.  The
opposite case should work correctly.

Craig

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/