和USB接口的移動硬盤一樣對linux系統(tǒng)而言U盤也是當作SCSI設(shè)備對待的。使用方法和移動硬盤完全一樣。插入U盤之前,應(yīng)先用fdisk –l 或 more /proc/partitions查看系統(tǒng)的硬盤和硬盤分區(qū)情況。
[root at pldyrouter root]# 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
插入U盤后,再用fdisk –l 或 more /proc/partitions查看系統(tǒng)的硬盤和硬盤分區(qū)情況。
[root at pldyrouter root]# 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/sdd: 131 MB, 131072000 bytes
9 heads, 32 sectors/track, 888 cylinders
Units = cylinders of 288 * 512 = 147456 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 889 127983+ b Win95 FAT32
Partition 1 has different physical/logical endings:
phys=(1000, 8, 32) logical=(888, 7, 31)
系統(tǒng)多了一個SCSI硬盤/dev/sdd和一個磁盤分區(qū)/dev/sdd1,/dev/sdd1就是我們要掛接的U盤。
#mkdir -p /mnt/usb
注:建立一個目錄用來作掛接點(mount point)
#mount -t vfat /dev/sdd1 /mnt/usb
注:現(xiàn)在可以通過/mnt/usb來訪問U盤了, 若漢字文件名顯示為亂碼或不顯示,可以使用下面的命令。
#mount -t vfat -o iocharset=cp936 /dev/sdd1 /mnt/usb