Just a thought

Mounting windows drives in Ubuntu

Posted by stringofthoughts on May 1, 2009

How to 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 very easy. You just need to click on the drive and it’s mounted 🙂 pretty easy huh. I bet windows fans coming to Linux would love it. Despite all this sometime you might need to mount manually. FAT32 drives mount flawlessly all the time but NTFS drives gives error if it’s a dual boot machine which powered off or reboot to Linux in the middle of either windows start up or windows shutdown.

Couple of things you need to know when you mount manually on ubuntu. There is default mount folder in ubuntu /media. /mnt is another one usually used for manual mounting. There is not rule about using /mnt only for manual mount you can mount anywhere. Make a folder /win_drives or /home/user/win_drives anywhere you want you can mount. The catch here is with the nice click mount/umount utility provided by ubuntu. If you mount a drive manually it can be unmounted only manually. If you mount your drives anywhere other than /media like in /mnt or /win_drives it won’t show up in places column in file manager.  Although it show up in places if your mount point is in your home directory.

So the smart way to mount a drive would be to keep it on places in file manager and keep the click mount/umount working on manually mounted drives.  So there are two things you need to do. Mount a drive and update /media/.hal-mtab (entry in this file allows you to use click mount/umount utility )

We are gonna use /dev/sda1 as drive and /media/drive as mount point

Mount Fat32 drives

$ sudo mount -t vfat /dev/sda1 /media/drive -o defaults

Now update /media/.hal-mtab

$ sudo echo “/dev/sda1    1000    0    vfat    nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,exec,flush    /media/drive” >> /media/.hal-mtab

Mounting NTFS drives

$ sudo mount -t ntfs-3g /dev/sda1 /media/.hal-mtab

Now update /media/.hal-mtab

$ sudo echo “$i    1000    0    ntfs-3g    nosuid,nodev,uhelper=hal,locale=en_IN,exec    /media/”$myLabel”” >> /media/.hal-mtab

If you simple wanna mount drive and don’t care about click mount/umount then

$ sudo mount -t vfat /dev/sda1 /media/win_drive

$ sudo mount -t ntfs-3g /dev/sda1 /media/win_drive


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: