Thursday, December 30, 2010

How to mount NTFS (Windows) partition on RHEL or CentOS 7 ?

How to mount NTFS (Windows) partition on RHEL or CentOS 7 ?

Here for this tutorial i am using CentOS 7 OS, Because you can easily find many open source 3rd party repos to install your any software with its dependency, just in one click.

Or If you are working on RHEL then you can get all the required packages from these two sites,

1. Before downloading fuse & ntfs-3g we will have to install EPEL (Extra Packages for Enterprise Linux) repository:

# yum --enablerepo=extras install epel-release

Or directly install :

# rpm -ivh

2. Install "fuse" and "ntfs-3g" packages:

# yum install ntfs-3g fuse

3. Once both of these packages are installed, create a mount directory where we are planning to mount NTFS partition or disk:

# mkdir /mydisk-ntfs

4. To mount NTFS disk partition temporarily, you should get to know the NTFS device name in my case it's "/dev/sdb1". This is how i checked using "fdisk -l" command:

# fdisk -l | grep NTFS
/dev/sdb1            2048  1953519615   976758784    7  HPFS/NTFS/exFAT

To mount "/dev/sdb1" NTFS partition on the "/mydisk-ntfs" folder use below command:

# mount -t ntfs-3g /dev/sdb1 /mydisk-ntfs
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.

# mount | grep /dev/sdb1
/dev/sdb1 on /mydisk-ntfs type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)

To mount it permanently you will have to add below entry in "/etc/fstab" file:

If you want to mount it with Read Only permission:

/dev/sdb1   /mydisk-ntfs   ntfs-3g   ro,umask=0222,defaults   0   0

If you want to mount it with Read Write permission:

/dev/sdb1   /mydisk-ntfs   ntfs-3g   rw,umask=0000,defaults   0   0

Once you added any of the above entry to fstab file you can check remounting all partitions using :

# mount -a