對linux系統而言,USB接口的移動硬盤是當作SCSI設備對待的。插入移動硬盤之前,應先用fdisk –l 或 more /proc/partitions查看系統的硬盤和硬盤分區情況。
[root at pldyrouter /]# fdisk -l
Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 4 32098+ de Dell Utility
/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS
/dev/sda3 2555 7904 42973875 83 Linux
/dev/sda4 7905 8924
/dev/sda5 7905 8924 8193118+ 82 Linux swap
在這里可以清楚地看到系統有一塊SCSI硬盤/dev/sda和它的四個磁盤分區/dev/sda1 -- /dev/sda4, /dev/sda5是分區/dev/sda4的邏輯分區。接好移動硬盤后,再用fdisk –l 或 more /proc/partitions查看系統的硬盤和硬盤分區情況
[root at pldyrouter /]# fdisk -l
Disk /dev/sda: 73 dot 4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 4 32098+ de Dell Utility
/dev/sda2 * 5 2554 20482875 7 HPFS/NTFS
/dev/sda3 2555 7904 42973875 83 Linux
/dev/sda4 7905 8924
/dev/sda5 7905 8924 8193118+ 82 Linux swap
Disk /dev/sdc: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 510 4096543+ 7 HPFS/NTFS
/dev/sdc2 511 4864
/dev/sdc5 511 4864 34973473+ b Win95 FAT32
大家應該可以發現多了一個SCSI硬盤/dev/sdc和它的兩個磁盤分區/dev/sdc1?、/dev/sdc2,其中/dev/sdc5是/dev/sdc2分區的邏輯分區。我們可以使用下面的命令掛接/dev/sdc1和/dev/sdc5。
#mkdir -p /mnt/usbhd1
#mkdir -p /mnt/usbhd2
注:建立目錄用來作掛接點(mount point)
#mount -t ntfs /dev/sdc1 /mnt/usbhd1
#mount -t vfat /dev/sdc5 /mnt/usbhd2
注:對ntfs格式的磁盤分區應使用-t ntfs 參數,對fat32格式的磁盤分區應使用-t vfat參數。若漢字文件名顯示為亂碼或不顯示,可以使用下面的命令格式。
#mount -t ntfs -o iocharset=cp936 /dev/sdc1 /mnt/usbhd1
#mount -t vfat -o iocharset=cp936 /dev/sdc5 /mnt/usbhd2
linux系統下使用fdisk分區命令和mkfs文件系統創建命令可以將移動硬盤的分區制作成linux系統所特有的ext2、ext3格式。這樣,在linux下使用就更方便了。使用下面的命令直接掛接即可。
#mount /dev/sdc1 /mnt/usbhd1