Sunday, July 29, 2012

Accessing the Windows Partition from CentOS 6

When running CentOS 6 in a dual boot configuration it is still possible to access files located on the Windows partition. This can be achieved by manually mounting the partition from the command-line. Before doing so, however, some additional packages need to be installed on the system. To do so, run the following commands inside a terminal window: 

su -
yum install fuse

Next, we need to set up access to the Dag RPMForge repositories:

For 32-bit systems:
rpm -Uhv

For 64-bit systems:
rpm –Uhv

Next, install the NTFS driver:

yum install fuse-ntfs-3g

Once the requisite packages are installed, the next step is to create a directory to use as the mount point for our Windows partition. In this example we will create a directory called /windows:

mkdir /windows

When prompted for a password by the su command, enter the root password specified during the CentOS 6 installation process. In order to identify the device name that has been assigned to the Windows partition, use the fdisk command as follows:

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x86008600

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1276    10249438+   7  HPFS/NTFS
/dev/sda2            1277        1340      512000   83  Linux
/dev/sda3            1340        2611    10209280   8e  Linux LVM

In the above output, the main Windows partition containing the files we need access to is /dev/sda1.

Next, we need to run the mount command (still with root privileges and assuming the Windows partition is /dev/sda1 and NTFS format - this may be different on your system):

mount –t ntfs-3g /dev/sda1 /windows

Under some circumstances you may get a message that the Windows partition needs to be checked. If so, either reboot into Windows again and manually run chkdsk (if it does not run automatically during the boot process), or force the mount with the –o option:

mount /dev/sda2 /windows -o force

To automate the mount each time the system is booted, simply add the mount line to the /etc/fstab file:

/dev/sda1 /windows ntfs defaults 0 0

To unmount the Windows file system at any time:

umount /windows

No comments:

Post a Comment