linux下使用usb设备实战(ubuntu8.10下使用移动硬盘u盘等设备)
1:将u盘插入usb口
2:查看系统列出的usb设备
zmq@ubuntu:~$ sudo lsusb
Bus 005 Device 002: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
3:查看内核中用来表示u盘的设备文件,下例中粗体显示系统使用sdb1来表示u盘
zmq@ubuntu:~$ sudo tail -n 20 /var/log/messages | grep kernel
Feb 27 14:33:20 ubuntu kernel: [ 115.611458] type=1503 audit(1235716400.368:13): operation="socket_create" family="ash" sock_type="dgram" protocol=0 pid=5314 profile="/usr/sbin/cupsd"
Feb 27 14:33:20 ubuntu kernel: [ 115.611474] type=1503 audit(1235716400.368:14): operation="socket_create" family="x25" sock_type="seqpacket" protocol=0 pid=5314 profile="/usr/sbin/cupsd"
Feb 27 15:35:12 ubuntu kernel: [ 3827.688031] usb 5-6: new high speed USB device using ehci_hcd and address 2
Feb 27 15:35:12 ubuntu kernel: [ 3827.907173] usb 5-6: configuration #1 chosen from 1 choice
Feb 27 15:35:12 ubuntu kernel: [ 3828.101957] usbcore: registered new interface driver libusual
Feb 27 15:35:12 ubuntu kernel: [ 3828.129761] Initializing USB Mass Storage driver...
Feb 27 15:35:12 ubuntu kernel: [ 3828.131070] scsi4 : SCSI emulation for USB Mass Storage devices
Feb 27 15:35:12 ubuntu kernel: [ 3828.131532] usbcore: registered new interface driver usb-storage
Feb 27 15:35:12 ubuntu kernel: [ 3828.131546] USB Mass Storage support registered.
Feb 27 15:35:17 ubuntu kernel: [ 3833.134861] scsi 4:0:0:0: Direct-Access Generic Flash Disk 8.01 PQ: 0 ANSI: 2
Feb 27 15:35:17 ubuntu kernel: [ 3833.137468] sd 4:0:0:0: [sdb] 991232 512-byte hardware sectors (508 MB)
Feb 27 15:35:17 ubuntu kernel: [ 3833.138031] sd 4:0:0:0: [sdb] Write Protect is off
Feb 27 15:35:17 ubuntu kernel: [ 3833.140969] sd 4:0:0:0: [sdb] 991232 512-byte hardware sectors (508 MB)
Feb 27 15:35:17 ubuntu kernel: [ 3833.141963] sd 4:0:0:0: [sdb] Write Protect is off
Feb 27 15:35:17 ubuntu kernel: [ 3833.142747] sdb: sdb1
Feb 27 15:35:17 ubuntu kernel: [ 3833.144953] sd 4:0:0:0: [sdb] Attached SCSI removable disk
Feb 27 15:35:17 ubuntu kernel: [ 3833.146099] sd 4:0:0:0: Attached scsi generic sg1 type 0
4:创建挂载点
zmq@ubuntu:~$ sudo mkdir /mnt/usb
5:安装u盘
zmq@ubuntu:~$ sudo mount /dev/sdb1 /mnt/usb
6:确认安装成功
zmq@ubuntu:~$ ls /mnt/usb
Autorun.inf Recycled
zmq@ubuntu:~$ df
文件系统 1K-块 已用 可用 已用% 挂载点
/host/ubuntu/disks/root.disk
2883636 2612064 125088 96% /
tmpfs 512528 0 512528 0% /lib/init/rw
varrun 512528 208 512320 1% /var/run
varlock 512528 0 512528 0% /var/lock
udev 512528 2792 509736 1% /dev
tmpfs 512528 104 512424 1% /dev/shm
/dev/sda6 39068512 32394336 6674176 83% /host
lrm 512528 2000 510528 1% /lib/modules/2.6.27-7-generic/volatile
/dev/loop1 3844864 2372048 1277504 65% /usr
/dev/sdb1 494616 180 494436 1% /media/disk
/dev/sdb1 494616 180 494436 1% /mnt/usb
7:卸载u盘
zmq@ubuntu:~$ sudo umount /mnt/usb/
成功:)
阅读(705) | 评论(0) | 转发(0) |