Thursday, 24 September 2009

Accessing a Windows Partition from Linux

You can access another partition on your system (for example, a Windows partition), in two different ways.

You should first determine where your Windows partition is located by determining what physical hard disk your Windows partition is located in (such as the primary master IDE drive or the the first SCSI drive). To find this information, you can use the Hardware Browser, which lists detailed information about the hardware in your Red Hat Linux system.

To start the Hardware Browser, choose Main Menu => System Tools => Hardware Browser. Figure 16-1 shows Hardware Browser in action.

Select Hard Drives from the panel and find your Windows partition from the Disk Information displayed. Windows partitions normally use the FAT or FAT32 file system type. This file system type can be mounted and read within Linux; however, if your Windows partition uses NTFS, then you cannot mount and read from it as Red Hat Linux does not support NTFS file systems. Note the Device information for your Windows partition, as this is the device that you mount to access your Windows data.

Once you have determined where your Windows partition is located on your hard drive, log in as root (type su and then enter the root password) at a shell prompt.

Create a directory in which the Windows partition will be mounted by typing the following command. For example:

mkdir /mnt/windows

Before you can access the partition, you will need to mount it in the directory you just created. As root, type the following command at a shell prompt (where /dev/hda1 is the Windows partition you found via Hardware Browser):

mount -t vfat /dev/hda1 /mnt/windows

You may then logout of root user mode and access your Windows data by changing into the mounted Windows partition:

cd /mnt/windows

To automatically mount a Windows partition every time you boot your Red Hat Linux system, you must modify the /etc/fstab file, which configures all file systems and disk device mounting options.

At a shell prompt, su to root, following the above example.

Next, open the /etc/fstab in a text editor by typing (for example):

gedit /etc/fstab

Add the following on a new line (replacing /dev/hda1 with the Windows partition you found via Hardware Browser):

/dev/hda1 /mnt/windows vfat auto,umask=0 0 0

If partton is ntfs

mount -t ntfs -onls=utf8,umask=0222 /dev/hda1 /media/windows

Save the file and exit your text editor.

The next time the system is rebooted, the /etc/fstab file is read, and the Windows partition is automatically mounted in the directory /mnt/windows. To access the partition at a shell prompt, type the command cd /mnt/windows. To navigate through directories or files with spaces, surround the name of the directory or file with quotation marks, as in ls "Program Files".

No comments:

Post a Comment