re-linking hard links
Daniel Davidson
danield at igb.uiuc.edu
Thu Apr 27 17:27:30 UTC 2006
Nope, I am only using one drive (with a single ext3 filesystem on it).
I know I can do a find -inum, but I was wondering if there was something
more efficient.
I am actually using an md5 checksum to find duplicate files, but then I
need to hunt down all their hard links.
Dan
On Thu, 2006-04-27 at 01:46 +0200, Herta Van den Eynde wrote:
> Daniel Davidson wrote:
> > Hello,
> >
> > I have a situation where I have numerous files with numerous hard links
> > to each of them on an ext3 RHEL4.2 system. Some of these files are
> > duplicates of the others. I would like to re-link all of the
> > duplicates to point to a single inode.
> > For instance if file1 has
> > hardlinks link1 and link2, and file2 has hardlinks link3 and link4, I
> > need to change it so that link1, link2 (these two are already correct),
> > file2, link3, and link4 are all hardinks to file1. The only
> > information I have to start with are the inode numbers of file1 and
> > file2 and the pathnames of file1 and file2.
>
> Not sure I understand properly. It looks as though you want to compare
> every file on a given filesystem with every other file on that
> filesystem, and if they are duplicates, replace one of the actual files
> with a hard link to the other file.
>
> > Any ideas beyond searching all of the filenames on the system and
> > replacing them with the proper link?
>
> Remember that hardlinks cannot cross filesystem borders.
>
> > That takes a long time.
>
> I suppose you could write a script that cksums all files on the
> filesystem, sorts the output, and verifies that two files with the same
> cksum are actually the same. If they are, it could ask whether it's OK
> to overwrite one of the files with a hardlink to the other. And yes,
> depending on the size of your filesystem, that would take time.
>
> Kind regards,
>
> Herta
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the Ext3-users
mailing list