【轉】http://www.linuxidc.com/Linux/2012-09/70787.htm
【自修該後】
1.安裝gcc
yum install gcc
2.安裝ntfs-3g
/home #進入/home目錄,把軟體下載到此目錄
wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2011.4.12.tgz #下載
tar zxvf ntfs-3g_ntfsprogs-2011.4.12.tgz #解壓
cd ntfs-3g_ntfsprogs-2011.4.12 #進入目錄
./configure #編譯
make #安裝
make install #安裝
cd .. #返回上一級目錄
rm -r -f ntfs-3g_ntfsprogs* #刪除安裝程式包
3、查看使用
fdisk -l #顯示Widows NTFS硬碟分區資訊
#####################################################################
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 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: 0x8e0eee9e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 38914 312057856 8e Linux LVM
Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 4261 MB, 4261412864 bytes
255 heads, 63 sectors/track, 518 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: 0x00000000
Disk /dev/sdb: 16.0 GB, 16047407104 bytes
255 heads, 63 sectors/track, 1950 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: 0x3e6c66bb
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1950 15663343+ c W95 FAT32 (LBA)
Disk /dev/mapper/VolGroup-lv_home: 261.6 GB, 261594546176 bytes
255 heads, 63 sectors/track, 31803 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: 0x00000000
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x12181f69
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 121602 976759808 7 HPFS/NTFS
Disk /dev/sdd: 16.0 GB, 16047407104 bytes
94 heads, 30 sectors/track, 11114 cylinders
Units = cylinders of 2820 * 512 = 1443840 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18
Device Boot Start End Blocks Id System
/dev/sdd1 * 3 11115 15667264 c W95 FAT32 (LBA)
[root@localhost media]# fdisl -l
bash: fdisl: command not found
[root@localhost media]# fdisk -l
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 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: 0x8e0eee9e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 38914 312057856 8e Linux LVM
Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 4261 MB, 4261412864 bytes
255 heads, 63 sectors/track, 518 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: 0x00000000
Disk /dev/sdb: 16.0 GB, 16047407104 bytes
255 heads, 63 sectors/track, 1950 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: 0x3e6c66bb
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1950 15663343+ c W95 FAT32 (LBA)
Disk /dev/mapper/VolGroup-lv_home: 261.6 GB, 261594546176 bytes
255 heads, 63 sectors/track, 31803 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: 0x00000000
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x12181f69
Device Boot Start End Blocks Id System
/dev/sdc1 * 1 121602 976759808 7 HPFS/NTFS
Disk /dev/sdd: 16.0 GB, 16047407104 bytes
94 heads, 30 sectors/track, 11114 cylinders
Units = cylinders of 2820 * 512 = 1443840 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18
Device Boot Start End Blocks Id System
/dev/sdd1 * 3 11115 15667264 c W95 FAT32 (LBA)
###################################################################
可以看到1TB移動硬碟格式為ntfs
4、掛載分區,下面我們把
將
/dev/sdc1 掛載到 /media/windows/c
進入/mediat目錄,建立/windows/c
cd /media
mkdir /windows/c
mount -t ntfs-3g /dev/sdc1 /windows/c
分區掛載完成,現在可以進入/media目錄下面查看對應的檔案夾,即就是你移動硬碟的分區
如果想卸載,可以用下面的命令
umount /dev/sdc1 #卸載
5、如果想讓系統開機自動掛載移動硬碟,編輯/etc/fstab檔案。
cp /etc/fstab /etc/fstabbak #更改之前先備份
vi /etc/fstab #編輯
用insert命令在最後添加以下資訊,以讀寫方式掛載磁碟
/dev/sdc1 /windows/c ntfs-3g defaults 0 0
執行ESC命令退出。
:wq!儲存,退出
現在只要重啟機器,會自動掛載移動硬碟
取消掛載問題:
umount的時候出現如下提示:
[root@rekfan.com /]# umount /dev/sda1
umount: /mnt/upan: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
解決方案:
[root@rekfan.com /]# lsof -w /mnt/upan
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 31761 root cwd DIR 8,18 8192 2316326 /mnt/upan/rekfan.com_120526
[root@rekfan.com /]#
使用 lsof -w /mnt/upan 可以看出,有個命令視窗在/mnt/upan/rekfan.com_120526目錄上,關閉這個視窗,或退出這個掛載目錄,再使用 umount 即可安全退出掛載的裝置!