2

In case this is so, it can be a huge downer in modern Linux distros, since the device names are very often assigned arbitrarily. So if you have no more than two HDDs in your system, but two USB flash drives sticking in their ports, things might look like this after bootup:

/dev/sda .. HDD #1 /dev/sdb .. USB flash drive #1 /dev/sdc .. USB flash drive #2 /dev/sdd .. HDD #2 

I have searched high and low and tried various hacks for my .conkyrc to no avail. It just does not seem to work.

I even thought about "creating" the format required for conky by executing a system command, but even this failed. In bash, this can be achieved by

$ basename $(readlink /dev/disk/by-label/mydisklabel) 

Though conky DOES allow execution of system commands, it seems that in {diskio}/{diskiograph} options, this is not possible.
So the following will NOT work:

${diskio /dev/${execp basename $(readlink /dev/disk/by-label/mydisklabel)}} 

Neither would the variant with the UUID work (not shown here).
Has anyone of you guys ever managed to "teach" this to conky? It's so insanely versatile, but it's almost unbelievable that (compared to the good old days) udev and friends will no longer keep drives in a certain order, but scramble them again on each bootup sequence, while tools (GKrellM is none the better!) stubbornly insist on physical drive/device names.

1
  • In Ubuntu 20.04 using ${diskio_read /dev/disk/by-id/<some-disk-id>} works. Commented Nov 8, 2020 at 13:04

2 Answers 2

2

To use the any of the /dev/disk/by-?? paths in full, as follows:

${diskio /dev/disk/by-label/mydisklabel} 

you need to have conky version 1.9.1 or later, which is known as conky-ng. From Fedora 20 onwards, it's available as the conky package. Ubuntu is still using the older version (as of Ubuntu 14.04) therefore you'll need to compile conky-ng. The latter is also true for Arch Linux.

The Disk IO line in the screenshot below shows it working with a by-label entry in .conkyrc while find . is running in a terminal.

Conky running with disk-by-label

Note that there should not be a space between the last character of the path and the closing brace (}) otherwise conky will complain of path not found.

7
  • Thanks for bearing with me...I think the problem is that in my case, /dev/sdc6 is in fact a NTFS formatted partition, let's call it /dev/disk/by-label/videos for example, which on ls -l points to --> ../../sdc6. This is assigned to /media/videos, which, of course, isn't accepted either by conky. My (shortened) version line is Conky 1.9.0 compiled 2014-02-19 for Linux 3.2.0-54-generic (i686). I can't seem to believe that I really need to upgrade to 1.9.1 to get this working. Commented Aug 24, 2014 at 13:02
  • You're a marvel, thank you so much! So I will need to replace conky by conky-ng (a fork, see github.com/Tucos/conky-ng). I just don't understand why this hasn't been implemented yet in the "standard" conky. It's such an essential feature to have in udev times. Commented Aug 24, 2014 at 13:59
  • I agree. It seems that Ubuntu and Arch are using the older version. I've added the info to the answer and propose that we tidy up these comments/chit-chat by deleting. Commented Aug 24, 2014 at 16:07
  • Proposal dismissed! This isn't chit-chat. I was even rather frowning upon getting this "chit chat warning" by SE. It's IMHO uncalled-for, and I felt treated like an immature teen.---Back to conky: Unfortunately this only works for diskio+label symlinks, but not with diskiograph. That is, when used with the latter, it will not complain about path not found, but it won't display anything either in the graph. Doing the same with the physical path did work instantly, though. Commented Aug 24, 2014 at 17:55
  • 1
    I have: ${diskiograph /dev/disk/by-uuid/60fc9b67-a8a7-4183-a827-aa644f0e0680}. Presumably, it uses some reasonable defaults if you omit the options. Commented Aug 24, 2014 at 19:02
0

After looking at the source code, it seems that name resolution for symlinks is done in a relative way. The program uses readlink(2) where it should use realpath(3). When using /dev/disk/by-id/wwn-* it resolves to ../../sd? which fails if conky's current working directory isn't /dev/disk/by-id.

To use label, you can use label:some_disk_label and it should work. To get by-id/by-uuid, the author would have to accept my pull request at https://github.com/brndnmtthws/conky/pull/238 in which I converted diskio path resolution method to use realpath(3).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.