|
====================================================================
关于usb存储详细说明
作者:北南南北
====================================================================
提要:看到有些新手弟兄还在为USB存储设备的问题,大声急呼,对此有点看不下去了。虽然LinuxSir.Org 上有太多的教程,因为没有系统的说明,所以导致初学Linux的弟兄走入学习的误区。 不得已而为之,写。。。。。。
对于usb移动磁盘;U盘;数据相机;mp3;录音笔之类的,其实都是差不多。 主要是得让内核支持,其它的无非是mount加载。
一、当您没有挂USB盘的时候,通过fdisk -l 可能看到如下的磁盘信息
[root@S02 beinan]#fdisk -l
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1459 11719386 83 Linux
/dev/hda2 1460 9729 66428775 5 Extended
/dev/hda5 1460 9665 65914663+ 83 Linux
/dev/hda6 9666 9729 514048+ 82 Linux swap
如果挂了U盘,显示的还是上面的东西,也没有多出来一个类似/dev/sdxxx的磁盘,要试着用下面的命令
[root@S02 beinan]#modprobe usb-storage 这个是加载usb移动存储的模块的
然后再用 fdisk -l 来查看磁盘
[root@S02 beinan]#fdisk -l
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1459 11719386 83 Linux
/dev/hda2 1460 9729 66428775 5 Extended
/dev/hda5 1460 9665 65914663+ 83 Linux
/dev/hda6 9666 9729 514048+ 82 Linux swap
Disk /dev/sda: 10.0 GB, 10056130560 bytes
255 heads, 63 sectors/track, 1222 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 541 4345551 7 HPFS/NTFS
/dev/sda2 542 1222 5470132+ 5 Extended
/dev/sda5 542 1222 5470101 83 Linux
[root@S02 beinan]#
是不是多了 /dev/sda这个磁盘了???而且还有好多分区。看来是10G的。
注意:如果您通过上面的办法还是不能找到您的USB存储设备,可能您得编内核了。主要看usb的那些设备,要把scsi的支持也要编进去。有两种办法,一种直接编入内核,另一种是以模块。通过modprobe加模块,就是把设备的支持编 译成模块了。如果直接编入内核无需要用modprobe ,直接用fdisk -l 能找到设备了。
其它的事就是mount了吧。。。您想mount的分区的 文件系统格式,也必须让内核支持才行。。
通过上面可知/dev/sda1是ntfs格式的,应该这样,先准备一个空的目录。。比如 /mnt/sda1
[root@S02 beinan]#mkdir /mnt/sda1
[root@S02 beinan]#mount -t ntfs /dev/sda1 /mnt/sda1
[root@S02 beinan]#df -lh
Filesystem 容量 已用 可用 已用% 挂载点
/dev/hda5 11G 5.8G 5.2G 53% /
/dev/sda1 4.2G 156M 4.0G 4% /mnt/sda1
如果说ntfs不被内核支持的提示,试着加载一下ntfs模块。
[root@S02 beinan]#modprobe ntfs
[root@S02 beinan]#lsmod |grep ntfs
ntfs 228480 1
如果出现这样的信息,就能成功。否则编内核,编成模块或者置入内核。
==================================================================================
数码相机存储卡
==================================================================================
数码相机存储卡在linux显示的信息及磁盘显示;
还是上面说的:我只是让新手弟兄看看数码相显示是什么样的。。。
[root@S02 mnt]#dmesg |more
会看到如下的一段
- usb-storage: device scan complete
- usbcore: deregistering driver usb-storage
- Initializing USB Mass Storage driver...
- scsi3 : SCSI emulation for USB Mass Storage devices
- usbcore: registered new driver usb-storage
- USB Mass Storage support registered.
- usb-storage: device found at 3
- usb-storage: waiting for device to settle before scanning
- Vendor: Sony Model: Sony DSC Rev: 5.00
- Type: Direct-Access ANSI SCSI revision: 00
- SCSI device sda: 253696 512-byte hdwr sectors (130 MB)
- sda: Write Protect is off
- sda: Mode Sense: 00 00 00 00
- sda: assuming drive cache: write through
- SCSI device sda: 253696 512-byte hdwr sectors (130 MB)
- sda: Write Protect is off
- sda: Mode Sense: 00 00 00 00
- sda: assuming drive cache: write through
- /dev/scsi/host3/bus0/target0/lun0: p1
- Attached scsi removable disk sda at scsi3, channel 0, id 0, lun 0
- Attached scsi generic sg0 at scsi3, channel 0, id 0, lun 0, type 0
- usb-storage: device scan complete
复制代码
通过fdisk -l ,我们会发现的磁盘的位置:下面的/dev/sda1就是:
- [root@S02 beinan]#fdisk -l
- Disk /dev/hda: 60.0 GB, 60011642880 bytes
- 255 heads, 63 sectors/track, 7296 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Disk /dev/hda doesn't contain a valid partition table
- Disk /dev/sda: 129 MB, 129892352 bytes
- 16 heads, 16 sectors/track, 991 cylinders
- Units = cylinders of 256 * 512 = 131072 bytes
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 990 126703+ 6 FAT16
- [root@S02 beinan]#
复制代码
上面详细的标注了数码相机的信息,及存储卡容量大小,加载方法和上面的一样。不必多说了。。
====================================================================
mp3和录音笔
====================================================================
录音笔的相关的信息
- usb-storage: device found at 2
- usb-storage: waiting for device to settle before scanning
- Vendor: FUJITSU Model: MHM2100AT Rev: 0811
- Type: Direct-Access ANSI SCSI revision: 00
- SCSI device sda: 19640880 512-byte hdwr sectors (10056 MB)
- sda: assuming drive cache: write through
- SCSI device sda: 19640880 512-byte hdwr sectors (10056 MB)
- sda: assuming drive cache: write through
- /dev/scsi/host1/bus0/target0/lun0: p1 p2 < p5 >
- Attached scsi disk sda at scsi1, channel 0, id 0, lun 0
- Attached scsi generic sg0 at scsi1, channel 0, id 0, lun 0, type 0
- usb-storage: device scan complete
复制代码
磁盘位置:
- [root@S02 mnt]#fdisk -l
- Disk /dev/hda: 60.0 GB, 60011642880 bytes
- 255 heads, 63 sectors/track, 7296 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Disk /dev/hda doesn't contain a valid partition table
- Disk /dev/sda: 131 MB, 131048448 bytes
- 16 heads, 32 sectors/track, 499 cylinders
- Units = cylinders of 512 * 512 = 262144 bytes
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 500 127976+ 4 FAT16 <32M
复制代码 |
|