Archive Info

Configuring Ubuntu to Access Windows Files Upon Bootup

So I decided to install Ubuntu on a desktop at my office.  Naturally, I used Wubi to perform the installation, which was startlingly simple and easy.  Wubi allows you to install Ubuntu Linux on your Windows machine without creating a new partition or otherwise screwing up your file system.

The first thing I did after the install was come up with a bash script that allows me to access my Windows files from my Gnome desktop.  I then configured the system to execute the script while booting so I can access the Windows files without having to manually run the script every time I boot.  Here are the details:

I created a file called “winmount” in my Desktop.  Here are the contents of “winmount”:

#! /bin/bash
# script to mount the windows drive
mount -t ntfs /dev/sda3 /mnt/windrive -o "umask=022"

You will want to replace the “sda3″ part with whatever your Ubuntu system calls your Windows drive.  You can find out what your system calls it by running the GNOME Partition Manager.  You will probably have to install it first, then run it using the command in a console window:

sudo gparted

You will see a list of partitions. Look for the largest one; it’s probably your main Windows partition, and will be named something similar to “sda3″.

After you are finished creating your “winmount” file, you should set its execute permission. I think the easiest way to do it is to right click the file’s icon and click Properties, then click the Permissions tab, then put a check in the “Execute” checkbox.

Then, open a console window and execute this command to copy your file to the right location:

sudo cp /home/username/Desktop/winmount /etc/init.d/

Make sure to replace “username” with your user name.

Then, still in the console window, navigate to /etc/init.d by executing this command:

cd /etc/init.d

Finally, still in the console window, tell the system to execute the file at bootup with this command:

sudo update-rc.d winmount defaults

After completing these steps, restart your computer.  Then, navigate to /mnt/windrive .  Your Windows directories and files are available in that directory.  Note that the owner is “root”.

A couple of miscellaneous things I did was make a link to my /mnt/windrive directory on my Desktop, and delete the winmount file from my desktop.

In coming up with this tutorial, I accessed the following sources:

Note: If following this tutorial screws up your computer, it’s not my fault!