Just a thought

Archive for April 16th, 2009

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 .

Posted in Linux, tips 'n tricks | 5 Comments »

Adding / Removing Shell scripts (Ubuntu 8.10)

Posted by stringofthoughts on April 16, 2009

I’ve been trying to add a auto mount script to mount all my window drives at startup. After searching for a while and testing few test scripts I finally found out how to add scripts at startup and how to remove scripts.

Adding a script

First of all write a script :) , say test.sh and put it in the directory /etc/init.d . Next we need to make it executable so.

$ sudo chmod +x test.sh

You can check if the script is working by issuing

$ sudo ./test.sh

Assuming the script is working as expected, to make the script run at startup / reboot.

$ sudo update-rc.d -f test.sh start 99 2 3 4 5 . // Run at startup

$ sudo update-rc.d -f test.sh start 1 0 6 . // Run at reboot

Just a reminder there is dot (.) at the end of command.  Don’t forget that :) . Now you are done adding a script to run at startup.

Removing a script.

Just a reminder for new users, don’t just go to /etc/init.d and delete the script file :) that wouldn’t help and may cause you trouble. We need a nice little app called rcconf ( Debian runlevel configurtion tool)

$ sudo apt-get install rcconf

then run rcconf (only root can run rcconf)

$ sudo rcconf

rcconf1The inteface is very simple. It lists the scripts so all you need to do is find out where is your script and toggle “*” using space bar  and then select OK. That’s all. The script is now removed but still present in the directory /etc/init.d but you can safely delete it now.

Posted in Linux, tips 'n tricks | 7 Comments »