[TriLUG] OT: mounting a directory on a different volume

Jeremy Portzer jeremyp at pobox.com
Tue Apr 29 23:06:48 EDT 2003


On Tue, 2003-04-29 at 22:44, Greg Brown wrote:

> I have two disks in my system, one of which contains the home directory 
> and one of which contains my /opt directory.
> 
> df -h output:
> /dev/hda3              7906196   3940416   3564156  53% /
> /dev/hda2               248895     10197    225846   5% /boot
> /dev/hda4             10449900   2686836   7232116  28% /home
> /dev/hdb1             76920416  36622148  36390860  51% /opt
> 
> I would like to mount /opt/backups/g-mac on /home/gwbrown1/g-mac so 
> that anything created in /home/gwbrown1/g-mac to /opt/backup/g-mac

You could do this with bind mounts.
	mount --bind /home/gwbrown1/g-mac /opt/backup/g-mac
[you'll need to make sure the empty directory /opt/backup/g-mac exists
first]

But I agree with Greg Woodbury, symlinks are probably what you really
want.  Bind mounts are still a little esoteric.

One tip about symlinks -- always try to avoid using absolute paths in
the symlink.  This can save you endless hassle later on if you need to
mount your / partition somewhere else, such as /mnt/sysimage as used by
RHL's rescue mode.

For example, have a symlink called g-mac, in the /opt/backup directory,
point to "../../home/gwbrown1/g-mac" .  Don't use the absolutely syntax
of "/home/gwbrown1/g-mac" .

Hope this helps,

Jeremy




More information about the TriLUG mailing list