LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] odd linking

[ILUG] odd linking

Niall niall at magicgoeshere.com
Sun May 14 00:31:38 IST 2000


On Sat, May 13, 2000 at 09:33:57PM +0100, David Meagher wrote:

> this evening i was trying to link two directories on two different
> harddrives
> 
> i tried
> ll -D /dir1 /mnt/DOS-hdb1/dir2
> and
> ll -F /dir1 /mnt/DOS-hdb1/dir2
> 
> it either gave me a
> you can't hard link these two directories
> or
> won't connect directories on different devices

Hmm - I don't know what command ll is but I'll proceed on the assumption
that it's some kind of alias for ln or that you mis-typed it :-)

It's not possible to make a hard link between two directories (or files, for
that matter) which are on different drives. To make a hard link to a file
(or directory, which is only a special kind of file) means to make another
directory entry pointing to the same inode as the file to which you are
linking. Recall that an inode is a structure which is part of a filesystem,
and it should be obvious that a directory entry on filesystem A can't
physically point to an inode on filesystem B, whether these filesystems be
on different drives or not. From the info page for ln

   A "hard link" is another name for an existing file; the link and the
original are indistinguishable.  Technically speaking, they share the same
inode, and the inode contains all the information about a file--indeed, it
is not incorrect to say that the inode _is_ the file.

You can do what you want with a symbolic link (ln -s) which is a text based
re-direction. It's fractionally slower in use than a hard link (not that
you'll notice), but works across disks.


Interesting aside - I do remember reading that ln on Linux won't make hard
links to directories except for the super-user, because there is serious
potential for filesystem confusion and the man page seems to concur where it
says 

-d, -F, --directory
        hard link directories (super-user only)
	

However, the info page says 

On all existing implementations, you cannot make a hard link to a directory,

and this seems to be true, at least on the two boxes I tried (SuSE 6.3 /
2.2.13, Mandrake 5.3 / 2.2.12)

Did any version of ln on Linux ever support hard linking directories ? (I
know I've done this on Solaris - can't remember why, but I'm sure I had a
good reason :-) )


Regards,


Niall




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell