Question

I am using dio and hddtemp widgets (Vicious) to display IO rate and hard drive temperature. The problem is that I have to change the input device name every time I reboot the computer, because the order in which the devices are added during booting is arbitrary. This results in device names like /dev/sda and /dev/sdb switching around on each boot for the same hard drive. This is usually solved by using UUID in other scenarios. I am wondering, is there solution to this problem for aswsome vicious widgets?

Was it helpful?

Solution

You can use the symlinks in /dev/disk/by-uuid/ for this. Something like the following could work:


handle = io.popen("readlink /dev/disk/by-uuid/abc-def-geh")
disk = handle:read("*all"):match("sd[a-zA-Z0-9]*")
handle:close()

This should give you the name of the device in the variable disk.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top