如何远程检查 CD 是否在托盘中(通过 ssh)?

如何远程检查 CD 是否在托盘中(通过 ssh)?

我有一台运行 Ubuntu 10.04 的服务器(它在世界的另一端,我还没有建立远程升级它的必要资金),有人告诉我,它的两个 CD 驱动器中的一个里有一张 CD。我想翻录 CD 的映像,然后将其下载到我的本地计算机(我不需要任何帮助来完成这两个步骤)。

但是,我似乎无法确认驱动器中是否真的有 CD,正如我被告知的那样。它没有自动安装到任何地方(我想这可能是因为它是一个无头服务器,没有运行 X、nautilus 或任何其他用户友好的功能)。

有两个通过 SCSI 连接的 CD 驱动器:

austin@austinvpn:/proc/scsi$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD400EB-75CP Rev: 06.0
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: Lite-On  Model: LTN486S 48x Max  Rev: YDS6
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi1 Channel: 00 Id: 01 Lun: 00
  Vendor: SAMSUNG  Model: CD-R/RW SW-248F  Rev: R602
  Type:   CD-ROM                           ANSI  SCSI revision: 05

但是,当我尝试安装这些设备中的任何一个(以及可能是 CD 驱动器的所有其他设备)时,它显示no medium found

austin@austinvpn:/proc/scsi$ sudo mount -t iso9660 /dev/scd1 /cdrom
mount: no medium found on /dev/sr1
austin@austinvpn:/proc/scsi$ sudo mount -t iso9660 /dev/scd0 /cdrom
mount: no medium found on /dev/sr0
austin@austinvpn:/proc/scsi$ sudo mount -t iso9660 /dev/cdrom /cdrom
mount: no medium found on /dev/sr1
austin@austinvpn:/proc/scsi$ sudo mount -t iso9660 /dev/cdrom1 /cdrom
mount: no medium found on /dev/sr0
austin@austinvpn:/proc/scsi$ sudo mount -t iso9660 /dev/cdrw /cdrom
mount: no medium found on /dev/sr1

以下是我的文件夹的内容/dev

austin@austinvpn:/proc/scsi$ ls /dev
agpgart          loop6               ram6      tty10  tty38  tty8
austinvpn        loop7               ram7      tty11  tty39  tty9
block            lp0                 ram8      tty12  tty4   ttyS0
bsg              mapper              ram9      tty13  tty40  ttyS1
btrfs-control    mcelog              random    tty14  tty41  ttyS2
bus              mem                 rfkill    tty15  tty42  ttyS3
cdrom            net                 root      tty16  tty43  urandom
cdrom1           network_latency     rtc       tty17  tty44  usbmon0
cdrw             network_throughput  rtc0      tty18  tty45  usbmon1
char             null                scd0      tty19  tty46  usbmon2
console          oldmem              scd1      tty2   tty47  usbmon3
core             parport0            sda       tty20  tty48  usbmon4
cpu_dma_latency  pktcdvd             sda1      tty21  tty49  vcs
disk             port                sda2      tty22  tty5   vcs1
dri              ppp                 sda5      tty23  tty50  vcs2
ecryptfs         psaux               sg0       tty24  tty51  vcs3
fb0              ptmx                sg1       tty25  tty52  vcs4
fd               pts                 sg2       tty26  tty53  vcs5
full             ram0                shm       tty27  tty54  vcs6
fuse             ram1                snapshot  tty28  tty55  vcs7
hpet             ram10               snd       tty29  tty56  vcsa
input            ram11               sndstat   tty3   tty57  vcsa1
kmsg             ram12               sr0       tty30  tty58  vcsa2
log              ram13               sr1       tty31  tty59  vcsa3
loop0            ram14               stderr    tty32  tty6   vcsa4
loop1            ram15               stdin     tty33  tty60  vcsa5
loop2            ram2                stdout    tty34  tty61  vcsa6
loop3            ram3                tty       tty35  tty62  vcsa7
loop4            ram4                tty0      tty36  tty63  vga_arbiter
loop5            ram5                tty1      tty37  tty7   zero

这是我的fstab文件:

austin@austinvpn:/proc/scsi$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/austinvpn-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=ed5520ae-c690-4ce6-881e-3598f299be06 /boot           ext2    defaults        0       2
/dev/mapper/austinvpn-swap_1 none            swap    sw              0       0

我是不是漏掉了什么或者做错了什么,还是驱动器中根本没有 CD,又或者驱动器可能坏了?有没有好的命令可以列出可安装媒体的设备?

提前感谢你的帮助!

答案1

输出不如您的那么漂亮,但它不需要您安装任何东西:

$ sudo lshw | awk '/\*-cd/,/con/' | sed -e 's/^[ \t]*//'

*-cdrom                   
description: DVD-RAM writer
product: DVD RW AD-7240S
vendor: Optiarc
physical id: 0.0.0
bus info: scsi@8:0.0.0
logical name: /dev/sr0
version: 1.00
capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: ansiversion=5 status=nodisc
*-cdrom
description: DVD-RAM writer
physical id: 0.0.0
bus info: scsi@9:0.0.0
logical name: /dev/cdrom
logical name: /dev/cdrw
logical name: /dev/dvd
logical name: /dev/dvdrw
logical name: /dev/sr1
logical name: /media/X3_Linux
capabilities: audio cd-r cd-rw dvd dvd-r dvd-ram
configuration: mount.fstype=iso9660 mount.options=ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500 state=mounted status=ready

答案2

使用 hwinfo:

我认为我刚刚用这个工具回答了我自己的问题hwinfo。这个工具会搜索并列出大量有关计算机上各种设备的有用信息。

它可以与 一起安装sudo apt-get install hwinfo

它还可以使用标志运行--<hwitem>,仅列出特定类型硬件(即 cd 驱动器)的信息,以下是此标志的选项:

   --<hwitem>
          Probe for the particular hardware item. Available hardware items
          are:  all,  bios,  block,  bluetooth,  braille,  bridge, camera,
          cdrom, chipcard,  cpu,  disk,  dsl,  dvb,  fingerprint,  floppy,
          framebuffer,  gfxcard,  hub,  ide,  isapnp, isdn, joystick, key‐
          board, memory, modem, monitor, mouse, netcard,  network,  parti‐
          tion,  pci,  pcmcia, pcmcia-ctrl, pppoe, printer, scanner, scsi,
          smp, sound, storage-ctrl, sys, tape,  tv,  usb,  usb-ctrl,  vbe,
          wlan, and zip.

使用cdrom标志我可以找到我需要的信息。

austin@austinvpn:/proc/scsi$ sudo hwinfo --cdrom
15: SCSI 100.0: 10602 CD-ROM                                    
  [Created at block.247]
  Unique ID: KD9E.skIhcO_MyD1
  Parent ID: 3p2J.7RBlinTaF34
  SysFS ID: /class/block/sr0
  SysFS BusID: 1:0:0:0
  SysFS Device Link: /devices/pci0000:00/0000:00:1f.1/host1/target1:0:0/1:0:0:0
  Hardware Class: cdrom
  Model: "Lite-On LTN486S 48x Max"
  Vendor: "Lite-On"
  Device: "LTN486S 48x Max"
  Revision: "YDS6"
  Driver: "ata_piix", "sr"
  Device File: /dev/sr0 (/dev/sg1)
  Device Files: /dev/sr0, /dev/block/11:0, /dev/scd0, /dev/disk/by-path/pci-0000:00:1f.1-scsi-1:0:0:0, /dev/cdrom1
  Device Number: block 11:0 (char 21:1)
  Drive status: no medium
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #9 (IDE interface)
  Drive Speed: 48

16: SCSI 101.0: 10602 CD-ROM
  [Created at block.247]
  Unique ID: nOPI.WcCe56A4L50
  Parent ID: 3p2J.7RBlinTaF34
  SysFS ID: /class/block/sr1
  SysFS BusID: 1:0:1:0
  SysFS Device Link: /devices/pci0000:00/0000:00:1f.1/host1/target1:0:1/1:0:1:0
  Hardware Class: cdrom
  Model: "SAMSUNG CD-R/RW SW-248F"
  Vendor: "SAMSUNG"
  Device: "CD-R/RW SW-248F"
  Revision: "R602"
  Driver: "ata_piix", "sr"
  Device File: /dev/sr1 (/dev/sg2)
  Device Files: /dev/sr1, /dev/block/11:1, /dev/scd1, /dev/disk/by-path/pci-0000:00:1f.1-scsi-1:0:1:0, /dev/cdrom, /dev/cdrw
  Device Number: block 11:1 (char 21:2)
  Drive status: no medium
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #9 (IDE interface)
  Drive Speed: 48

如您所见,它Drive status: no medium针对两个驱动器进行报告——似乎确认 CD 不在驱动器中,CD 无法识别,或者驱动器已损坏。

使用 hwinfo 查找驱动器状态:

如果您不想查看所有信息hwinfo列表,您可以使用以下命令进一步自动化该过程:

sudo hwinfo --cdrom | grep 'Drive status:'

它将快速返回任何驱动器中是否有 CD。

austin@austinvpn:/proc/scsi$ sudo hwinfo --cdrom | grep 'Drive status:'
  Drive status: no medium
  Drive status: no medium

我正在寻找是否有办法grep同时获得模型名称,当我弄清楚后,我会更新这个答案。

希望这可以帮助别人!

编辑:

这是一个稍微更有用的命令,它将输出型号名称和设备文件(因此,如果存在介质,您将知道它存在于哪个驱动器中以及您可以从哪里安装它/从哪里撕下图像)。

sudo hwinfo --cdrom | grep -e 'Model' -e 'Drive status:' -e 'Device File:'

输出内容如下:

austin@austinvpn:/proc/scsi$ sudo hwinfo --cdrom | grep -e 'Model' -e 'Drive status:' -e 'Device File:'
  Model: "Lite-On LTN486S 48x Max"
  Device File: /dev/sr0 (/dev/sg1)
  Drive status: no medium
  Model: "SAMSUNG CD-R/RW SW-248F"
  Device File: /dev/sr1 (/dev/sg2)
  Drive status: no medium

相关内容