Skip to content

Instantly share code, notes, and snippets.

@tjl2
Created December 21, 2011 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjl2/1506396 to your computer and use it in GitHub Desktop.
Save tjl2/1506396 to your computer and use it in GitHub Desktop.
bind mount

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

mount --bind olddir newdir

or fstab entry is:

/olddir  /newdir  none  bind

After this call the same contents is accessible in two places. One can also remount a single file (on a single file).

This call attaches only (part of) a single filesystem, not possible submounts. The entire file hierarchy including submounts is attached a second place using

mount --rbind olddir newdir

Note that the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment