鄙人當年用PC硬盤作了一個移動硬盤(其實並不方便移動,只是外邊包裝了一個殼子,能夠用USB口訪問而已),移動硬盤上存放了一些學習資料。某日想把一部分學習資料拿到公司去學習,可公司的本本不容許帶回家,家裏的本本又被我裝了個CentOS玩玩,就想着能不能先把資料拷到CentOS上,再經過其餘方式好比U盤什麼的拷到公司去。ide
奈何CentOS並不認識俺當年作的移動硬盤,由於文件系統是NTFS的。網上搜資料,聽說能夠利用ntfs-3g來讓CentOS認識NTFS的文件系統。因而一步一步的作:學習
一、安裝gcc編譯器spa
# yum install gcc 編譯器
中間執行過程當中,會問你yes or no,輸入:y,回車便可。it
二、安裝ntfs-3gio
# cd /home 學習資料
# wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2011.4.12.tgz <=下載壓縮包 gcc
# tar zxvf ntfs-3g_ntfsprogs-2011.4.12.tgz <=解壓
# cd ntfs-3g_ntfsprogs-2011.4.12 <=進入解壓後的目錄
# ./configure <=編譯
# make <=安裝
# make install <=安裝
三、將移動硬盤接入,而後查看文件系統
# fdisk -l
顯示結果以下:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0xd10cd10c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 2637 20971520 83 Linux
/dev/sda3 2637 3290 5242880 83 Linux
/dev/sda4 3290 19458 129869824 5 Extended
/dev/sda5 3290 3812 4194304 82 Linux swap / Solaris
Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0xcb52b238
Device Boot Start End Blocks Id System
/dev/sdb1 1 19457 156288321 f W95 Ext'd (LBA)
/dev/sdb5 1 5223 41953684+ 7 HPFS/NTFS
/dev/sdb6 5224 11752 52444161 7 HPFS/NTFS
/dev/sdb7 11753 19457 61890381 7 HPFS/NTFS
能夠看出,個人/dev/sdb五、/dev/sdb六、/dev/sdb7都是ntfs文件系統
四、掛載分區
# cd /mnt
# mkdir winc
# mount -t ntfs-3g /dev/sdb5 /mnt/winc
五、進入分區查看內容並進行其餘操做
# cd winc
# ls
說明:當時我第一次把/dev/sdb5掛載完成後,進行操做時,還出了一點小情況:
# cd winc
# ls
# cd tools
# ls
進行如上操做時,忽然提示:
ls: 正在讀取目錄.: 輸入/輸出錯誤
即使是回到winc目錄執行再執行ls命令也提示相似錯誤
回到mnt目錄執行ls -l命令,相似:
?--------- ? ? ? ? ? winc
這裏的權限、用戶、用戶組、大小、時間等等信息都變成問號了
後來又執行fdisk -l命令,結果發現:
……以上省略……
Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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: 0xcb52b238
Device Boot Start End Blocks Id System
/dev/sdc1 1 19457 156288321 f W95 Ext'd (LBA)
/dev/sdc5 1 5223 41953684+ 7 HPFS/NTFS
/dev/sdc6 5224 11752 52444161 7 HPFS/NTFS
/dev/sdc7 11753 19457 61890381 7 HPFS/NTFS
NTFS文件系統的設備名從sdb通通變成了sdc,不知是否是由於我不當心碰到移動硬盤還算怎麼回事,無論,先將winc卸載,再從新掛載:
# umount /mnt/winc
# mount -t ntfs-3g /dev/sdc5 /mnt/winc
# cd /mnt/winc
# ls
而後一切又都OK了。