Re: du

[prev] [thread] [next] [lurker] [Date index for 2005/09/30]

From: Dave Vandervies
Subject: Re: du
Date: 20:20 on 30 Sep 2005
Somebody claiming to be Nicholas Clark wrote:
> 
> On Fri, Sep 30, 2005 at 01:36:05PM -0500, Luke Kanies wrote:
> 
> > They're hard links (you'll have to look that one up).  A little known
> > aspect of the output of ls -al is that it lists the number of hard links
> > to a file, and directories (almost) always have >=2, because one is the
> 
> I realise that this is off topic for hating (and I will be hated by some
> for this) but when doesn't a directory have a hard link count >= 2?
> [on a filing system that doesn't cause all directories to report a link count
>  of 1, as I believe is the case for most Unix mounted CDs]
> 
> .. of / is a link to itself, so it is always >= 2, and that's the obvious one
> covered.

When the last filesystem link to it is gone but it hasn't gone away
because some process is still using it:
--------
dave@hct-cvs:~ (0) $ mkdir foo
dave@hct-cvs:~ (0) $ cd foo
dave@hct-cvs:~/foo (0) $ ls -ld .
drwxr-xr-x   2 dave     users        4096 Sep 30 15:15 ./
dave@hct-cvs:~/foo (0) $ echo 'rmdir foo just happened from ~ in another shell'
rmdir foo just happened from ~ in another shell
dave@hct-cvs:~/foo (0) $ ls -ld .
drwxr-xr-x   0 dave     users           0 Sep 30 15:15 ./
dave@hct-cvs:~/foo (0) $ 
--------

ObHate:  Filesystems that can't handle use-counting like this and don't
let you do anything with a file or directory that some other process
(not easily identified, usually) has open.


dave

-- 
Dave Vandervies
dj3vande@xxxxxx.xxx

Plan your future!  Make God laugh!
There's stuff above here

Generated at 16:00 on 04 Oct 2005 by mariachi 0.52