当前位置: > CentOS > CentOS入门 >

配置CentOS支持读写ntfs磁盘

时间:2014-10-25 14:18来源:linux.it.net.cn 作者:it

[simonsun@magic ~]$ sudo rpm -ivh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[simonsun@magic ~]$ sudo rpm -ivh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/freshrpms-release-1.1-1.el5.rf.noarch.rpm
[simonsun@magic ~]$ sudo yum install fuse fuse-devel dkms-fuse fuse-ntfs\* \*ntfs\*
使用时:
[simonsun@magic ~]$ sudo mount -t ntfs-3g /dev/sdb5 /mnt/usbdisk/
/dev/sdb5是移动磁盘的位置,/mnt/usbdisk是自己建立的文件夹。

 

注:查看当前所有系统识别的硬盘:

sudo fdisk -l

 

另外,CentOS 5 系列时,操作了上面命令后,插入ntfs的优盘、移动硬盘,系统默认会用root挂载,当前登录用户只能读而不能写,而现在 6 系列开始,已经能够默认用当前登录用户挂载ntfs磁盘了,非常方便。

 

另外,附 centos下格式化优盘为ntfs格式举例:


CentOS release 5.6 (Final)
Kernel 2.6.18-238.12.1.el5 on an x86_64

sunrise login: simonsun
Password:
Last login: Sun Apr  3 10:31:16 on tty2
[simonsun@sunrise ~]$   Vendor: Kingston  Model: DataTraveler 130  Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
sd 5:0:0:0: Attached scsi removable disk sdb
sd 5:0:0:0: Attached scsi generic sg1 type 0

[simonsun@sunrise ~]$ sudo /sbin/fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       38913   312464250   8e  Linux LVM

Disk /dev/sdb: 4007 MB, 4007657472 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1018     3913161    b  W95 FAT32 
[simonsun@sunrise ~]$ sudo /sbin/fdisk /dev/sdb 

Command (m for help): d 
Selected partition 1

Command (m for help): w 
The partition table has been altered!

Calling ioctl() to re-read partition table.
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
Syncing disks.
[simonsun@sunrise ~]$ sudo /sbin/fdisk /dev/sdb 

Command (m for help): n 
Command action
   e   extended
   p   primary partition (1-4)

Partition number (1-4): 1 
First cylinder (1-1018, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1018, default 1018):
Using default value 1018

Command (m for help): w 
The partition table has been altered!

Calling ioctl() to re-read partition table.
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
SCSI device sdb: 7827456 512-byte hdwr sectors (4008 MB)
sdb: Write Protect is off
sdb: assuming drive cache: write through
Syncing disks.
[simonsun@sunrise ~]$ sudo /sbin/mkfs -t ntfs /dev/sdb1 
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
[simonsun@sunrise ~]$

 

备注:

1,最好在终端界面,即Terminal(Ctrl+Alt+F1,F2,F3)界面下执行;

2,有时候会遭遇“设备或资源忙“的情况, 一般是因为系统开启了autofs服务,即自动挂载服务,需要临时手动停止一下:

     sudo /etc/init.d/autofs stop

3,如果是图形化界面(比如centos的gnome下),需要在系统菜单下的首选项里的可移动驱动器和介质,在“可移动存储里”去掉前三行的复选框(热插拔时挂载可移动驱动器、插入时挂载可移动介质、插入时浏览可移动介质),这样就不会出现IO设备或资源忙的错误了。


(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容