どの/ dev /を見つけるにはどうすればよいですか? USBハードドライブをRedHat 3 Taroonにマウントするデバイス?私はたくさんグーグルしてログファイルをチェックしましたが、まだ手がかりがありません。私はあなたの専門家と私の最後のチャンスを試みています、
# /sbin/fdisk -l
uSBドライブについては何もしません。
# lsusb -vv
Bus 004 Device 005: ID 059f:0951 LaCie, Ltd
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x059f LaCie, Ltd
idProduct 0x0951
bcdDevice 0.00
iManufacturer 10 LaCie
iProduct 11 LaCie Hard Drive USB
iSerial 5 9F908FFFFFFF
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4
bmAttributes 0xc0
Self Powered
MaxPower 2mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk (Zip)
iInterface 6 MSC Bulk-Only Transfer
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type none
wMaxPacketSize 512
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type none
wMaxPacketSize 512
bInterval 0
Language IDs: (length=4)
0409 English(US)
そしてここに興味深いかもしれないいくつかがあります
# /var/log/message
May 23 18:17:13 mypc kernel: USB.c: USB disconnect on device 00:1d.7-5 address 4
May 23 18:18:00 mypc kernel: hub.c: new USB device 00:1d.7-5, assigned address 5
May 23 18:18:00 mypc kernel: USB.c: USB device 5 (vend/prod 0x59f/0x951) is not claimed by any active driver.
ご回答ありがとうございます
USBストレージモジュールがカーネルにロードされていません
modprobe usb-storage
dmesgはその情報を見つける場所です。
たとえば、これは 'dmesg |からの出力です。 USBペンドライブをボックスに接続した後のテール
verrall@granite:~$ dmesg | tail
[4296470.550538] sd 46:0:0:0: [sdg] Write Protect is off
[4296470.550538] sd 46:0:0:0: [sdg] Mode Sense: 00 00 00 00
[4296470.550538] sd 46:0:0:0: [sdg] Assuming drive cache: write through
[4296470.555971] sd 46:0:0:0: [sdg] 16058440 512-byte hardware sectors (8222 MB)
[4296470.555971] sd 46:0:0:0: [sdg] Write Protect is off
[4296470.555971] sd 46:0:0:0: [sdg] Mode Sense: 00 00 00 00
[4296470.555971] sd 46:0:0:0: [sdg] Assuming drive cache: write through
[4296470.555971] sdg: sdg1
[4296470.764472] sd 46:0:0:0: [sdg] Attached SCSI removable disk
[4296470.764509] sd 46:0:0:0: Attached scsi generic sg7 type 0
ここから、私のデバイスが/ dev/sdgであり、/ dev/sdg1に1つのパーティションがあることがわかります。したがって、これを/ mntにマウントするには、次のようにします。
# Sudo mount /dev/sdg1 /mnt
私はたくさんのグーグルをしました、そして私が見つけることができた最良の解決策はdmesgを使うことでした。ただし、これはスクリプトの満足のいく答えではありません。 dmesgの出力を解析することはできましたが、ログメッセージを無邪気に調整している人が私のスクリプトを壊してしまいました。
2.6.32-5-AMD64カーネルを備えたDebianディストリビューションで機能する答えを見つけました。関連するファイルはディストリビューションにあまり依存していないようですが、私はこれを確認していません。
秘密は、Linuxカーネルに関する限り、USBドライブもSCSIドライブであることを覚えていることです。コマンド 'ls -l/sys/bus/scsi/devices'は、ディレクトリの内容をシンボリックリンクのセットとして表示します。すべてのUSBドライブが文字列「usb」を含むパスにリンクするのに対し、非USBドライブはシンボリックリンクパスに文字列が含まれないことがわかります。
/ sys/bus/scsi/devicesには、?:?:?:?という3つのディレクトリセットがあります。ディレクトリ、ホスト?ディレクトリとターゲット?:?:?ディレクトリ。適切な/ sys/bus/scsi/devices /?:?:?:?/ blockディレクトリには、使用するデバイスファイルにちなんで名付けられたディレクトリが含まれていることがわかります。
USBドライブごとに1つずつ、デバイスファイルのリストを取得する方法を示すPerlフラグメントを次に示します。
opendir(DIR、 "/ sys/bus/scsi/devices")またはdie "SCSIデバイスを列挙できません\ n"; while(my $ file = readdir(DIR )){ next if($ file eq '。'); next if($ file eq '..'); next if(!(-l "/ sys/bus/scsi/devices/$ file ")); next if(!($ file =〜/\d *:\ d *:\ d *:\ d * /)); if(readlink( "/ sys/bus/scsi/devices/$ file")=〜/ usb /){ opendir(INNER_DIR、 "/ sys/bus/scsi/devices/$ file/block ")またはdie" Cannnot open $ file/block\n "; while(my $ inner_file = readdir(INNER_DIR)){ next if($ inner_file eq '。'); [ .________________ 。]} } closedir DIR; die "No USB devices found\n" until(scalar @dev_files); for my $ line(@dev_files){ print "$ line\n"; }
マウントするパーティションのラベル(たとえば、「LaCie」と呼ばれるボリューム)がわかっている場合は、次のことができます。
Sudo findfs LABEL="LaCie"
そのパーティションに対応するデバイス名を出力します。
私が通常行うことは、実行されますdmesg|tail
、USBデバイスを抜き差しした後。
おそらくもっと良い方法がありますが、これは私にとっては十分にうまくいきます。 :-)