Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am having some issue after adding users i am able to access my ftp fine, but while i am trying to mount a shared folder following error: command i am using is

sudo mount --bind /newhd/shareddocs /home/foc

Error is:

mount: special device /newhd/shareddocs does not exist

and the result of mount command is

$ sudo mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sdb1 on /media/NEWHD type ext4 (rw)
gvfs-fuse-daemon on /home/itpchr/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=itpchr)

Here are the contents of /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=534bc4e4-868c-4c7c-a026-66338953bd46 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=8b4fed1f-8b32-4b90-9c50-0d4b21b0ebfb none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

/dev/sdb1 /media/NEWHD ext4

Please tell me the exact command to mount a shared folder on NEWHD to foc user directory.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

I think there are many things you could do better in your configuration, such as using either UUID or disk labels instead of the /dev/sdxx notation (since that can change).

But the main problem seems to be that you are specifying /newhd/shareddocs in the problem command, but the actual mount point is /media/newhd/shareddocs.

EDIT1

If you want to mount a subdirectory of the partition /dev/sdb1, then you would need to first mount the partition, and then mount the directory within that partition, I think. I normally just use sharing, but I believe you would do it this way if using fstab:

/dev/sdb1 /media/NEWHD ext4
/media/NEWHD/shareddocs /home/foc

Or, if you don't want to edit fstab, you can use mount without --bind sudo mount /newhd/shareddocs /home/foc

EDIT2 Personally, I have no experience with the bind option - I normally just use symbolic links, which work fine for what I have needed. Not there are good reasons for using bind, and it is a good way to mirror a directory structure without creating a special file that may not work in all situations.

So, there are a couple of tricks that might help, although I think the solution is simply to add "bind" as an option in /etc/fstab.

There is another file similar to fstab in the same directory, named /etc/mtab; this file shows all the current mounts, whether done via the mount command or via the fstab file. So, you can look at this file (cat /etc/mtab, or use gedit), and copy the line that is working into /etc/fstab. I believe you will find that the line is /media/NEWHD/SharedDOCS /home/foc none rw,bind 0 0.

The other trick is useful whenever you are making changes to /etc/fstab. After you make a change, save the changed file but don't close it yet. Then, go to the terminal and enter sudo mount -a - This will mount everything in fstab, and if there are any errors, it will tell you about them now, rather than possibly finding out at boot time. Depending on circumstances, you may need to unmount first if there was an error, then remount using this command.

share|improve this answer
    
I have already tried this but it gives me following message –  Naveed Akhter Sep 5 '13 at 2:46
    
@ Marty Fried thanks for your reply I have already tried this but it gives me following message Mount: Special device /media/newhd/sahreddocs does not exists what should i do any suggestion. –  Naveed Akhter Sep 5 '13 at 2:53
    
Sorry, I missed something. You have /media/newhd mounted, not /media/newhd/shareddocs. To use --bind, you need to specify an existing mount, but it does not exist, hence the error. You need to mount the directory, without using --bind. See my edits above. –  Marty Fried Sep 5 '13 at 17:25
    
Thanks for pointing me in right direction, i used the following command to mount the partition sudo mount \dev\sdb1 \Home\foc it temporary mount the partition but now my questions are 1. How to mount it permanently 2. i want to mount only one folder which is shareddocs. –  Naveed Akhter Sep 7 '13 at 3:50
    
Did you notice my edit to the original answer? The way to make it "permanent" is to edit /etc/fstab, using sudo since it is in a directory that you don't have write permission. If using gedit, then in a terminal type sudo gedit /etc/fstab. If you are unsure of yourself, make a copy first (sudo cp /etc/fstab /etc/fstab.bak –  Marty Fried Sep 7 '13 at 4:20
show 5 more comments

I think you have to run this command:

mount --bind /media/NEWHD /home/foc

Maybe this will fix the problem.

share|improve this answer
    
His question wasn't very clear, but your solution is not what he wants. He wants a subdirectory to be mounted, not the entire partition. –  Marty Fried Sep 5 '13 at 17:32
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.