想用ntfs的优盘在两个系统间考东西
今天研究了下如何在CentOS中挂载ntfs文件系统
1.man mount
查找关于ntfs的信息: /ntfs
找到了-t这个参数
-t, --types vfstype
The argument following the -t is used to indicate the filesystem
type. The filesystem types which are currently supported
include: adfs, affs, autofs, cifs, coda, coherent, cramfs,
debugfs, devpts, efs, ext, ext2, ext3, ext4, hfs, hfsplus, hpfs,
iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4,
ramfs, reiserfs, romfs, squashfs, smbfs, sysv, tmpfs, ubifs,
udf, ufs, umsdos, usbfs, vfat, xenix, xfs, xiafs. Note that
coherent, sysv and xenix are equivalent and that xenix and
coherent will be removed at some point in the future — use sysv
instead. Since kernel version 2.1.21 the types ext and xiafs do
not exist anymore. Earlier, usbfs was known as usbdevfs. Note,
the real list of all supported filesystems depends on your ker-
nel.
2.使用 mount -t
[quincy@Quincy ~]$ sudo mount -t ntfs /dev/sdb1 /mnt/usb/
出现错误
mount: unknown filesystem type 'ntfs'
查找资料才知道
Centos默认是不支持ntfs文件系统的
Ubuntu、Suse等默认是支持ntfs的
3.使用ntfs-3g
ntfs-3g是一个开源项目
可以让Linux、Mac OS X等系统可以读写ntfs文件系统
到http://www.tuxera.com/community/ntfs-3g-download/
网站下载ntfs-3g
然后就是 编译、安装
tar xf ntfs-3g_ntfsprogs-2013.1.13.tgz
cd ntfs-3g_ntfsprogs-2013.1.13/
./configure --prefix=/app/ntfs-3g
make & make install
现在 可以用 mount -t ntfs-3g 来挂载设备了
例如:mount -t ntfs-3g /dev/sdb1 /mnt/usb/
4.修改/etc/fstab配置文件
如果是双系统且需要频繁的在两个系统间拷贝文件,还可以把windows下一个ntfs的分区挂载到linux上,这样两个系统都可以读写那个分区了
这可以通过修改/etc/fstab文件,让linux每次启动自动挂载
vim /etc/fstab
#
3 # /etc/fstab
4 # Created by anaconda on Tue Oct 22 06:11:14 2013
5 #
6 # Accessible filesystems, by reference, are maintained under '/dev/disk'
7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
8 #
9 UUID=ce83f292-d692-4849-94b3-f36feb6b9c72 / ext4 de faults 1 1
10 UUID=46d97879-14a7-49b6-92ae-c48f1993ccf4 /boot ext4 de faults 1 2
11 UUID=5145c233-c6f7-45c7-9959-5b447a2bf1a3 swap swap de faults 0 0
12 tmpfs /dev/shm tmpfs defaults 0 0
13 devpts /dev/pts devpts gid=5,mode=620 0 0
14 sysfs /sys sysfs defaults 0 0
15 proc /proc proc defaults 0 0
不知道每个字段的含义,没关系,可以通过man fstab来获得帮助
man fstab
第一个字段是被挂载的块设备 (可以用sudo fdisk -l 查看系统的全部块设备)
第二个字段是挂载点
第三个字段是文件系统类型
第四个字段是关于文件系统的挂载选项
第五个字段是给dump命令使用的
第六个字段是给fsck程序使用的
其中最后面三个字段直接 default 0 0 就可以了
所以我们可以在/etc/fstab文件中增加一行
/dev/sda8 /mnt/ntfs ntfs-3g defaults 0 0这样重启后,就可以让两个系统访问同一个分区了