How to read/write NTFS partitions on GNU/Linux

GNU/Linux

NTFS-3G is a stable, full-featured, read-write NTFS driver for Linux, Android, Mac OS X, FreeBSD, NetBSD, OpenSolaris, QNX, Haiku, and other operating systems.

  • It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008, Windows 7, Windows 8 and Windows 10 NTFS file systems.
  • It allows to create, delete, move and rename files, directories, hard links and streams
  • It allows to read and modify files and streams
  • It allows to handle special files such us: symlinks, devices and FIFOs

Note: In CentOS you must add EPEL repository

1. Install NTFS-3G on CentOS

# yum -y install ntfs-3g

2. Install NTFS-3G on Fedora

# dnf -y install ntfs-3g

2. Install NTFS-3G on Debian/Ubuntu

# apt-get -y install ntfs-3g

3. General syntax

ntfs-3g ntfs-partition access-point [-o opciones[,...]]]

Or

mount -t ntfs-3g ntfs-partition access-point [-o opciones[,...]]]

4. Mount a ntfs partition, read mode

# ntfs-3g -o ro /dev/sda1 /mnt/win-system/

5. Mount a ntfs partition ntfs, read/write mode

# ntfs-3g -o rw,umask=0000 /dev/sda5 /mnt/win-data/

6. Mounting ntfs partitions when the operating system starts

For mounting ntfs partitions when the operating system starts, add the following 2 lines to the /etc/fstab file

/dev/sda1  /mnt/win-system  ntfs-3g ro,defaults 0 0
/dev/sda5  /mnt/win-data  ntfs-3g rw,umask=0000,defaults 0 0

The above examples assumes that:

  • The ntfs partitions are found in /dev/sda1 and /dev/sda5 respectively
  • win-system and win-data are directories that have been created before mounting the partitions
  • win-system is where the Windows OS system is installed so this partition is mount as read only
  • win-data = user data so this partition is mount as read/write partition

umask = 0000 sets read, write, and execution permissions to owner, group and others

7. To identify ntfs partitions type: 

# fdisk -l

8. To unmount an ntfs partition use the umount command

# umount access-point

for example to unmount win-system type:

# umount /mnt/win-system

Further readings




5 Comments

  1. Pingback: How to read/write NTFS partitions on GNU/Linux | 4an Nyheter

  2. David Pérez

    Last time I tested ntfs-3g, it used to work ok. But when it becomes corrupted, it doesn’t manage to repair it. The only good solution I know about, is the chkdsk command on Windows.

    Reply
    1. sedlav (Post author)

      Maybe ntfsfix can do the job.

      Reply
  3. Somewhat Reticent

    And udefrag to make NTFS files contiguous?

    Reply
    1. sedlav (Post author)

      afaik does no exist any tool for NTFS file system defragmentation from GNU/Linux.

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *