Linux

了解 USB 消息日誌以對 USB 自動掛載進行故障排除

  • May 11, 2018

我正在嘗試解決一個問題,即在一台伺服器上我的 USB 自動掛載,而在另一台伺服器上卻沒有。比較兩個實例的日誌,我試圖了解每一行的含義。

自動掛載 USB 消息日誌:

May  9 18:10:40 kernel: usb 2-1.4: new high-speed USB device number 12  using ehci-pci 
May  9 18:10:40 kernel: usb 2-1.4: New USB device found, idVendor=8564, idProduct=1000
May  9 18:10:40 kernel: usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May  9 18:10:40 kernel: usb 2-1.4: Product: MYUSB
May  9 18:10:40 kernel: usb 2-1.4: Manufacturer: MYUSB
May  9 18:10:40 kernel: usb 2-1.4: SerialNumber: A1678
May  9 18:10:40 kernel: usb-storage 2-1.4:1.0: USB Mass Storage device detected
May  9 18:10:40 kernel: scsi host13: usb-storage 2-1.4:1.0
May  9 18:10:40 mtp-probe: checking bus 2, device 12: "/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4"
May  9 18:10:40 mtp-probe: bus: 2, device: 12 was not an MTP device
May  9 18:10:41 kernel: scsi 13:0:0:0: Direct-Access     USB      MYUSB        1100 PQ: 0 ANSI: 4
May  9 18:10:41 kernel: sd 13:0:0:0: Attached scsi generic sg2 type 0
May  9 18:10:41 kernel: sd 13:0:0:0: [sdb] 15724544 512-byte logical blocks: (8.05 GB/7.50 GiB)
May  9 18:10:41 kernel: sd 13:0:0:0: [sdb] Write Protect is off
May  9 18:10:41 kernel: sd 13:0:0:0: [sdb] No Caching mode page found
May  9 18:10:41 kernel: sd 13:0:0:0: [sdb] Assuming drive cache: write through
May  9 18:10:41 kernel: sdb: sdb1
May  9 18:10:41 kernel: sd 13:0:0:0: [sdb] Attached SCSI disk
May  9 18:10:41 kernel: FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
May  9 18:10:41 gvfs-udisks2-volume-monitor: disc.c:352: error opening file BDMV/index.bdmv
May  9 18:10:41 gvfs-udisks2-volume-monitor: disc.c:352: error opening file BDMV/BACKUP/index.bdmv
May  9 18:10:41 udisksd[838]: Mounted /dev/sdb1 at /run/media/user/MYUSB on behalf of uid 1000

不自動掛載 USB 消息日誌:

May  9 18:09:07 kernel: usb 3-7: new high-speed USB device number 12 using xhci_hcd
May  9 18:09:07 kernel: usb 3-7: New USB device found, idVendor=8564, idProduct=1000
May  9 18:09:07 kernel: usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
May  9 18:09:07 kernel: usb 3-7: Product: MYUSB
May  9 18:09:07 kernel: usb 3-7: Manufacturer: MYUSB
May  9 18:09:07 kernel: usb 3-7: SerialNumber: A1678
May  9 18:09:07 kernel: usb-storage 3-7:1.0: USB Mass Storage device detected
May  9 18:09:07 kernel: scsi host4: usb-storage 3-7:1.0
May  9 18:09:07 mtp-probe: checking bus 3, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-7"
May  9 18:09:07 mtp-probe: bus: 3, device: 12 was not an MTP device
May  9 18:09:08 kernel: scsi 4:0:0:0: Direct-Access     USB      MYUSB        1100 PQ: 0 ANSI: 4
May  9 18:09:08 kernel: sd 4:0:0:0: Attached scsi generic sg2 type 0
May  9 18:09:08 kernel: sd 4:0:0:0: [sdb] 15724544 512-byte logical blocks: (8.05 GB/7.50 GiB)
May  9 18:09:08 kernel: sd 4:0:0:0: [sdb] Write Protect is off
May  9 18:09:08 kernel: sd 4:0:0:0: [sdb] No Caching mode page found
May  9 18:09:08 kernel: sd 4:0:0:0: [sdb] Assuming drive cache: write through
May  9 18:09:08 kernel: sdb: sdb1
May  9 18:09:08 kernel: sd 4:0:0:0: [sdb] Attached SCSI disk
  1. 核心如何確定使用哪個 USBusb 2-1.4版本usb 3-7
  2. 是什麼sd 4:0:0:0:意思?

另外,我正在嘗試在工作箱上複製自動安裝問題。我做了一個快速比較,發現兩個盒子上的 linux utils 版本不同,non-working 有一個舊版本(util-linux-ng-2.18),而 working 有一個新版本(util-linux-2.28)。有誰知道這是否會影響 USB 自動掛載?

1)那不是“USB版本”,它是USB-Tree中USB埠是您連接硬體的位置。實際編號由硬體和核心初始化 USB 根集線器和分配匯流排編號的順序決定。lsusb -t如果您好奇,請使用查看 USB 樹。

2)4:0:0:0表示它被分配了 4 號 SCSI 匯流排,並且該匯流排上只有一個設備(它是虛擬匯流排,因為 USB 儲存協議本質上是 SCSI)。對13:0:0:0. sd是 SCSI 磁碟核心子系統(或者可能是“儲存磁碟”,不知道……),類似於st(磁帶)等。

3)這些都不會幫助您解決自動安裝問題。在兩台主機上都檢測到硬體和分區都很好,並且一台主機配置為自動掛載它,而另一台則沒有。

自動掛載有多種方式,所以第一步是找出你在一台主機上安裝的方式,然後在第二台主機上進行配置和安裝。

引用自:https://unix.stackexchange.com/questions/443073