Just a thought

Auto mount windows drives at startup (Ubuntu 8.10)

Posted by stringofthoughts on April 16, 2009

I have been trying to do auto mount of drives at start up but in ubuntu there is a lot of problems in mounting drives from command line. It works by all means but there is so many problems like mounting drives in /mnt directory. When your mount point is in /mnt ( or any other directory in / like /windows) mounted drives disappears from the side bar.

The other thing that i wanted was to retain the nice right click unmount facility available in ubuntu. But when the drives are mounted from command line then right click -> unmount doesn’t work.

This really helps if the mount point is same as the label of the drive. It helps in understanding where are the files are like if you have a drive labeled “Movies” you would like a mount point like /mnt/Movies or /media/Movies but if there are many drives then making all these mount points is really tiresome.

The script I ‘ve written does everything for you and it also retain the nice right click facility provided by ubuntu.

Download the script from here mount_win_drives . ( This script is only tested on Ubuntu 8.10.  Download link for new version is at the end of the post )

It’s a doc file so make a file “mount_win_drives.sh” and copy paste the content of doc file in it and save it. Now your script file is ready. Do the following steps.

1) copy mount_win_drives.sh to /etc/init.d

$ sudo chmod +x mount_win_drives.sh

Before updating the runlevel just run the script to check it’s working alright. You might see error msgs if the drives are already mounted.

$ sudo ./mount_win_drives.sh

If it’s working, update the runlevel to make it work at startup.

$ sudo update-rc.d -f mount_win_drives.sh start 99 2 3 4 5 .

That’s all. The next time you’ll boot your drives will be already mounted and ready to use and the right click utility of gnome-mount / gnome-unmout t is also working perfectly .

Have fun 🙂

I’ve modified the existing script to work with any debian based linux distro. The older version was only tested in Ubuntu 8.10.

Download the new script from here mount_win_drives_new .

Advertisements

6 Responses to “Auto mount windows drives at startup (Ubuntu 8.10)”

  1. […] mount windows drives in ubuntu is still a major issue for new user. I’ve written a script to auto mount drives at startup. No need for you to go change fstab and get confused . Ubuntu has made mounting drives […]

  2. Oz said

    Thanks, this was useful, but it doesn’t work in Ubuntu 9.04 because udevinfo doesn’t exist anymore. I updated the code to work, by changing udevinfo to udevadm info and


    if (test $drives = 25) then

    to

    if (test $drives = 35) then

    Because it seems udevadm info gives out a few more lines, but it still works the same.

    I also put it on pastebin here in case someone else with 9.04 happens to find it.

  3. Oz said

    Here’s the link again, seems it got messed up earlier: http://pastebin.com/f5651e694

    • stringofthoughts said

      thanks oz

      I switched to debian and haven’t tried Ubuntu 9.04 yet. I’ll also update my link for 9.04.

      Thanks again 🙂

      • Oz said

        No problem, hope it helps someone. 🙂 And just in case it matters, I’m running a 32-bit version of Ubuntu at the moment, because they sent me a 32-bit version instead of 64 when I ordered the free CD. :/

  4. Oz said

    Hello, Oz here again!
    Ubuntu 9.10 broke your script once more (one more line of output from udevadm), and I finally decided to do something about it, got tired of mounting drives manually again. 😛 Got so used to having your script.

    Here’s the fixed version that works with 9.10 (and hopefully a few future releases of Ubuntu at least): http://pastebin.com/f346624e0

    I also noticed you had an updated all-Debian-distros version, but it won’t work with Ubuntu as udevinfo was removed after 8.10. :/ We have to use udevadm info instead, which returns slightly different results.
    Either way, my fix is here for any one who might need it for Ubuntu 9.04 and 9.10, and your version for other Debian based distros with udevinfo still intact. 🙂
    You may want to put my no-label disk code in your Debian script, I have a few unlabeled disks that I don’t want to label, and others may not realize their disks need to be labeled.

    Also /media/.hal-mtab is no longer required for the sidebar drives to show up as mounted (or for unmounting from there) in Nautilus as of 9.10 (I think); so – if that’s the case – this fixed script may no longer work for 9.04 but the one in my above post will still work for people still using 9.04.

    Anyway, thanks once more for the script and happy new year! 🙂
    – Oz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: