Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to "bind" one directory to many chrooted places. I know that I can do "mount -o bind", but this requires special processing on startup each time (run the mount).

Is there a way to do it on the filesystem directly? My fs is ext4 and it seems not to support hardlinks to directories. Hardlinking all files inside is not an option too.

Is thee a way to enable hardlinks to directories in ext4? Or any other options are avilable?

share|improve this question
add comment

2 Answers

Just add lines to your /etc/fstab:

/path/to/source /path/to/bind/mount/point none defaults,bind 0 0

After doing this, the the bind mount will be performed each time the system boots.

share|improve this answer
    
I know this, but I asked for "filesystem way". Is there some? –  PoltoS Apr 23 '12 at 14:39
    
Note, that I've 2000 chrooted folders and I don't want to have 2000 mount records in /etc/fstab. While 2000 hardlinks are not a problem. Or may be 2000 mounts are not a problem for Linux kernel? –  PoltoS Apr 23 '12 at 14:46
add comment

Apart from bizzare exceptions, hardlinks can't be created on directories:

To prevent endless recursion, most modern operating systems don't allow hard links on directories. In addition, hard links on directories would lead to inconsistency on parent directory entries. A notable exception to this is Mac OS X v10.5 (Leopard) and newer, which use hard links on directories for the Time Machine backup mechanism only. Symbolic links and NTFS junction points are generally used instead for this purpose.

This is what symlinks are for.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.