Copying hard-linked tree structure

jw schultz jw at pegasys.ws
Wed Jan 7 21:52:48 GMT 2004


On Wed, Jan 07, 2004 at 03:18:40PM -0600, Max Kipness wrote:
> > > > I have a tree structure on one server similar to the following:
> > > >  
> > > > /Current
> > > > /01-04-2003
> > > > /01-03-2003
> > > >  
> > > > etc...
> > > >  
> > > > /Current holds the most recent rsynced data, and the date 
> > > > directories are created with cp -al on a daily basis so they are 
> > > > hard-linked. I'm going back 60 days.
> > > >  
> > > > The question is how can I move this entire structure to a 
> > new server 
> > > > and preserve the links from the date directories to the /Current 
> > > > directory?
> > > 
> > > Well, I ended up rsyncing the root directory to the new server with 
> > > the -H option and it seemed to work. I have 30 directories 
> > for 30 days 
> > > of rotating backups.
> > > 
> > > However, I had a dir called /Current that had 12Gbs and 
> > then all the 
> > > /date directories had 120mb, 60mb, etc...the daily changes that 
> > > occurred. Well now the directory called /01-01-2004 has 12Gb and 
> > > /Current has like 100mb. I guess /01-01-2004 went first do 
> > to sorting.
> > 
> > It has to do with the tool you are using to measure them.
> > 
> > > Anyway to change /Current back as the real directory? Or 
> > does it even 
> > > matter?
> > 
> > What do you man "real".  With hardlinks all links for an 
> > inode are equal.
> 
> I'm using du --max-depth=1 -h on the root dir.
> 
> The actual file(s) has to be stored in some directory, right? And then
> the hard links point to this directory. Well they are all pointing to
> /01-01-2004 instead of /Current.

Only symlinks point to another directory entry.  All
hardlinks are equal.  The way you are using it du is simply
using the directory order to pick which paths to descend
first.  ls -f should list the directory in the same order
that du does.  On the source system the directory order will
be semi-random if you have been creating and deleting
entries for awhile.  On the destination they will be in
lexical order because that was the creation order by rsync
and you haven't mixed that up yet.

Try this,
	mv 01-01-2004 01-01-2004-a-long-name
	mv 01-01-2004-a-long-name 01-01-2004

Now 01-01-2004 will likely not be the first on the list from
ls -f and another direcotory will likely be held responsible
for the space by du.

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt


More information about the rsync mailing list