It's a known fact that you cannot create hard links for directories.
My question is whether can one use mount --bind dir1 dir2
instead of creating a hardlink of dir1 to dir2? which can't happen
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityYes, with mount --bind
you can make the same content (especially directories) appear in the file system twice.
For a very comprehensive article about this please see What is a bind mount? on unix.stackexchange.com
Most important points:
chroot
jails.chroot
by providing access to the /proc
, /sys
and /dev
file systems (see mount dev, proc, sys in a chroot environment? on superuser.com)Unlike a hard link or symbolic link, a bind mount doesn't affect what is stored on the filesystem. It's a property of the live system.