public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* hardlinks on directories?
@ 2020-01-30 18:16 Ulli Horlacher
  2020-01-30 18:26 ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: Ulli Horlacher @ 2020-01-30 18:16 UTC (permalink / raw)
  To: cygwin

(I am a UNIX senior admin, but have VERY few knowledge on Windows)

UNIX does not support hard links on directories (in opposite to Windows?). 

I found:

/: uname -a
CYGWIN_NT-10.0 W10dev 3.1.2(0.340/5/3) 2019-12-21 15:25 x86_64 Cygwin

/: ls -ldi /bin /usr/bin
281474976929589 drwxr-xr-x+ 1 admin None 0 Jan 29 16:01 /bin
281474976929589 drwxr-xr-x+ 1 admin None 0 Jan 29 16:01 /usr/bin

/: ls -ldi /lib /usr/lib
281474976929595 drwxr-xr-x+ 1 admin None 0 Jun 15  2018 /lib
281474976929595 drwxr-xr-x+ 1 admin None 0 Jun 15  2018 /usr/lib


Are this directory hard links?
Their content seems to be identical.

(How) can I find out with Cygwin which directories are hard links?
I could run "find / -xdev -type d -printf "%i %p\n" and look for same
inodes. 
Is there a better methode?

/: find / -xdev -type d -printf "%i %p\n" | perl -wne 'push @{$i{$1}},$2 if /^(\d+) (.+)/; END { foreach $n (keys %i) { @f = @{$i{$n}}; print "$n: @f\n" if scalar(@f) > 1} }' | sort -n | head
2: /proc /cygdrive
281474976929589: /bin /usr/bin
281474976929595: /lib /usr/lib
281474976935384: /lib/pkcs11 /usr/lib/pkcs11
281474976935494: /lib/gawk /usr/lib/gawk
281474976938256: /lib/groff /usr/lib/groff
281474976939240: /lib/security /usr/lib/security
281474976939616: /lib/engines-1.1 /usr/lib/engines-1.1
281474976939876: /lib/sasl2_3 /usr/lib/sasl2_3
281474976940081: /lib/p7zip /usr/lib/p7zip

Not so good... too much hits: 
"/lib/pkcs11 /usr/lib/pkcs11" are already in "/lib /usr/lib"


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<20200130181516.GA29782@tik.uni-stuttgart.de>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: hardlinks on directories?
  2020-01-30 18:16 hardlinks on directories? Ulli Horlacher
@ 2020-01-30 18:26 ` Eric Blake
  2020-01-31 10:18   ` Ulli Horlacher
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2020-01-30 18:26 UTC (permalink / raw)
  To: cygwin, framstag

On 1/30/20 12:15 PM, Ulli Horlacher wrote:
> (I am a UNIX senior admin, but have VERY few knowledge on Windows)
> 
> UNIX does not support hard links on directories (in opposite to Windows?).

Windows does not either.

> 
> Are this directory hard links?

No, rather they are parallel mount points (the same directory mounted 
under two different names).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: hardlinks on directories?
  2020-01-30 18:26 ` Eric Blake
@ 2020-01-31 10:18   ` Ulli Horlacher
  2020-01-31 14:59     ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Ulli Horlacher @ 2020-01-31 10:18 UTC (permalink / raw)
  To: Eric Blake; +Cc: cygwin

On Thu 2020-01-30 (12:26), Eric Blake wrote:

> > Are this directory hard links?
> 
> No, rather they are parallel mount points (the same directory mounted 
> under two different names).

/: mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

That's it! Thanks!

But why does Cygwin mount the directories /usr/bin and /usr/lib extra?
Why not a symbolic link?
And which process does this mounting?


-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<f0e439a1-652d-ad83-54c3-87c6661df8f7@redhat.com>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: hardlinks on directories?
  2020-01-31 10:18   ` Ulli Horlacher
@ 2020-01-31 14:59     ` Brian Inglis
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2020-01-31 14:59 UTC (permalink / raw)
  To: cygwin

On 2020-01-31 03:17, Ulli Horlacher wrote:
> On Thu 2020-01-30 (12:26), Eric Blake wrote:
> 
>>> Are this directory hard links?
>>
>> No, rather they are parallel mount points (the same directory mounted 
>> under two different names).
> 
> /: mount
> C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
> C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
> C:/cygwin64 on / type ntfs (binary,auto)
> C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> 
> That's it! Thanks!
> 
> But why does Cygwin mount the directories /usr/bin and /usr/lib extra?

$ cmd /c dir `cygpath -aw /usr`
...
2020-01-30  17:51    <DIR>          include
2020-01-19  13:55    <DIR>          libexec
2019-09-29  13:38    <DIR>          local
2020-01-19  13:55    <DIR>          sbin
2020-01-19  13:56    <DIR>          share
2016-10-25  14:43    <DIR>          src
2019-12-18  11:07    <DIR>          tmp
...

No /usr/bin nor /usr/lib.

> Why not a symbolic link?

Mounts ensure the paths exist and are identical to /bin /lib.

> And which process does this mounting?

Every Cygwin process at startup performs those mounts and any alternatives in
/etc/fstab and /etc/fstab.d/*, see "Cygwin User's Guide", Chapter 3. Using
Cygwin, /The Cygwin Mount Table/:

	http://cygwin.com/cygwin-ug-net/using.html#mount-table

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-31 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 18:16 hardlinks on directories? Ulli Horlacher
2020-01-30 18:26 ` Eric Blake
2020-01-31 10:18   ` Ulli Horlacher
2020-01-31 14:59     ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).