Doug's Linux Notebook

Accessing files on a windows drive

Some Linux distro's will already have this setup for you, just look for an icon on the desktop or in the menus and try the file manager. If there is no access to the windows drives then read on and I'll go through it step by step.

First we need to create a mount point. This is a directory in the Linux file system that will contain the files of the win drive. Many Linux distro's have a directory named /mnt, or something similar with subdirectories such as floppy, and CDROM. Locate this directory and see if it already contains a subdirectory for your windows files such as win, or Cdrive, or windows, some have /floppy and /CDROM in the root directory so look there to. The directory we use must be empty, if it already contains your windows files then you don't need to go on with the rest of this. If there is no directory to use then we must make one.

[doug@linux]$ su
Password: rootpassword
[root@linux]$ mkdir /mnt/windows
[root@linux]$

The above assumes you have the /mnt directory, to make the windows dir in the root dir the command would be "mkdir /windows".

Next we mount the drive partition that contains the files we want to view. To do this you need to know how Linux addresses the drive and partition in question.

Most windows installations are on the first partition of the primary master drive which Linux calls /dev/hda1, the 1 means the first primary partition on that drive. So in this example the command to mount this partition would be,

[root@linux]$ mount -t vfat -r /dev/hda1 /mnt/windows

The "-t vfat" tells mount what type of file system is on the partition. If it is a Windows 2000 or XP partition then use "-t ntfs". The "-r" is for read only, this is so you can't damage your windows system. If you must write to this partition then leave out the "-r", ntfs partitions should always be mounted read only because Linux dose not properly support writing to ntfs, data loss could result. The "/dev/hda1" is to tell the mount utility what partition we want to mount, and the last part tells mount where to put it in the Linux file system.

Now if you look in the /mnt/windows directory you will find all your windows directories and files.

If you want the Linux system to mount the Windows partition automatically at bootup then ad a line to /etc/fstab something like the following, be sure to use the correct mount point and file system type for your system.

/dev/hda1    /mnt/windows    vfat    defaults,user,ro   0 0

For more details see,

[doug@linux]$ man mount

Update:

I have run into computers where following the above steps will only alow root to access the windows partition and not normal users. To fix this I had to add gid=100,umask=002 to the line for the windows partition in /etc/fstab, it should look something like this.

/dev/hda1    /mnt/win/C    vfat    defaults,ro,gid=100,umask=002    0 0

Back to the Main Page