mount NTFS partition on Linux in simple steps.

by mn.sobieh
mount-ntfs-on-linux

NTFS, NT File System, or New Technology File System is a file system that Microsoft invented. In other words, it is the default file system Windows NT family, that is to say, till Windows 2008 R2. Later Windows releases have ReFS beside it. This article will explain, by example,  how to mount ntfs partition on Linux.

Why Linux can’t mount NTFS partitions?

Linux is free software work under GPL (GNU Public license). GPL grants permission to reuse or modify the source code to make derivative works, however, if you distribute your software, it requires you to license your derivative work under GPL too. that is to say, you have to make your code available to your users and allow them to further modify and redistribute it. Therefore, Linux can’t include any proprietary software, like graphic drivers or audio codecs.

To allow Linux to read and write files in NTFS partitions,  It needs a driver ( ntfs-3g ) to recognize it. Fortunately, most Linux distributions include and use NTFS-3G by default. Next, we will explain the steps in three :

  • install the drivers.
  • mount NTFS partition.
  • Permanent mount NTFS.

Give it what it needs!

To Install ntfs-3g drivers. You need to enable a repository EPEL ( Extra Packages for Enterprise Linux ). If you don’t have it, then follow the instructions in these articles :

Next,  Install driver packages by executing your Operating system counterpart command.

Enable ntfs-3g on CentOS 7 and OEL 7 .

yum -y install ntfs-3g ntfsprogs 
yum clean up

Enable ntfs-3g on CentOS 8 and OEL 8.

dnf -y install ntfs-3g ntfsprogs  

Enable ntfs-3g on Ubuntu or Debian.

By executing the following command, you will give you OS the capability to mount NTFS partitions.

apt-get install ntfs-3g

Install ntfs-3g from source code.

For maximum stability use The ntfs-3g package which comes with your distributions. On the other hand, if it’s too old, you might want to compile the latest version from the source. If so, then follow these instructions.

make sure you have installed the basic development tools (gcc compiler, libc-dev libraries)

Download ntfs-3g latest version, then extract it, next, navigate into NTFS-3g directory.

wget https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz 
tar -xvf ntfs-3g_ntfsprogs-2017.3.23.tgz 
cd ntfs-3g_ntfsprogs-2017.3.23

Proceed with the compilation process. Initially, verify the compilation requirement.

./configure

Then, Compile the files

make

Finally, install the driver, thus distribute binary files into OS directories.

make install

if you aren’t root

sudo make install

Mount your NTFS partition.

If there was no error during installation then you can mount the NTFS volume in a read-write mode for everybody as follows. Just replace /dev/sda1, and /mnt/ntfs_partition with your relevant paths.

mount -t ntfs-3g /dev/sda1 /mnt/ntfs_partition

Linux permanent mount for NTFS partitions.

The configuration file /etc/fstab contains the information for automating partition mounting. Basically, fstab provides The OS with a list of internal devices, CD/DVD devices, and network shares (samba/NFS/sshfs) to mount in its startup.

You can set mount options in fstab which are similar to mount command. Hence, you must the proper options to mount your partition.

The syntax of a fstab entry as follows:

[Device]      [Mount Point]     [File System Type]    [Options]    [Dump]     [Pass]

The following examples of how to add  NTFS partition to your fstab

Example 1:  mount NTFS partition meanwhile, ownership user and group and access permissions for files and directories to 655

/dev/sda1     /mnt/ntfs_partition     ntfs     rw,auto,user,fmask=133,dmask=022,uid=1001,gid=1001     0     0

Example 2: mount we added file system encoding. Keep in mind that you will need to set access permission in a later step.

/dev/sda2   /mnt/ntfs_partition ntfs-3g    permissions,locale=en_US.utf8    0   2
sudo chown your_user:your_user /mnt/ntfs_partition

Example 3: Simple mount for partition without any additional options

/dev/sda2 /mnt/ntfs_partition ntfs-3g defaults 0 0

 

in brief, In recent years, If you follow these steps, you will access your NTFS partition. unless your Windows OS was not cleanly shutdown.

Related Posts