LINUX SNIPPET
How To Mount Drives (USB) With NTFS Partition On Linux (CentOS / RHEL 7&8)
1. Verify the drive.
[root@HQEBPRD ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 25G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 24G 0 part
├─rhel-root 253:0 0 22G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 7.3G 0 rom /run/media/root/RHEL-8-1-0-BaseOS-x86_64
[root@HQEBPRD ~]#
2. Insert the drive into the system.
[root@HQEBPRD ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 25G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 24G 0 part
├─rhel-root 253:0 0 22G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 1 3.8G 0 disk
├─sdb1 8:17 1 200M 0 part
└─sdb2 8:18 1 3.6G 0 part
sr0 11:0 1 7.3G 0 rom /run/media/root/RHEL-8-1-0-BaseOS-x86_64
[root@HQEBPRD ~]#
If you try to mount, you will get the following error
[root@HQEBPRD ~]# mount /dev/sdb1 /tekneed
mount: /tekneed: unknown filesystem type 'ntfs' .
[root@HQEBPRD ~]# mount /dev/sdb2 /tekneed
mount: /tekneed: unknown filesystem type 'ntfs'.
[root@HQEBPRD ~]#
3. install the ntfs-3g package to be able to mount. However, it doesn’t come with the default repository. Hence, install the EPEL package.
[root@HQEBPRD ~]# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Updating Subscription Management repositories.
Last metadata expiration check: 0:30:02 ago on Thu 09 Apr 2020 11:12:05 AM WAT.
epel-release-latest-8.noarch.rpm 13 kB/s | 21 kB 00:01
Dependencies resolved.
Installed:
epel-release-8-7.el8.noarch
Complete!
[root@HQEBPRD ~]#
You may use the below URL for a RHEL 7 system.
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install ntfs-3g
[root@HQEBPRD ~]# yum install ntfs-3g
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 8 - x86_64 652 kB/s | 6.2 MB 00:09
Last metadata expiration check: 0:00:06 ago on Thu 09 Apr 2020 11:44:32 AM WAT.
Installed:
ntfs-3g-2:2017.3.23-11.el8.x86_64
Complete!
[root@HQEBPRD ~]#
4. create a mount point
[root@HQEBPRD ~]# mkdir /tekneed
[root@HQEBPRD ~]# mkdir /tekneed2
5. Mount the drive
[root@HQEBPRD ~]# mount /dev/sdb1 /tekneed
[root@HQEBPRD ~]# mount /dev/sdb2 /tekneed2
OR
[root@HQEBPRD ~]# mount -t ntfs-3g /dev/sdb2 /tekneed2
5. verify the mounted drives
[root@HQEBPRD ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 886M 0 886M 0% /dev
tmpfs 904M 0 904M 0% /dev/shm
tmpfs 904M 11M 893M 2% /run
tmpfs 904M 0 904M 0% /sys/fs/cgroup
/dev/mapper/rhel-root 22G 4.3G 18G 20% /
/dev/sda1 1014M 180M 835M 18% /boot
tmpfs 181M 4.0K 181M 1% /run/user/1000
tmpfs 181M 1.2M 180M 1% /run/user/42
tmpfs 181M 4.6M 177M 3% /run/user/0
/dev/sr0 7.4G 7.4G 0 100% /run/media/root/RHEL-8-1-0-BaseOS-x86_64
/dev/sdb1 200M 119M 82M 60% /tekneed
/dev/sdb2 3.6G 61M 3.6G 2% /tekneed2
[root@HQEBPRD ~]#
[root@HQEBPRD ~]# cd /tekneed
[root@HQEBPRD tekneed]# ls
'System Volume Information' View
[root@HQEBPRD tekneed]# cd /tekneed2
[root@HQEBPRD tekneed2]# ls
'Folder 1' 'Folder 2' 'Folder 3' 'System Volume Information'
[root@HQEBPRD tekneed2]#
6. To Make it Persistent, add it to the fstab file.
[root@HQEBPRD ~]# vi /etc/fstab
/dev/sdb1 /tekneed ntfs-3g defaults 0 0
/dev/sdb2 /tekneed2 ntfs-3g defaults 0 0
Your feedback is welcomed. If you love others, you will share with others.
Leave a Reply