当前位置: 首页 > 工具软件 > NTFS-3G > 使用案例 >

CentOS安装NTFS-3G读写Windows 10的移动NTFS磁盘

欧阳高昂
2023-12-01

Centos7 默认不能挂载NTFS文件系统,而我们常用的windows 7、8、10等windows系统多用NTFS文件系统,这里我们就需要一个第三方的工具才能挂载NTFS文件系统,就是ntfs-3g。

NTFS-3G是一个开源的软件,可以实现Linux、Free BSD、Mac OSX、Net BSD和Haiku等操作系统中的NTFS读写支持,可以安全且快速地读写Windows系统的NTFS分区,而不用担心数据丢失。

1. 安装过程

安装部署实施工具的过程如下:

首先,在官网下载源码包:https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz

1、解压ntfs-3g软件包

注:先要进入文件下载的目录

tar -zxf ntfs-3g_ntfsprogs-2017.3.23.tgz

2、编译安装

进入解压后的ntfs-3g文件夹内并进行编译

cd ntfs-3g_ntfsprogs-2017.3.23

安装

$./configure
$make 
$make install

报错:

/usr/bin/mkdir: cannot create directory ‘/usr/local/include/ntfs-3g’: Permission denied
make[3]: *** [install-ntfs3gincludeHEADERS] Error 1

若make install 显示“permission denied”字样,切换到root用户,或者,输入sudo make install可正常运行。

查看是否安装成功:

# ntfs-3g
ntfs-3g: No device is specified.

ntfs-3g 2017.3.23 integrated FUSE 27 - Third Generation NTFS Driver
		Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2017 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com

2. 加载/卸载移动硬盘/U盘

1、加载过程

$ntfs-3g /dev/sdb1 /mnt/C
$ntfs-3g /dev/sdb2 /mnt/C

注:中间出现小错误,提示

$ntfs-3g /dev/sda1 /mnt/C

Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.

因为系统硬盘和移动硬盘设备符混淆了,原有硬盘是sdba,查看磁盘设备情况:

fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
Disk identifier: D41D2D28-83F8-476C-9852-785571BD42DF


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic 
 3      2508800    976773119  464.6G  Linux LVM       

Disk /dev/mapper/centos-root: 268.4 GB, 268435456000 bytes, 524288000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/centos-swap: 8321 MB, 8321499136 bytes, 16252928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/centos-home: 222.1 GB, 222059036672 bytes, 433709056 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x469e8113

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   419842047   209920000    7  HPFS/NTFS/exFAT
/dev/sdb2       419842048   976769023   278463488    7  HPFS/NTFS/exFAT

如#fuser -m -u /dev/sdb1 使用-m -u显示正在使用/dev/sdb1的进程PID以及用户名称,如我输入上述命令后显示的情况
查看加载移动硬盘所在的PID

# fuser -m -u /dev/sdb1
/dev/sdb1:           31872(root)

表明是PID为31872的进程正在使用它,如果命令为fuser -m -u /deev/sdb1,那么显示为/dev/sdb1: 31872(root)表示root用户的31872进程正在使用/dev/sdb1,可以使用kill命令杀死该进程,kill 31872,此时在使用mount命令就不会出错了。

2、卸载移动硬盘:

$umount /mnt/C

参考:
YY简直太屌了,Mount is denied because the NTFS volume is already exclusively opened. The volume may be already mou ,CSDN博客,2016.06

 类似资料: