大网数据广告活动
服务器运维问答

Why does /dev/disk/by-id directory have cdrom device only and which one of /dev/disk/by-X is recommended for creating zfs pools?

· 52CE 我爱测

Im running a ubuntu 16.04 machine in esxi enviroment, i am going through zfs on linux faq and it recommends to use /dev/disk/by-id for home servers due to inconsistent nature of /dev/sdX names but when i list files on /dev/disk t…

问题原文

原帖链接 · sherpaurgen · CC BY-SA 3.0

Im running a ubuntu 16.04 machine in esxi enviroment, i am going through zfs on linux faq and it recommends to use /dev/disk/by-id for home servers due to inconsistent nature of /dev/sdX names but when i list files on /dev/disk the by-id only have cdrom device symlink on it.

root@sandbox1:/usr/lib# ls -l /dev/disk/*
/dev/disk/by-id:
total 0
lrwxrwxrwx 1 root root 9 Mar 23 14:01 ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001 -> ../../sr0

/dev/disk/by-label:
total 0
lrwxrwxrwx 1 root root 9 Mar 23 14:01 ISOIMAGE -> ../../sr0

/dev/disk/by-partuuid:
total 0
lrwxrwxrwx 1 root root 10 Mar 23 14:01 0ab37a34-0257-4619-b03e-d0d517ae81b0 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 23 14:01 117b8f72-31ce-453c-96ad-1c3a6a7254ca -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 23 14:01 13901c1b-5f31-4ec8-82d4-a6f90867cb0c -> ../../sda9
lrwxrwxrwx 1 root root 10 Mar 23 14:01 321d414b-3d47-4545-acc5-36e5ecf8d3b8 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 23 14:01 6d13446d-9d6f-4ca3-825e-c505f244e73c -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 23 14:01 94e037c9-ee9e-40b2-b634-2382734e7fdc -> ../../sda3

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root  9 Mar 23 14:01 pci-0000:00:07.1-ata-2 -> ../../sr0
lrwxrwxrwx 1 root root  9 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part4 -> ../../sda4
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 Mar 23 14:01 pci-0000:00:10.0-scsi-0:0:0:0-part9 -> ../../sda9

/dev/disk/by-uuid:
total 0
lrwxrwxrwx 1 root root 9 Mar 23 14:01 2017-06-18-10-12-11-00 -> ../../sr0

which method(by-id,by-path etc) is recommended approach on virtualized and non virtualized enviroments for creating zfs pools or any other files system where there is possiblity of change in /dev/sdX block device ?

已采纳解答

原帖链接 · kfinity · CC BY-SA 3.0

It looks like the SCSI device type being used doesn't match any of the udev rules, so the normal by-id symlinks aren't being created. You might want to let the Ubuntu systemd/udev maintainers know that your ESXI SCSI disk device isn't working properly.

As a workaround, you can create a persistent name for your device by creating a new custom udev rule file. This guide is the easiest to read that I've found, even though it's written for Oracle Linux. I think Ubuntu 16.04 uses the newer udevadm instead of udevinfo.

So, for example, you can try udevadm test /block/sda to see which udev rules your device matches, and which symlinks are being created. Then you can create your own rule to match your device's serial number, and create whatever symlink you want - /dev/disk/by-id/..., /dev/disk/by-uuid/..., or even /dev/mySCSIDevice.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。