BackupPC-users

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

2008-11-10 12:57:26
Subject: Re: [BackupPC-users] Is there any way for BackupPC to restore hard links properly?
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 10 Nov 2008 12:55:33 -0500
Craig Barratt wrote at about 23:06:25 -0800 on Sunday, November 9, 2008:
 > 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.

This also adds an extra wrinkle to the 'delete' script I wrote that is
supposed to allow you to delete individual files (and directories)
from incremental backups.

In order to delete a hardlink, it seems that you need the following
information:

         1. If the file is the target of other hardlinks, then you need to
                find all the other hard links and make another one of them the
                target and restructure the linking accordingly.
     2. If the file is not the target, then if there are at least two
        remaining hard links, you can just delete the file. If there
                is just one remaining link (i.e., just the target), then you
                need to change the target's attrib back to regular file.

Now is there any easy way to find all the hard-links pointing to a
target or would I have to first search all the attrib files for files
of type hard link and then read the corresponding files to see which
targets they are linked to?

Is there a better way or is trying to delete files that are
hard-linked a hopeless task? 
(Since they are rare, I could always just add a check to make sure
that you are not trying to delete a file/directory that is one or a
directory tree that contains hard links).

-------------------------------------------------------------------------
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/