/dev/disk/by-id を使ったLinux のDisk 確認

SD Card や USB メモリを複数接続した時などにどれがどのデバイスかわからなくなった時などに。
よく dmesg を確認しますが、流れたりどのデバイスを先に刺したかが判らなくなるといったんumount して接続しなおしをしないといけません。

>
% dmesg
[267821.123038] mmc0: new high speed SDHC card at address c52d
[267821.123222] mmcblk0: mmc0:c52d SD16G 14.9 GiB 
[267821.124291]  mmcblk0: p1
[267821.353957] FAT-fs (mmcblk0p1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
[267821.360175] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

＃うわマズそうなメッセージが出てる><

こんなとき /dev/disk/by-id を見ると判るかもしれません。

>
% ls -lA /dev/disk/by-id/
合計 0
lrwxrwxrwx 1 root root  9  2月 23 02:42 ata-INTEL_SSDSA2CW600G3_CVPR1206005W600FGN -> ../../sda
lrwxrwxrwx 1 root root 10  2月 23 02:42 ata-INTEL_SSDSA2CW600G3_CVPR1206005W600FGN-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 23 02:42 ata-INTEL_SSDSA2CW600G3_CVPR1206005W600FGN-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 23 02:42 ata-INTEL_SSDSA2CW600G3_CVPR1206005W600FGN-part5 -> ../../sda5
lrwxrwxrwx 1 root root  9  2月 26 03:53 ata-ST9500420ASG_5VJ79GDX -> ../../sdb
lrwxrwxrwx 1 root root 10  2月 23 05:05 dm-name-luks-3baf2c17-3b18-44ee-9547-cb87b88a80ab -> ../../dm-3
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-name-sdb5_crypt -> ../../dm-0
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-name-x220-root -> ../../dm-1
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-name-x220-swap_1 -> ../../dm-2
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-uuid-CRYPT-LUKS1-1b4bc14d71604ab5b3db2096a7f61be0-sdb5_crypt -> ../../dm-0
lrwxrwxrwx 1 root root 10  2月 23 05:05 dm-uuid-CRYPT-LUKS1-3baf2c173b1844ee9547cb87b88a80ab-luks-3baf2c17-3b18-44ee-9547-cb87b88a80ab -> ../../dm-3
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-uuid-LVM-L9AiiS7dZRu2WvjdUirxz9fS4OIIqRpKmuJecuwuh7tfiQxUbaGcvv9ppr7WhxZP -> ../../dm-2
lrwxrwxrwx 1 root root 10  2月 23 02:42 dm-uuid-LVM-L9AiiS7dZRu2WvjdUirxz9fS4OIIqRpKxnaP2Gj6PtwuddX1iXfyTQq0hxGbi6o3 -> ../../dm-1
lrwxrwxrwx 1 root root 13  2月 26 05:07 memstick-SD16G_0xd39a5655 -> ../../mmcblk0
lrwxrwxrwx 1 root root 15  2月 26 05:07 memstick-SD16G_0xd39a5655-part1 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root  9  2月 23 02:42 scsi-SATA_INTEL_SSDSA2CW60CVPR1206005W600FGN -> ../../sda
lrwxrwxrwx 1 root root 10  2月 23 02:42 scsi-SATA_INTEL_SSDSA2CW60CVPR1206005W600FGN-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 23 02:42 scsi-SATA_INTEL_SSDSA2CW60CVPR1206005W600FGN-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 23 02:42 scsi-SATA_INTEL_SSDSA2CW60CVPR1206005W600FGN-part5 -> ../../sda5
lrwxrwxrwx 1 root root  9  2月 26 03:53 scsi-SST9500420ASG_FEDCBA9876543210 -> ../../sdb
lrwxrwxrwx 1 root root  9  2月 26 03:53 wwn-0x5000c5002998a599 -> ../../sdb
lrwxrwxrwx 1 root root  9  2月 23 02:42 wwn-0x500151795957940c -> ../../sda
lrwxrwxrwx 1 root root 10  2月 23 02:42 wwn-0x500151795957940c-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 23 02:42 wwn-0x500151795957940c-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 23 02:42 wwn-0x500151795957940c-part5 -> ../../sda5



>
$ ls -lA /dev/disk/by-id/
合計 0
lrwxrwxrwx 1 root root  9  2月 26 04:39 ata-Hitachi_HDS5C3030ALA630_MJ1311YNG32SHA -> ../../sdb
lrwxrwxrwx 1 root root 10  2月 26 04:39 ata-Hitachi_HDS5C3030ALA630_MJ1311YNG32SHA-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9  2月 26 04:39 ata-VB0250EAVER_9VMWLJC9 -> ../../sda
lrwxrwxrwx 1 root root 10  2月 26 04:39 ata-VB0250EAVER_9VMWLJC9-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 26 04:39 ata-VB0250EAVER_9VMWLJC9-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 26 04:39 ata-VB0250EAVER_9VMWLJC9-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9  2月 26 04:39 ata-WDC_WD30EZRX-00MMMB0_WD-WCAWZ1523056 -> ../../sdc
lrwxrwxrwx 1 root root 10  2月 26 04:39 ata-WDC_WD30EZRX-00MMMB0_WD-WCAWZ1523056-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9  2月 26 04:39 md-name-micro:0 -> ../../md0
lrwxrwxrwx 1 root root 11  2月 26 04:39 md-name-micro:1 -> ../../md127
lrwxrwxrwx 1 root root  9  2月 26 04:39 md-uuid-4629ef51:fa64c815:f5a1e8b2:62b223c6 -> ../../md0
lrwxrwxrwx 1 root root 11  2月 26 04:39 md-uuid-d81a700a:b2aeaf59:b2648141:9b29ed04 -> ../../md127
lrwxrwxrwx 1 root root  9  2月 26 04:39 scsi-SATA_Hitachi_HDS5C30_MJ1311YNG32SHA -> ../../sdb
lrwxrwxrwx 1 root root 10  2月 26 04:39 scsi-SATA_Hitachi_HDS5C30_MJ1311YNG32SHA-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9  2月 26 04:39 scsi-SATA_VB0250EAVER_9VMWLJC9 -> ../../sda
lrwxrwxrwx 1 root root 10  2月 26 04:39 scsi-SATA_VB0250EAVER_9VMWLJC9-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 26 04:39 scsi-SATA_VB0250EAVER_9VMWLJC9-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 26 04:39 scsi-SATA_VB0250EAVER_9VMWLJC9-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9  2月 26 04:39 scsi-SATA_WDC_WD30EZRX-00_WD-WCAWZ1523056 -> ../../sdc
lrwxrwxrwx 1 root root 10  2月 26 04:39 scsi-SATA_WDC_WD30EZRX-00_WD-WCAWZ1523056-part1 -> ../../sdc1
lrwxrwxrwx 1 root root  9  2月 26 04:39 usb-TOSHIBA_DT01ACA300_ATMM220U3000000001-0:1 -> ../../sde
lrwxrwxrwx 1 root root 10  2月 26 04:39 usb-TOSHIBA_DT01ACA300_ATMM220U3000000001-0:1-part1 -> ../../sde1
lrwxrwxrwx 1 root root  9  2月 26 04:39 usb-WDC_WD30_EZRX-00DC0B0_ATMM220U3000000001-0:0 -> ../../sdd
lrwxrwxrwx 1 root root 10  2月 26 04:39 usb-WDC_WD30_EZRX-00DC0B0_ATMM220U3000000001-0:0-part1 -> ../../sdd1
lrwxrwxrwx 1 root root  9  2月 26 04:39 wwn-0x5000c5002d88250d -> ../../sda
lrwxrwxrwx 1 root root 10  2月 26 04:39 wwn-0x5000c5002d88250d-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10  2月 26 04:39 wwn-0x5000c5002d88250d-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10  2月 26 04:39 wwn-0x5000c5002d88250d-part3 -> ../../sda3
lrwxrwxrwx 1 root root  9  2月 26 04:39 wwn-0x5000cca228c16777 -> ../../sdb
lrwxrwxrwx 1 root root 10  2月 26 04:39 wwn-0x5000cca228c16777-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9  2月 26 04:39 wwn-0x50014ee25bae6130 -> ../../sdc
lrwxrwxrwx 1 root root 10  2月 26 04:39 wwn-0x50014ee25bae6130-part1 -> ../../sdc1