Search:  
Gentoo Wiki

TIP_Bind_A_Directory_In_FSTAB

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Mounting directories

Normally, when using the mount command, you are mounting partitions to a directory on the filesystem. For example, you will mount /dev/hda2 to /home.

You can also mount existing directories on the filesystem to another directory, making the files available in two locations. This can be useful when programs cannot follow symlinks, such as FTP servers in certain (secure) configurations.

The syntax for binding a directory is:

mount --bind existing_location new_location

A concrete example is:

mount --bind /usr/portage/distfiles /home/ftp/distfiles

After running this command, the contents of /usr/portage/distfiles/ will also be available under /home/ftp/distfiles/

That's easy enough to do, but if you want to have this occur automatically during system startup, you have two options:

  1. put the above command in /etc/conf.d/local.start OR
  2. add an entry to /etc/fstab, such as:
File: /etc/fstab
/usr/portage/distfiles /home/ftp/distfiles none bind

Add that line, then run mount -a to have it take effect immediately (rather than waiting for the next reboot).

Feedback

Concerns or Compliments? Please use the Discussion section.

Retrieved from "http://www.gentoo-wiki.info/TIP_Bind_A_Directory_In_FSTAB"

Last modified: Fri, 05 Sep 2008 22:08:00 +0000 Hits: 8,457