分类: LINUX
2007-04-30 21:45:12
Linux 下使用外置 USB 存储设备的一点经验
作者: quanliking
来自:
我使用的是台式机的外置硬盘盒,没有笔记本外置硬盘盒,没法测试,不过想来区别只在体积问题。
测试设备:
1.
移动之星光驱盒
+
40X cd-rw
2. 移动之星硬盘盒
+
40G hd
盒子都是银灰色,铝合金那种,使用的都是些台式机上的老设备,觉得闲置可惜,就利用起来,听听
CD,
刻个盘,备份文件什么的。
Linux
支持的不错,只要内核选上相应模块就可以了。所需模块如下:
Linux
Kernel v2.6.11.4 Configuration
代码:
Device Drivers USB support ---> --- USB Host Controller Drivers
--- NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE
SCSI device support --->
--- SCSI support type (disk, tape, CD-ROM)
|
$
modconf
在列表中选上上述模块。
查看已加载的模块:
$
lsmod |grep usb
usb_storage
32832 2
scsi_mod 94312 4 sg,sd_mod,usb_storage,sr_mod
usbhid
34496 0
usbcore 122104 5 usb_storage,uhci_hcd,usbhid,ehci_hcd
$
lsmod |grep hcd
uhci_hcd 33104 0
ehci_hcd 32936 0
usbcore
122104 5 usb_storage,uhci_hcd,usbhid,ehci_hcd
其中 sr_mod 是光驱模块,sd_mod 是硬盘模块。
下面让我们来看看都多哪些设备:
$
cd /proc/scsi/
$ ls
device_info scsi sg usb-storage
$ cat
scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor:
CDWRITER Model: IDE4816 Rev: 0A2G
Type: CD-ROM ANSI SCSI revision:
02
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: USB 2.0
Model: Storage Device Rev: 0100
Type: Direct-Access ANSI SCSI
revision: 02
$ cd /dev
$
ls |grep scd
scd0
这是我的刻录机设备文件。
$
ls |grep sda
sda
sda1
sda2
sda5
sda6
这里当然是外置硬盘了。
$ cdrdao scanbus
代码:
Cdrdao
version 1.1.9 - (C) Andreas Mueller SCSI interface library - (C) Joerg Schilling Paranoia DAE library - (C) Monty
Check for current driver tables.
Using libscg version 'schily-0.8'
1,0,0 : CDWRITER, IDE4816 , 0A2G ATA:1,0,0 MATSHITA, DVD-ROM SR-8175 , G228 |
$ cdrecord -scanbus
代码:
Cdrdao
version 1.1.9 - (C) Andreas Mueller SCSI interface library - (C) Joerg Schilling Paranoia DAE library - (C) Monty
Check for current driver tables.
Using libscg version 'schily-0.8'
1,0,0 : CDWRITER, IDE4816 , 0A2G ATA:1,0,0 MATSHITA, DVD-ROM SR-8175 , G228 ~# cdrecord -scanbus Cdrecord-Clone 2.01.01a01 (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jrg Schilling NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord and thus may have bugs that are not present in the original version.
Please
send bug reports and support requests to
The original author should not be bothered with problems of this version.
cdrecord: Warning: Running on Linux-2.6.11.4.050316 cdrecord: There are unsettled issues with Linux-2.5 and newer. cdrecord: If you have unexpected problems, please try Linux-2.4 or Solaris. Linux sg driver version: 3.5.32 Using libscg version 'schily-0.8'. scsibus1: 1,0,0 100) 'CDWRITER' 'IDE4816 ' '0A2G' Removable CD-ROM 1,1,0 101) * 1,2,0 102) * 1,3,0 103) * 1,4,0 104) * 1,5,0 105) * 1,6,0 106) * 1,7,0 107) * scsibus2: 2,0,0 200) 'USB 2.0 ' 'Storage Device ' '0100' Disk 2,1,0 201) * 2,2,0 202) * 2,3,0 203) * 2,4,0 204) * 2,5,0 205) * 2,6,0 206) * 2,7,0 207) * |
$ cdrecord -prcap -inq dev=1,0,0
代码:
Cdrecord-Clone 2.01.01a01 (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jrg Schilling NOTE: this version of cdrecord is an inofficial (modified) release of cdrecord and thus may have bugs that are not present in the original version.
Please
send bug reports and support requests to
The original author should not be bothered with problems of this version.
cdrecord: Warning: Running on Linux-2.6.11.4.050316 cdrecord: There are unsettled issues with Linux-2.5 and newer. cdrecord: If you have unexpected problems, please try Linux-2.4 or Solaris. scsidev: '1,0,0' scsibus: 1 target: 0 lun: 0 Linux sg driver version: 3.5.32 Using libscg version 'schily-0.8'. Device type : Removable CD-ROM Version : 0 Response Format: 1 Vendor_info : 'CDWRITER' Identifikation : 'IDE4816 ' Revision : '0A2G' Device seems to be: Generic mmc CD-RW.
Drive capabilities, per MMC-2 page 2A:
Does read CD-R media Does write CD-R media Does read CD-RW media Does write CD-RW media Does not read DVD-ROM media Does not read DVD-R media Does not write DVD-R media Does not read DVD-RAM media Does not write DVD-RAM media Does support test writing
Does read Mode 2 Form 1 blocks Does read Mode 2 Form 2 blocks Does read digital audio blocks Does restart non-streamed digital audio reads accurately Does support Buffer-Underrun-Free recording Does read multi-session CDs Does read fixed-packet CD media using Method 2 Does not read CD bar code Does not read R-W subcode information Does read raw P-W subcode data from lead in Does return CD media catalog number Does return CD ISRC information Does support C2 error pointers Does not deliver composite A/V data
Does play audio CDs Number of volume control levels: 256 Does support individual volume control setting for each channel Does support independent mute setting for each channel Does not support digital output on port 1 Does not support digital output on port 2
Loading mechanism type: tray Does support ejection of CD via START/STOP command Does not lock media on power up via prevent jumper Does allow media to be locked in the drive via PREVENT/ALLOW command Is not currently in a media-locked state Does not support changing side of disk Does not have load-empty-slot-in-changer feature Does not support Individual Disk Present feature
Maximum read speed: 7056 kB/s (CD 40x, DVD 5x) Current read speed: 706 kB/s (CD 4x, DVD 0x) Maximum write speed: 7056 kB/s (CD 40x, DVD 5x) Current write speed: 7056 kB/s (CD 40x, DVD 5x) Buffer size in KB: 2048 Copy management revision supported: 0 |
$ scsiadd -p
代码:
Attached devices: Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: CDWRITER Model: IDE4816 Rev: 0A2G Type: CD-ROM ANSI SCSI revision: 02 Host: scsi2 Channel: 00 Id: 00 Lun: 00 Vendor: USB 2.0 Model: Storage Device Rev: 0100 Type: Direct-Access ANSI SCSI revision: 02 |
$
apt-get install sg-utils
$ sg_scan
/dev/sg0: scsi1 channel=0
id=0 lun=0 [em] type=5
/dev/sg1: scsi2 channel=0 id=0 lun=0 [em]
type=0
$ sg_map
/dev/sg0 /dev/scd0
/dev/sg1 /dev/sda
上面的信息应该很清楚了。接下来讨论一下刻录软件,我用的是
k3b。
$
apt-get install k3b
看截图
1,
2
xine
播放器,audio
device 位置:
看截图
3
$
cfdisk /dev/sda
代码:
cfdisk 2.12p
Disk Drive: /dev/sda
Size: 40020664320 bytes, 40.0 GB Heads: 255 Sectors per Track: 63 Cylinders: 4865
Name Flags Part Type FS Type [Label] Size (MB) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Pri/Log Free Space 8.23 sda5 Logical W95 FAT32 10487.24 Logical Free Space 106.93 sda6 Logical W95 FAT32 10372.08 sda2 Boot Primary W95 FAT32 (LBA) 19041.53 |
By at 2005-05-10 05:23 | | | 2361 阅读