1

/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?

Strawberry
  • 1,112
  • 4
  • 15
  • 27

2 Answers2

5

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.

Kyle Smith
  • 9,563
  • 1
  • 30
  • 32
2

What you want to do is a symbolic link:

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

See man ls.

Sven
  • 97,248
  • 13
  • 177
  • 225
  • I cannot make changes to a mount? – Strawberry 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. – Sven Feb 26 '12 at 23:53