NTFS Read/Write Support With NTFS-3g

How to install and enable the fuse NTFS-3g driver. The fuse NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support. It provides safe and fast handling of the Windows XP, Windows Server 2003 and Windows 2000 file systems. Most POSIX file system operations are supported, with the exception of full file ownership and access right support.

Applicable to Centos Versions:

  • Centos 5.x

Requirements

Explanation of requirements.

  1. You need RPMForge repo installed and configured.

Doing the Work

This howto assumes you are the root user on the system.

  1. You need to install fuse-ntfs-3g
  2. yum --en=rpmforge install fuse-ntfs-3g
  3. Once the ntfs-3g is installed you need to set up the mount point.
  4. mkdir /mnt/windows
  5. Now you need to locate your windows partition, do this with the following command.
  6. fdisk -l
  7. That command should return something similar to the following.
  8. Disk /dev/sda: 200.0 GB, 200048565760 bytes
    255 heads, 63 sectors/track, 24321 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 11572 92952058+ 7 HPFS/NTFS
    /dev/sda2 11573 23321 94373842+ 83 Linux
    /dev/sda3 23322 24321 8032500 82 Linux swap / Solaris

    Disk /dev/sdb: 200.0 GB, 200048565760 bytes
    255 heads, 63 sectors/track, 24321 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 24321 195358401 b W95 FAT32
  9. Now an entry is needed in the files system table, to do so enter the following.
  10. vi /etc/fstab
  11. Now in the vi text editor make and entry similar to the follwing as the last line of the file. (hint: use i for insert)
  12. /dev/sda1   /mnt/windows ntfs-3g    defaults,fmask=0000,dmask=0000,uid=500   0 0

    If your partition identifier is not "/dev/sda1" substitute the correct device. (For example it might be "/dev/sdb2")
    Once the new line is added press the esc key, then :wq to "write + quit" the editor, this will save the file with the
    recent changes you made.
  13. Now you need to mount your new partitions.
  14. mount -a
  15. Close the terminal.
  16. Your Windows partition should now be available in Nautilus under “/mnt/windows”.

Troubleshooting

How to test

Explanation troubleshooting basics and expectations.

  1. Use Nautilus and browse your newly mounted Windows directory.
  2. If the filesystem has been mounted already, fstab will need to be re-read and the drive re-mounted. The principle is that the fstab is only read when the drive is being mounted thus any changes to the fstab on an already mounted drive will result in the changes happening on the next mount and/or on reboot. To unmount an already incorrectly mounted drive at /mnt/windows do the following:
  3. umount /mnt/windows

    Once you've made the necessary changes and assuming you have correctly set everything up, you may return to step 7 above.
  4. If you have SELinux turned on you will have to redo the mount commands. a simple alternative is to disable SELinux temporarily.
  5. setenforce 0 (This sets SeLinux temporarily to permissive mode)
    getenforce (This will tell you the current status of SELinux)
    setenforce 1 (This sets SELinux back to enforcing mode)

    To check:
    vi /etc/selinux/config
  6. Change your file to look similar to this one
  7. IMPORTANT NOTE: It is NOT recommended to leave SELinux disabled. If you have trouble with SELInux it is best to solve the
    problem rather than bypass important system security.


    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - SELinux is fully disabled.
    SELINUX=permissive # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted # SETLOCALDEFS= Check local definition changes SETLOCALDEFS=0
  8. Another way to bypass this is to manually mount it on boot and maintain SELinux
  9. vi /etc/rc.local
  10. Your file should look like this
  11. #!/bin/sh
    #
    # This script will be executed *after* all the other init scripts.
    # You can put your own initialization stuff in here if you don't
    # want to do the full Sys V style init stuff.

    touch /var/lock/subsys/local
  12. Add this line at the end of the file
  13. mount -t ntfs-3g /dev/sda1 /mnt/windows -O uid=500,rw,fmask=0000,dmask=0000

    This should auto mount your windows partition while maintaining SELinux for security reasons.

Common problems and fixes

Describe common problems here, include links to known common problems if on another site

  • You may have problems with SELinux. This is currently getting fixed. Red Hat Bugzilla

More Information

Any additional information or notes.

Disclaimer

We
test this stuff on our own machines, really we do. But you may run into
problems, if you do, come to #centos on irc.freenode.net

Added Reading


© 2012 CentosHelp.org