Monday, September 9, 2019

linux - Hard symbolic link directory


I am taking over control of a server and I have found a directory in two different locations:


/var/www
/home/user.name (i.e., ~/)

that have the exact same inode number:


ls -i
11895253 directory.name

I had thought that hard links on directories were entirely impossible. What is this then? How does a folder exist in two places at once with the exact same contents?


Answer



It's a "bind mount". From the mount man page:



The bind mounts.
Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is



 mount --bind olddir newdir

See also http://backdrift.org/how-to-use-bind-mounts-in-linux and http://backdrift.org/how-to-use-bind-mounts-in-linux.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...