On Lu, 28 iul 14, 11:24:31, berenger.mo...@neutralite.org wrote:
> Le 27.07.2014 01:42, PaulNM a écrit :
> 
> >Inodes are files/folders, files/folders are inodes. (1-to-1)  Anything
> >that has a bunch of files/folders will use a bunch of inodes. Same
> >number in fact.
> 
> Hum... is it accurate?
> Files can use more than one inode, with ln

Are you talking about hard links? As far as I understand (but I'm sure 
someone will correct me if I'm wrong) the file itself is always just one 
inode, but there are one or more directory entries (links) pointing to 
it. If you remove all of them the file is deleted.

> Folders can not, AFAIK, since
> symlinks are simply pointers to inodes (which are themselves pointers --with
> reference counter I guess, std::shared_ptr in c++11?-- to data).
> I'm simply asking, I might be completely wrong or inaccurate...

Symbolic links, a.k.a. soft links, a.k.a. "symlinks" are files 
themselves (i.e. each using one inode) that contain a pointer to one of 
the directory entries of another file or directory.

To ilustrate the two explanation see this series of commands:

$ echo 'some text' > testfile
$ ln testfile testhl
$ file testfile
testfile: ASCII text
$ file testhl
testhl: ASCII text
$ rm testfile
$ file testhl
testhl: ASCII text
$ mv testhl testfile
$ ln --symbolic testfile testsl
$ file testfile
testfile: ASCII text
$ file testsl
testsl: symbolic link to `testfile'
$ cat testsl
some text

(this is expected, since 'cat' will follow symbolic links)

$ rm testfile
$ cat testsl
cat: testsl: No such file or directory

(the error message is a bit misleading)

$ file testsl
testsl: broken symbolic link to `testfile'


This should also explain why hard links only work on the same filesystem 
while symbolic links also work across file systems and why you can 
delete a file if and only if you have write permissions for the 
*directory* containing it :)

Kind regards,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
http://nuvreauspam.ro/gpg-transition.txt

Attachment: signature.asc
Description: Digital signature

Reply via email to