Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been looking for a way to mount the same drive (e.g. /dev/sdd1) in two places on a hard drive. If I try using the command that I use to mount a drive in the first location again, I recieve the error:

"Mount is denied because the NTFS drive is already exclusively opened."

I've also tried binding the mount point, but obviously if the main location becomes unmounted, the binded folder becomes in accessible.

Are there any other commands I can try?

share|improve this question

migrated from stackoverflow.com Nov 17 '11 at 14:32

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 2 down vote accepted

The only way I can see of solving this problem (the "what happens if it got unmounted?" part in particular) is to use automount and symlinks, as suggested in Gustav's answer:

ln -s /mnt/original /home/max/newlink

The trick though would be to make /mnt and in particular /mnt/original be covered by an automount map, your distribution should provide a package for this, you'll need something like the following in /etc/auto.master:

/mnt    /etc/auto.mnt

and then in /etc/auto.mnt:

original        -fstype=ntfs    /dev/sdd1

In this way accessing /mnt/original will cause /dev/sdd1 to be mounted appropriately, but "looking through" the symlink will also cause it to be mounted if not already mounted for any reason.

(One more thing - if you happen to export this through samba too, you'll need to use preexec to make samba believe it existed. I was "the chatty friend" in this blog post)

share|improve this answer

You can make a symbolic link to the second place from the first mount:

ln -s /mnt/original /home/max/newlink
share|improve this answer
2  
That doesn't solve the (unsolvable) "if the main location becomes unmounted..." problem –  Flexo Nov 17 '11 at 14:33
    
So... my solution doesn't solve an unsolvable problem. A conundrum wrapped in a mystery indeed. –  Gustav Bertram Nov 17 '11 at 14:36
    
I appreciate the answer, regardless. I wasn't aware if this was an unsolveable issue or not. Thanks! –  Max Nov 17 '11 at 14:38
    
@GustavBertram - a comment acknowledging that would be appropriate. (The other possible solution would be to use automount on the original mount point to ensure it gets re-mounted if it has been unmounted) –  Flexo Nov 17 '11 at 14:40
    
@awoodland Post an answer, post an answer! (I had no idea it was unsolvable. Taking your word for it. Explication required for teh vote uppedness!) –  Gustav Bertram Nov 17 '11 at 14:44

With Linux bind mounts, there is no such thing as "main location". Both mounts are equal; if one is unmounted, the other will remain.

mount --bind /mnt/original /home/max/newlink

(For fstab, use /mnt/original /home/max/newlink none bind.)

share|improve this answer
    
Yes, I did test this, with vfat and ntfs-3g on Linux 3.2.0-rc1, and it works. –  grawity Nov 21 '11 at 13:30

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.