CentOS 挂载 Windows 分区

CentOS下想访问NTFS分区,现在普遍的方法是利用ntfs-3g或者内核模块来实现。

安装ntfs-3g模块

# yum install ntfs-3g

挂载NTFS文件系统

假设你的NTFS文件系统是 /dev/sda1 而你将会把它挂载在 /mnt/windows/c,请执行以下步骤。

1. 创建挂载点。(一般建议挂在mnt目录里)

# mkdir /mnt/windows/c

2. 挂载NTFS分区:

# mount -t ntfs-3g /dev/sda1 /mnt/windows/c

注:这里的sda1是指SATA或SCSI硬盘的第一个分区,如果是老式的IDE硬盘,会是hda1,具体请用fdisk -l查看。如下所示:

# fdisk -l

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x81230bc2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 2624 20971520 7 HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3 2624 4713 16777216 7 HPFS/NTFS
Partition 3 does not end on cylinder boundary.
/dev/sda4 4713 12162 59832320 f W95 Ext'd (LBA)
Partition 4 does not end on cylinder boundary.
/dev/sda5 4713 10073 43054080 7 HPFS/NTFS
/dev/sda6 10073 11901 14680064 83 Linux
/dev/sda7 11901 12162 2095104 82 Linux swap / Solaris

3. 如果想开机系统启动时自动挂载NTFS分区,编辑vim /etc/fstab文件,加入类似如下内容:

只读式挂载:

# /dev/sda1 /mnt/windows/c ntfs-3g ro,umask=0222,defaults 0 0

读写式挂载:

# /dev/sda1 /mnt/windows/c ntfs-3g rw,umask=0000,defaults 0 0

或者:

# /dev/sda1 /mnt/windows/c ntfs-3g defaults 0 0

卸载NTFS分区

# umount /mnt/windows/c