1、找到所有NVME设备的总线地址
1 2 3 4 5 6 7 |
# find /sys/devices |egrep 'nvme[0-9][0-9]?$' /sys/devices/pci0000:80/0000:80:03.3/0000:87:00.0/nvme/nvme3 /sys/devices/pci0000:80/0000:80:03.1/0000:85:00.0/nvme/nvme1 /sys/devices/pci0000:80/0000:80:03.2/0000:86:00.0/nvme/nvme2 /sys/devices/pci0000:80/0000:80:03.0/0000:84:00.0/nvme/nvme0 |
如上0000:87:00.0所示 2、根据总线地址获取PCI槽位号
1 2 3 4 |
# grep -r '0000:87:00' /sys/bus/pci/slots/* /sys/bus/pci/slots/26/address:0000:87:00 |
如上26就是slots号 3、关闭NVME设备电源
1 2 3 |
# echo 0 > /sys/bus/pci/slots/26/power |
综上,可以通过脚本来获取所有设备的PCI sl […]