CentOS默认源里没有ntfs3g,想要添加ntfs支持,无非是自己下载编译安装或者加源yum安装。
昨天重新安装了一个CentOS7,用的是添加aliyun的epel源来yum安装的方式,简单易行。
添加国内源
1wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安装ntfs驱动
1yum update
2yum install ntfs-3g ntfsprogs
查看磁盘和分区状况
1blkid
2fdisk -l
创建挂载文件夹
1mkdir /media/ntfs-partition
测试挂载
1[root@localhost ~]# mount -o rw /dev/sda4 /media/ntfs-partition
不回显任何内容表示挂载成功
如果在挂载的时候出现如下错误:
1The disk contains an unclean file system (0, 0).
2Metadata kept in Windows cache, refused to mount.
3Falling back to read-only mount because the NTFS partition is in an
4unsafe state. Please resume and shutdown Windows fully (no hibernation
5or fast restarting.)
使用如下命令修复该分区:
1[root@localhost ~]# ntfsfix /dev/sda4
2Mounting volume... The disk contains an unclean file system (0, 0).
3Metadata kept in Windows cache, refused to mount.
4FAILED
5Attempting to correct errors...
6Processing $MFT and $MFTMirr...
7Reading $MFT... OK
8Reading $MFTMirr... OK
9Comparing $MFTMirr to $MFT... OK
10Processing of $MFT and $MFTMirr completed successfully.
11Setting required flags on partition... OK
12Going to empty the journal ($LogFile)... OK
13Checking the alternate boot sector... OK
14NTFS volume version is 3.1.
15NTFS partition /dev/sda4 was processed successfully.
开机自动挂载
编辑 /etc/fstab,在文件最后添加:
1/dev/sda4 /media/ntfs-partition ntfs-3g defaults 0 0
或者直接在终端执行如下命令:
1echo '/dev/sda4 /media/ntfs-partition ntfs-3g defaults 0 0' >> /etc/fstab
评论