How to access windows 7 or windows partitions from RHEL/CentOS 5 and 6



#################################################

This partical is tested under RHEL6x.

1.first of all download & install epel pkg.

[yogesh@PC ~]$ su -
Password:
[root@PC ~]# rpm -ivh /home/yogesh/Downloads/epel-release-6-5.noarch.rpm
warning: /home/yogesh/Downloads/epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

[root@PC ~]# ll /etc/yum.repos.d/
total 20
-rw-r--r--. 1 root root  957 Oct 12  2010 epel.repo
-rw-r--r--. 1 root root 1056 Oct 12  2010 epel-testing.repo
-rw-r--r--. 1 root root  129 Mar 16 20:56 iso
-r--r--r--. 1 root root  114 Sep 23  2010 packagekit-media
-r--r--r--. 1 root root  114 Sep 23  2010 packagekit-media1

2.Now Install ntfs-3g with the help of yum.

[root@PC ~]# yum install ntfs-3g
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
epel/primary_db                                                                                                                                  | 3.5 MB     03:53    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntfs-3g.i686 2:2011.4.12-5.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===============================================
 Package                                Arch                                Version                                           Repository                           Size
===============================================

Installing:
 ntfs-3g                                i686                                2:2011.4.12-5.el6                                 epel                                284 k

Transaction Summary
===============================================

Upgrade       0 Package(s)

Total download size: 284 k
Installed size: 648 k
Is this ok [y/N]: y
Downloading Packages:
ntfs-3g-2011.4.12-5.el6.i686.rpm                                                                                                                 | 284 kB     00:15    
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
epel/gpgkey                                                                                                                                      | 3.2 kB     00:00 ...
Importing GPG key 0x0608B895 "EPEL (6) <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing     : 2:ntfs-3g-2011.4.12-5.el6.i686                                                                                                                   1/1

Installed:
  ntfs-3g.i686 2:2011.4.12-5.el6                                                                                                                                       

Complete!
[root@PC ~]#

3.check windows file-system with fdisk -l command.


[root@PC ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500106780160 bytes
240 heads, 63 sectors/track, 64601 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x40244023

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            6367       64602   440256032+   f  W95 Ext'd (LBA)
/dev/sda5            6367       21266   112642456    7  HPFS/NTFS
/dev/sda6           21266       37521   122881153+   7  HPFS/NTFS
/dev/sda7           37521       53774   122878278+   7  HPFS/NTFS
/dev/sda8           53774       64601    81852634    7  HPFS/NTFS

Disk /dev/sdb: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 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: 0x25af25af

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sdb2              13        3634    29081600    7  HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sdb3            3634        3698      512000   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sdb4            3698       19458   126592000    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sdb5            3698        7012    26624000   83  Linux
/dev/sdb6            7013        9562    20480000   8e  Linux LVM
/dev/sdb7            9562       12112    20480000   83  Linux
/dev/sdb8           12112       13961    14848000   83  Linux
/dev/sdb9           13961       15554    12800000   83  Linux
/dev/sdb10          15554       16319     6144000   83  Linux
/dev/sdb11          16319       16972     5242880   82  Linux swap / Solaris
/dev/sdb12          16972       17546     4608000   83  Linux
/dev/sdb13          17546       18120     4608000   83  Linux

Disk /dev/dm-0: 16.8 GB, 16777216000 bytes
255 heads, 63 sectors/track, 2039 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: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table
[root@PC ~]#


4.Now how to Mount /dev/sda5 NTFS Partition at /windows/data

5.First, load the fuse driver.

[root@PC ~]# modprobe fuse

6.Create a mount point.

[root@PC ~]# mkdir /windows/data -p        [ -p option to create multi  directories.]

7.To mount the ntfs partition

[root@PC ~]# mount -t ntfs-3g /dev/sda5 /windows/data/
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.

[root@PC ~]# ll /windows/data/
total 3588012
-rwxrwxrwx. 1 root root      21647 Feb 24 17:22 123.JPG
drwxrwxrwx. 1 root root       4096 Mar 13 17:44 abhinav docs
drwxrwxrwx. 1 root root      16384 Mar 13 16:54 abhi painting
-rwxrwxrwx. 2 root root      21706 Mar 13 21:02 Anju_cv.docx
-rwxrwxrwx. 2 root root     140359 Mar  5 20:57 Anju_cv -with photograph.docx
drwxrwxrwx. 1 root root          0 Mar 13 17:44 anju imp
-rwxrwxrwx. 2 root root     118027 Feb  2 22:34 Anju pic.PNG
drwxrwxrwx. 1 root root          0 Mar 13 17:44 apache web sites
drwxrwxrwx. 1 root root      12288 Mar  6 13:58 cartoon
drwxrwxrwx. 1 root root       4096 Mar 13 16:57 DHARMIK
drwxrwxrwx. 1 root root       4096 Sep  8  2011 document
-rwxrwxrwx. 1 root root    1317158 Dec 14  2009 DSCF6211.jpg
drwxrwxrwx. 1 root root       8192 Mar  2 21:53 FAMILY PHOTOS & VIDEOS
drwxrwxrwx. 1 root root          0 Feb 16 00:33 funny
-rwxrwxrwx. 2 root root      51832 Dec 22 21:17 Image0053.jpg
-rwxrwxrwx. 2 root root      52896 Dec 22 21:17 Image0054.jpg
-rwxrwxrwx. 2 root root      54145 Dec 22 21:17 Image0055.jpg
-rwxrwxrwx. 2 root root      52382 Dec 22 21:18 Image0056.jpg
-rwxrwxrwx. 2 root root      53308 Dec 22 21:18 Image0057.jpg
drwxrwxrwx. 1 root root       8192 Mar 14 16:56 movies
drwxrwxrwx. 1 root root          0 Mar 13 16:34 new pics
-rwxrwxrwx. 1 root root 3670016000 Jan  1  2009 pagefile.sys
drwxrwxrwx. 1 root root       4096 Sep  8  2011 PHOTOS
-rwxrwxrwx. 2 root root    2084116 Jun  3  2009 Picture 115.jpg
drwxrwxrwx. 1 root root       4096 Mar 16 11:31 $RECYCLE.BIN
drwxrwxrwx. 1 root root       4096 Dec 13 18:17 RECYCLER
drwxrwxrwx. 1 root root          0 Sep  8  2011 SONGS
drwxrwxrwx. 1 root root       4096 Dec 13 17:49 System Volume Information
-rwxrwxrwx. 1 root root      43227 Feb 24 01:08 yoo.JPG
[root@PC ~]#

[root@PC ~]# mount
/dev/sdb5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sdb3 on /boot type ext4 (rw)
/dev/sdb7 on /home type ext4 (rw)
/dev/sdb9 on /opt type ext4 (rw)
/dev/sdb12 on /tmp type ext4 (rw)
/dev/sdb10 on /usr type ext4 (rw)
/dev/sdb13 on /usr/local type ext4 (rw)
/dev/sdb8 on /var type ext4 (rw)
/dev/mapper/vg_pc-lv0 on /yoo type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sda5 on /windows/data type fuseblk (rw,allow_other,blksize=4096)
[root@PC ~]#

[root@PC ~]# df -h /dev/sda5
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             108G   73G   35G  68% /windows/data
[root@PC ~]#

[root@PC ~]# cp /windows/data/yoo.JPG /home/yogesh/
[root@PC ~]# ll /home/yogesh/
total 12764
-rw-rw-r--. 1 yogesh yogesh        0 Mar 17 17:47 123~
drwxr-xr-x. 3 yogesh yogesh     4096 Mar 17 14:37 Desktop
-rw-rw-r--. 1 yogesh yogesh     1788 Mar 16 19:41 new file
-rw-rw-r--. 1 yogesh yogesh     1730 Mar 16 19:20 new file~
drwxr-xr-x. 2 yogesh yogesh     4096 Mar 16 16:39 Pictures
drwxrwxr-x. 5 yogesh yogesh     4096 Feb 29 01:47 usr
drwxr-xr-x. 2 yogesh yogesh     4096 Mar 16 16:39 Videos
-rwxr-xr-x. 1 root   root      43227 Mar 17 18:26 yoo.JPG
[root@PC ~]#

8.At the end unmount windows partition.

[root@PC ~]# umount /windows/data/
[root@PC ~]#

9.how to parmanent mount sda5 windows partition.

[root@PC ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Fri Jan 16 16:15:47 2009
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=eb6d3f11-57be-4c4c-be8a-23c72ed3a1ff /                       ext4    defaults        1 1
UUID=298d5d36-2921-41b6-b90e-d37ffe575cfa /boot                   ext4    defaults        1 2
UUID=a8bd4628-2360-41f2-8a65-05b5d5c01519 /home                   ext4    defaults        1 2
UUID=af3d3cbe-8c43-41e6-8df0-8c8eec80f3c2 /opt                    ext4    defaults        1 2
UUID=87587143-9617-49cf-8957-202d55054013 /tmp                    ext4    defaults        1 2
UUID=9f8b8f05-dc42-43f8-8673-758aa3e432cc /usr                    ext4    defaults        1 2
UUID=ee239a58-91e5-4c12-8f3f-71a962d91c66 /usr/local              ext4    defaults        1 2
UUID=de9430fa-2411-486f-b7a6-c78fe7099489 /var                    ext4    defaults        1 2
/dev/mapper/vg_pc-lv0   /yoo                    ext4    defaults        1 2
UUID=48c16cd3-6f15-4876-8268-2746be9ee558 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sda5        /windows/data/        ntfs-3g    defaults    0 0


[root@PC ~]# mount -a          [to save fstab file, if any thing goes worng then this command sown an error]
[root@PC ~]#




*****************************************************************************


0 comments:

Post a Comment

Note: only a member of this blog may post a comment.