[Dirvish] Moving a Dirvish Vault

Paul Slootman paul at debian.org
Fri Jun 2 08:41:34 UTC 2006


On Thu 01 Jun 2006, Steve Ramage wrote:
> 
> Hmmm okay rsync will do hard links, by not being detectable, I meant
> that if file a is hard linked to file b, it just looks like a file, no
> special attributes, and no real way to tell that file a and file b are
> related.

Use ls -i which will show the inode number. The inode number is the same
for file a and file b; in fact, the file *is* the inode basically, the
filenames you see in a directory are simply links to the inode. As soon
as the last link to an inode is removed, the OS removes the file (unless
it's opened by some process, although that could be considered a link as
well).  This is assuming of course that both a and b are on the same
filesystem, as inode numbers are only unique on a single filesystem.

> The rm thing I have noticed a few times, not really with dirvish, but I
> have a cron job on a server that wget's the slashdot.rss every 5
> minutes, and parses it, but it broke about a year or two ago. When I
> tried to delete the files, I got an error: 'rm: too many arguements',
> I've seen it before too, but oh well.

That's because the argument list is passed in the environment, and space
for that is limited.  A better way is to use find and xargs:

find -maxdepth 1 ! -type d -print0 | xargs -0 --no-run-if-empty rm

xargs takes care of not passing too many arguments to rm at one time.

Of course, if you're OK with blowing away the whole directory, do
"rm -rf dir" which lets rm do the work of finding which files are in
that dir and removing them one by one.

> > Well, Jason Boxman is lazy, so he just uses `rsync -avH src/ target/`  :)

That doesn't work if your src is very large with many hardlinked files;
rsync runs out of virtual memory, I can say from experience.


Paul Slootman


More information about the Dirvish mailing list