1

Possible Duplicate:
Why does '/' have an '..' entry?

I understand that in the filesystem hierarchy starting with / as top-level directory, under which all the other sub directories or files are stored. In each subdirectory, we see two special directories referred as . and .. which are special because they are hardlinks pointing to the current directory inode and the parent directory inode respectively. They are common for every sub directory in the filesystem. However, when I look at /, those two special directories behaviour changes. They refer to the / again.

For example:

[root@centos /]# pwd
/
[root@centos /]# ls -ldi . ..
2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 .
2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 ..
[root@centos /]# cd root
[root@centos ~]# ls -ldi . ..
195265 drwxr-x--- 10 root root 4096 Dec  3 20:33 .
     2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 ..
[root@centos ~]# 

I want to understand what part of the filesystem controls this? But how is this done in detail. Can someone please explain this behaviour? (Let me guess, this is part of the kernel's filesystem management routines). I have my own theory about this but would like to listen more from the experts here.

Cheers.

  • I don't have an answer for your questions, it just makes sense... – phunehehe Dec 03 '11 at 15:29
  • thanks for the link rozcietrzewiacz .. I was searching for the same while I was putting down to ask. The more specific thing I was looking for is, kernel need not bother once it is set, .. under . is actually logical and kernel sets /.. pointing to the same /, most likely at the boot time while mounting the root partition from the root disk and is not really under the hood of the filesystem of the disk. – Nikhil Mulley Dec 03 '11 at 18:35

0 Answers0