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.

/etc/fstab

/srv/www/test.com  /home/user/test.com auto nouser,auto,rw,sync 0 0

I am getting the following error: mount: you must specify the filesystem type. Could someone please give me some insight? I am trying to mount a directoryA into directoryB and allow any changes (add new files, edit files). Also, if I make changes to a file in the mount, it would automatically change the original right?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

mount attaches a device node (physical disk, remote nfs mount, etc.) to a directory. What you're trying to do is map one directory to another directory. There are a few ways to handle this.

The most common is called a symbolic link. It essentially creates a filesystem entry that redirects to another location within the filesystem. If you simply want user to be able to access the document root of test.com from inside his home directory, this is the most simple approach.

Alternatively, you can use the bind mount type. You must be sure that the target directory exists before you use this type, or you won't get the results you're expecting. This can be done at the commandline with:

mount --bind /src/www/test.com /home/user/test.com

If you want to add it to the /etc/fstab file, it would look like:

/srv/www/test.com  /home/user/test.com bind defaults,bind 0 0

However, I'd carefully consider why a symbolic link isn't sufficient before dealing with bind mounts.

share|improve this answer
    
It's because I chroot them to the home. –  Doug Feb 27 '12 at 0:24
    
That's a valid reason to use a bind mount in my book :-) –  Kyle Smith Feb 27 '12 at 0:28
1  
Take great care when removing a chroot tree. rm -rf will descend into a bind mount. –  Simon Richter Feb 27 '12 at 7:54
add comment

What you want to do is a symbolic link:

ln -s /srv/www/test.com  /home/user/test.com 

See man ls.

share|improve this answer
    
I cannot make changes to a mount? –  Doug Feb 26 '12 at 23:46
    
You cannot mount a directory, just a complete file system, so the whole line in /etc/fstab doesn't make any sense. ln is the way to do what you want. Just try it. –  SvW Feb 26 '12 at 23:53
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.