CentOS挂载NTFS

确认分区信息

fdisk -l


Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x0009ac89

 

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 104857566 52427759+ 83 Linux

 

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xa95b85b4

 

Device Boot Start End Blocks Id System

/dev/vdb1 2048 209713151 104855552 7 HPFS/NTFS/exFAT

sudo lsblk -f


NAME FSTYPE LABEL UUID MOUNTPOINT

sr0 iso9660 config-2 2021-06-20-21-44-07-00

vda

└─vda1 ext4 4b499d76-769a-40a0-93dc-4a31a59add28 /

vdb ext4 a0ddb5ef-fcce-4bc5-b284-d577d2af01cb

└─vdb1 ntfs 66D06ACCD06AA1D3

确认NTFS支持

rpm -qa | grep ntfs-3g

yum list installed | grep ntfs-3g

安装NTFS支持

在线安装

yum install -y ntfsprogs

离线编译安装
官网: https://www.tuxera.com/company/open-source/

稳定版本: https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz

cd /home

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

tar zxvf ntfs-3g_ntfsprogs-2017.3.23.tgz

cd ntfs-3g_ntfsprogs-2017.3.23

./configure

make & make install

makedir /home2

cd ~

ntfs-3g /dev/vdb1 /home2


The disk contains an unclean file system (0, 0).

Metadata kept in Windows cache, refused to mount.

Falling back to read-only mount because the NTFS partition is in an

unsafe state. Please resume and shutdown Windows fully (no hibernation

or fast restarting.)

这里挂载,报错了.

重新挂载下:

sudo mount -o rw,remount /dev/vdb1

尝试直接挂载,看是啥效果?

sudo mount /dev/vdb1 /home2


mount: unknown filesystem type 'ntfs'

sudo ntfs-3g /dev/vdb1 /home2


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.

sudo ntfs-3g /dev/vdb1 /home2


The disk contains an unclean file system (0, 0).

Metadata kept in Windows cache, refused to mount.

Falling back to read-only mount because the NTFS partition is in an

unsafe state. Please resume and shutdown Windows fully (no hibernation

or fast restarting.)

以上方法都试了,还是不行,只能先修复状态:

sudo ntfsfix /dev/vdb1


Mounting volume... The disk contains an unclean file system (0, 0).

Metadata kept in Windows cache, refused to mount.

FAILED

Attempting to correct errors...

Processing $MFT and $MFTMirr...

Reading $MFT... OK

Reading $MFTMirr... OK

Comparing $MFTMirr to $MFT... OK

Processing of $MFT and $MFTMirr completed successfully.

Setting required flags on partition... OK

Going to empty the journal ($LogFile)... OK

Checking the alternate boot sector... OK

NTFS volume version is 3.1.

NTFS partition /dev/vdb1 was processed successfully.

Reboot

sudo ntfs-3g /dev/vdb1 /home2


ntfs-3g: symbol lookup error: ntfs-3g: undefined symbol: ntfs_xattr_build_mapping

这个错误呢,是因为我之前手动下载编译后,又通过yum安装了,导致了版本冲突.

删除或重命名 /lib/libntfs-3g.so.88

ls /lib | grep ntfs


libntfs-3g.so

libntfs-3g.so.88

libntfs-3g.so.88.0.0

ls /lib64 | grep ntfs


libntfs-3g.so.88

libntfs-3g.so.88.0.0

mv /lib/libntfs-3g.so.88 /lib/libntfs-3g.so.88.del

ls /lib | grep ntfs


libntfs-3g.so

libntfs-3g.so.88.0.0

libntfs-3g.so.88.del

再次执行挂载(OK,没错误了):

sudo ntfs-3g /dev/vdb1 /home2

永久挂载方法

当手动挂载没有错误的时候,才建议永久挂载,否则系统可能会无法启动.

找到到磁盘GUID然后编辑fstab文件.

blkid /dev/vdb1


/dev/vdb1: UUID="66D06ACCD06AA1D3" TYPE="ntfs"

vim /etc/fstab

编辑列说明:


#

# /etc/fstab

# Created by anaconda on Thu Mar 7 06:38:37 2019

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=4b499d76-769a-40a0-93dc-4a31a59add28 / ext4 defaults 1 1

UUID=66D06ACCD06AA1D3 /home2 ntfs defaults 0 0

确认挂载信息

df -TH


Filesystem Type Size Used Avail Use% Mounted on

devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev

tmpfs tmpfs 2.0G 54k 2.0G 1% /dev/shm

tmpfs tmpfs 2.0G 725k 2.0G 1% /run

tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup

/dev/vda1 ext4 53G 14G 37G 28% /

tmpfs tmpfs 398M 0 398M 0% /run/user/0

/dev/vdb1 fuseblk 108G 675M 107G 1% /home2

posted @ 2021-06-23 15:05  devs  阅读(413)  评论(0编辑  收藏  举报