Mounting ntfs hard disk in a server without Internet

Background: the server has no external network resources, but it needs to install some software outside the system, so copy the installation source to the mobile hard disk to make the yum source. However, Linux system can not automatically recognize ntfs format hard disk, so some settings need to be made.
System: CentOS 7.1
Preparation: a ntfs format mobile hard disk, a U disk with CentOS system image

Plug the U disk and the mobile hard disk into the server, mount the U disk and the mobile hard disk

[root@master ntfs-3g_ntfsprogs-2017.3.23]# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 278.9G  0 disk 
├─sda1                   8:1    0   500M  0 part /boot/efi
├─sda2                   8:2    0   500M  0 part /boot
└─sda3                   8:3    0 277.9G  0 part 
  ├─centos_master-swap 253:0    0    32G  0 lvm  [SWAP]
  └─centos_master-root 253:1    0 245.9G  0 lvm  /
sdb                      8:16   0 446.6G  0 disk 
├─sdb1                   8:17   0    20G  0 part 
└─sdb2                   8:18   0    20G  0 part 
sdc                      8:32   0   1.1T  0 disk 
└─sdc1                   8:33   0   1.1T  0 part 
sdd                      8:48   0   1.1T  0 disk 
└─sdd1                   8:49   0   1.1T  0 part 
sde                      8:64   1  14.6G  0 disk 
└─sde4                   8:68   1  14.6G  0 part 
sdf                      8:80   0 931.5G  0 disk 
└─sdf1                   8:81   0 931.5G  0 part 
[root@master ntfs-3g_ntfsprogs-2017.3.23]# cd /mnt
[root@master mnt]# ls
[root@master mnt]# mkdir udisk
[root@master mnt]# mkdir storage
[root@master mnt]# mount /dev/sde4 udisk/
[root@master mnt]# cd udisk/
[root@master udisk]# ls
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  System Volume Information  TRANS.TBL
[root@master udisk]# mount /dev/sdf1 ../storage/
mount: unknown filesystem type 'ntfs'
[root@master udisk]# cd ../storage/
[root@master storage]# ls
[root@master storage]# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 278.9G  0 disk 
├─sda1                   8:1    0   500M  0 part /boot/efi
├─sda2                   8:2    0   500M  0 part /boot
└─sda3                   8:3    0 277.9G  0 part 
  ├─centos_master-swap 253:0    0    32G  0 lvm  [SWAP]
  └─centos_master-root 253:1    0 245.9G  0 lvm  /
sdb                      8:16   0 446.6G  0 disk 
├─sdb1                   8:17   0    20G  0 part 
└─sdb2                   8:18   0    20G  0 part 
sdc                      8:32   0   1.1T  0 disk 
└─sdc1                   8:33   0   1.1T  0 part 
sdd                      8:48   0   1.1T  0 disk 
└─sdd1                   8:49   0   1.1T  0 part 
sde                      8:64   1  14.6G  0 disk 
└─sde4                   8:68   1  14.6G  0 part /mnt/udisk
sdf                      8:80   0 931.5G  0 disk 
└─sdf1                   8:81   0 931.5G  0 part 
[root@master storage]# mount -t ntfs-3g /dev/sdf1 ../storage/
mount: unknown filesystem type 'ntfs-3g'

You can see that the file system in ntfs format cannot be recognized by the system. ntfs-3g needs to be installed here
(download address https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz)
Download and upload to the server for installation

[root@master ~]# tar xvfz ntfs-3g_ntfsprogs-2017.3.23.tgz 
[root@master ~]# ls
anaconda-ks.cfg  ansible-deploy  ntfs-3g_ntfsprogs-2017.3.23  ntfs-3g_ntfsprogs-2017.3.23.tgz  tstack.cmdline.vars
[root@master ~]# cd ntfs-3g_ntfsprogs-2017.3.23/
[root@master ntfs-3g_ntfsprogs-2017.3.23]# ls
aclocal.m4  autogen.sh  compile       config.h.in  configure     COPYING      CREDITS  include  install-sh    libntfs-3g  m4           Makefile.in  NEWS       README  TODO.ntfsprogs
AUTHORS     ChangeLog   config.guess  config.sub   configure.ac  COPYING.LIB  depcomp  INSTALL  libfuse-lite  ltmain.sh   Makefile.am  missing      ntfsprogs  src
[root@master ntfs-3g_ntfsprogs-2017.3.23]# ./configure 
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/ntfs-3g_ntfsprogs-2017.3.23':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

Here, the system prompts you to install gcc and other basic compiling software. At this time, set and install the system in the U disk as the yum source

[root@master yum.repos.d]# vim udisk.repo 
[root@master yum.repos.d]# cat udisk.repo 
[udisk]
name=udisk
baseurl=file:///mnt/udisk
enabled=1
gpgcheck=0

Compile and install ntfs-3g directly after installing gcc

[root@master yum.repos.d]# yum -y install gcc
[root@master yum.repos.d]# cd
[root@master ~]# ls
anaconda-ks.cfg  ansible-deploy  ntfs-3g_ntfsprogs-2017.3.23  ntfs-3g_ntfsprogs-2017.3.23.tgz  tstack.cmdline.vars
[root@master ~]# cd ntfs-3g_ntfsprogs-2017.3.23/
[root@master ntfs-3g_ntfsprogs-2017.3.23]# ls
aclocal.m4  autogen.sh  compile       config.h.in  config.sub  configure.ac  COPYING.LIB  depcomp  INSTALL     libfuse-lite  ltmain.sh  Makefile.am  missing  ntfsprogs  src
AUTHORS     ChangeLog   config.guess  config.log   configure   COPYING       CREDITS      include  install-sh  libntfs-3g    m4         Makefile.in  NEWS     README     TODO.ntfsprogs
[root@master ntfs-3g_ntfsprogs-2017.3.23]# ./configure 
[root@master ntfs-3g_ntfsprogs-2017.3.23]# make && make install
[root@master ntfs-3g_ntfsprogs-2017.3.23]# cd /mnt/
[root@master mnt]# ls
storage  udisk
[root@master mnt]# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 278.9G  0 disk 
├─sda1                   8:1    0   500M  0 part /boot/efi
├─sda2                   8:2    0   500M  0 part /boot
└─sda3                   8:3    0 277.9G  0 part 
  ├─centos_master-swap 253:0    0    32G  0 lvm  [SWAP]
  └─centos_master-root 253:1    0 245.9G  0 lvm  /
sdb                      8:16   0 446.6G  0 disk 
├─sdb1                   8:17   0    20G  0 part 
└─sdb2                   8:18   0    20G  0 part 
sdc                      8:32   0   1.1T  0 disk 
└─sdc1                   8:33   0   1.1T  0 part 
sdd                      8:48   0   1.1T  0 disk 
└─sdd1                   8:49   0   1.1T  0 part 
sde                      8:64   1  14.6G  0 disk 
└─sde4                   8:68   1  14.6G  0 part /mnt/udisk
sdf                      8:80   0 931.5G  0 disk 
└─sdf1                   8:81   0 931.5G  0 part 
[root@master mnt]# mount /dev/sdf1 /mnt/storage/
mount: unknown filesystem type 'ntfs'
[root@master mnt]# mount -t ntfs-3g /dev/sdf1 /mnt/storage/
[root@master mnt]# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                      8:0    0 278.9G  0 disk 
├─sda1                   8:1    0   500M  0 part /boot/efi
├─sda2                   8:2    0   500M  0 part /boot
└─sda3                   8:3    0 277.9G  0 part 
  ├─centos_master-swap 253:0    0    32G  0 lvm  [SWAP]
  └─centos_master-root 253:1    0 245.9G  0 lvm  /
sdb                      8:16   0 446.6G  0 disk 
├─sdb1                   8:17   0    20G  0 part 
└─sdb2                   8:18   0    20G  0 part 
sdc                      8:32   0   1.1T  0 disk 
└─sdc1                   8:33   0   1.1T  0 part 
sdd                      8:48   0   1.1T  0 disk 
└─sdd1                   8:49   0   1.1T  0 part 
sde                      8:64   1  14.6G  0 disk 
└─sde4                   8:68   1  14.6G  0 part /mnt/udisk
sdf                      8:80   0 931.5G  0 disk 
└─sdf1                   8:81   0 931.5G  0 part /mnt/storage

You can see that after the installation, you can mount the hard disk to the local directory. Note that the mount command should be attached in the following format:
# mount -t ntfs-3g /dev/sdf1 /mnt/storage/

Tags: yum Mobile Linux CentOS

Posted on Sat, 30 Nov 2019 10:25:00 -0800 by virtual_odin