mount windows ntfs partition in linux indiancyberdude

How to Mount Windows/USB NTFS Partition in RHEL Systems


Are you trying to access an NTFS partition or NTFS formatted USB drive on an RHEL-based operating system, and have encountered an error?

Do not worry, all will be fine once you finish reading this guide where we will show how to mount and access Windows/USB partitions formatted with NTFS file system type, on RHEL-based systems such as CentOS, Fedora, Rocky, and AlmaLinux.

The following screenshot shows an error encountered while mounting a Windows NTFS partition in Rocky Linux, an RHEL-based system developed as a replacement for CentOS.

mount: /media: unknown filesystem type 'ntfs'.
mount: /media: unknown filesystem type 'ntfs' Error
mount: /media: unknown filesystem type ‘ntfs’ Error

This guide assumes that you are logged in as a root user and will run commands with root user privileges, otherwise, use the sudo command where necessary.

How to Mount Windows NTFS Partition in Linux

To mount any NTFS-based partition in RHEL-based systems, you need to install and use a package called NTFS-3G.

What is NTFS3G

NTFS-3G is an open-source cross-platform NTFS driver that works on Linux and other Unix-like operating systems. It supports mounting and accessing NTFS partitions using the FUSE (Filesystem in Userspace) interface, which then enables a user to create, delete, rename, and move files, directories, hard links, streams, and much more within the mount point.

The NTFS-3G package is available in the EPEL (Extra Packages for Enterprise Linux) Repository. To install it, first enable the EPEL repository on your machine as follows:

----------- On RHEL-based Linux 9 Release ----------- 
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

----------- On RHEL-based Linux 8 Release -----------
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

----------- On RHEL-based Linux 7 Release -----------
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Next, run the following yum command to install the ntfs-3g package on your system, follow any prompts on the screen to import the GPG key for signing the package:

# yum install ntfs-3g
Install NTFS-3G in Linux
Install NTFS-3G in Linux

Identify NTFS Partition

Now plug your USB drive into the computer and check for all connected block devices using the fdisk command. Your USB device should be listed in the output as highlighted in the following screenshot.

This command will also enable you to get the device name under the /dev directory. In this example, the device name is /dev/sdb and the first mountable partition is /dev/sdb1.

# fdisk -l 
Find Device Name in Linux
Find the Device Name in Linux

Alternatively, you can use the lsblk command to list all block devices connected to your computer:

# lsblk
List Linux Block Devices
List Linux Block Devices

Mount NTFS Partition in Linux

Now it’s time to mount your USB drive by creating a new directory under /media, for example, /media/myusb. Then mount the USB drive using the mount command with -t flag, which is used to specify the filesystem type, which is ntfs-3g in this case:

# mkdir -p /media/myusb
# mount -t ntfs-3g /dev/sdb1 /media/myusb/
Mount NTFS Partition in Linux
Mount NTFS Partition in Linux

You can check if the USB drive has been mounted successfully to the defined location by running the mount command and filtering its output via the grep command as shown:

# mount | grep /dev/sdb
Confirm Mounted NTFS Partition
Confirm Mounted NTFS Partition

Next, run the ls command in the mount location to view files stored in the USB drive. The -l flag allows for a long listing of files with their permissions and size, and more:

# ls /media/myusb/
OR
# ls -l /media/myusb/
List NTFS Partition Files
List NTFS Partition Files

To mount a Windows NTFS partition at boot time, add the following line in your /etc/fstab file. Make sure to replace /dev/sdb1 and /media/myusb with the device name and mount point respectively:

/dev/sdb1 /media/myusb auto defaults 0 0

Unmount NTFS Partition in Linux

To unmount the /media/myusb mount point, use the umount command as shown.

# umount /media/myusb/

We have come to the end of this guide where we showed how to mount and access Windows NTFS partitions in RHEL systems by using the ntfs-3g driver. Share your feedback concerning this topic via the comment section below.


Posted

in

, ,

by