我安装的 Ubuntu 有很多硬盘。其中两个硬盘出现故障,SMART 报告错误。但是,我不知道如何确定哪个硬盘是 ata1.00,哪个是 ata12.00。是否可以检索它们的序列号,因为这是找到正确硬盘的最简单方法?
答案1
ls -l /sys/class/ata_port/
应显示 PCI id 的链接。然后ls -l /dev/disk/by-path/
会告诉您它被分配到哪个 /dev/*。
答案2
查看ls -l /dev/disk/by-path
并找到sd*
对应的设备。然后查看与该设备ls -l /dev/disk/by-id
对应的型号和序列号。sd*
你可能会发现这很有帮助:
sudo lshw -class disk -short
(或者尝试不使用它-short
但是将它导入到less
)。
答案3
您可以查看ll /sys/block
其输出,结果类似于
total 0
drwxr-xr-x 2 root root 0 Aug 8 09:00 ./
dr-xr-xr-x 13 root root 0 Jul 9 14:55 ../
lrwxrwxrwx 1 root root 0 Aug 8 09:00 dm-0 -> ../devices/virtual/block/dm-0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop0 -> ../devices/virtual/block/loop0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop1 -> ../devices/virtual/block/loop1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop2 -> ../devices/virtual/block/loop2/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop3 -> ../devices/virtual/block/loop3/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop4 -> ../devices/virtual/block/loop4/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop5 -> ../devices/virtual/block/loop5/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop6 -> ../devices/virtual/block/loop6/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop7 -> ../devices/virtual/block/loop7/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 md0 -> ../devices/virtual/block/md0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme0n1 -> ../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme1n1 -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:01.0/0000:23:00.0/nvme/nvme1/nvme1n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme2n1 -> ../devices/pci0000:00/0000:00:03.1/0000:2d:00.0/nvme/nvme2/nvme2n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 sda -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:0a.0/0000:2c:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sda/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 sdb -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:09.0/0000:2b:00.0/ata1/host0/target0:0:0/0:0:0:0/block/sdb/
答案4
如果您不知道设备名称但知道 IDE 硬盘的总线号,并且想找出序列号,您可以执行以下操作:
cat /sys/bus/ide/devices/0.0/serial
其中“0.0”是公交车号码。