Welcome! Log In Create A New Profile

Advanced

Automounting Questions

Posted by huhwhatwhome 
huhwhatwhome
Automounting Questions
July 04, 2011 10:42AM
Hello,

I'm trying to setup my dockstar where I can disconnect/reconnect and power off/power on hard drives without having to type in commands to remount them. Can someone let me know the best procedure to do this. I have not had much success with autofs.

Right now, I have my fstab for my external hard drive looks like the following:

UUID="XXXXXX" /mnt/test ntfs rw,auto 0 0

I can boot up the dockstar and this drive gets assigned /dev/sdb1 and automatically gets mounted to /mnt/test which is great. My problem is when I power off this HD and reconnect it. The drives gets assigned /dev/sdc1 and I have to ssh from putty and manually mount it using "mount /dev/sdc1 /mnt/test". Then if I power off again and repower, it gets /dev/sdd1, sdde1...etc and the df -h is full of /dev/sdx and mount points.

Any ideas of how to keep the HD at /dev/sdb1 and automounted to /mnt/test?

Thanks.
HWWM
Re: Automounting Questions
July 04, 2011 11:48AM
I went through all these gyrations a while back, and detailed the process in this thread.

http://forum.doozan.com/read.php?2,3910

Jump to the second page, and look for a message from me that says "Done!" at the top. It has everything you need. I've not changed anything in my setup since then.

To summarize the thread, I create a udev rule to auto-mount any hot-plug'ed usb storage devices using pmount. This then left the issue of mounting any file systems at start-up, which I addressed with a simple script that used pmount.

(Pmount is sort of a wrapper around mount. It handles the creation and removal of mount points on the fly. And it handles error conditions. The biggest annoyance is that pmount's auto option just tries to mount the file system using a pre-determined list of file system types until it finds one that works. This is why I later added a command to use blkid to capture the type.)
huhwhatwhome
Re: Automounting Questions
July 16, 2011 09:41AM
Thanks a bunch. This works perfectly! I really thought there'd be a easier way to accomplish this.

-HWWM
Re: Automounting Questions
July 16, 2011 12:18PM
Heh, you're welcome. To your comment, all the major Linux distro's include auto mounting functionality but it's built on top of a full desktop environment. And there are some smaller foot print simple server based tools which do most of this already (usbmount for instance) but they all seemed to have something I didn't like. In the end, I decided to piece it to together myself so that it worked exactly like I wanted. And I'm glad it's come in handy for a few others as well.

The most difficult part is knowing what bits you can use to build on top of so you don't have to go and entirely re-invent the wheel. For any particular task, there's usually lots and lots of open source software that you can use to build on. Then it's a matter of finding one that does most of what you need and hack together the rest :)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: