天天看點

ntfs-3g的安裝與配置

NTFS檔案系統的建立,挂載,使用

下載下傳NTFS-3G源碼包的方式

1,http://www.ntfs-3g.org

2,wget http://www.ntfs-3g.org/ntfs-3g-1.1120.tgz

示例:

将/dev/sda5磁盤分區格式化為NTFS檔案系統,并用ntfs-3g來加載NTFS檔案系統。

步驟:

第一步:解壓源碼包

tar zxvf ntfs-3g_ntfsprogs-2013.1.13.tgz  -C /usr/src/

第二步:編譯安裝(注:編譯安裝之前需要先安裝gcc工具)

cd /usr/src/ ntfs-3g_ntfsprogs-2013.1.13/

./configure --prefix=/opt/ntfs

make

make install

第三步:使用fdisk将/dev/sda5的分區類型改為7,即HPFS/NTFS格式并格式化

[root@localhost /]# fdisk /dev/sda

The number of cylinders for this disk is set to 10443.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): t//t為修改分區類型

Partition number (1-5): 5//sda5為第五個分區

Hex code (type L to list codes): 7//指定為7,如果不知道可輸入L檢視詳細資訊

Command (m for help): w//w為儲存退出

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙.

The kernel still uses the old table.

The new table will be used at the next reboot.

Syncing disks.

[root@localhost /]# mkfs.ntfs /dev/sda5//将/dev/sda5分區格式化為ntfs格式

[root@localhost /]# fdisk -l /dev/sda | grep NTFS//檢視NTFS檔案系統

/dev/sda5            2825        5257    19543041    7  HPFS/NTFS

第四步:臨時裝載NTFS檔案系統

[root@localhost /]# ntfs-3g /dev/sda5 /data/ntfs///裝載ntfs分區,此處胡ntfs-3g就相當于mount

[root@localhost /]# mount | grep sda5

/dev/sda5 on /data/ntfs type fuseblk (rw,allow_other,blksize=4096)

[root@localhost /]#

注:臨時挂載成功,這一步位置,已經完成了NTFS的臨時挂載。

第五步:如果需要設定開機自動挂載該NTFS檔案系統,需要在/etc/fstab檔案裡面增加内容

格式為:

[root@localhost /]# cat /etc/fstab | grep sda5

/dev/sda5               /data/ntfs              ntfs-3g defaults        0 0

第六步:驗證

[root@localhost /]# umount /data/ntfs///解除安裝挂載點

[root@localhost /]# mount | grep sda5//檢視是否解除安裝成功

[root@localhost /]# mount -a//加載所有fstab已配置的檔案系統

注:如果用mount -a能夠加載/dea/sda5的話,那麼重新開機肯定能加載。

[root@localhost /]# mount | grep sda5//可以看到,挂載成功了!

      本文轉自Jx戰壕  51CTO部落格,原文連結:http://blog.51cto.com/xujpxm/1362093,如需轉載請自行聯系原作者

繼續閱讀