Building a conky Part 3 disks

In this episode I will be showing you some ways do display your disk information, I will not be going through one of my conkies this time, but will just give you some examples of how they can be displayed differently depending on what you want to see.

First you will need to know some basic information from your system, there are many ways to get this and the simplest one is using df in a terminal, this should give you some information that you would need on your drives/partitions.

On my test system the result of df gives me this line (among others) :-

/dev/sdb2 102687672 14509336 82919072 15% /

and the information I am interested in is contained in the first and last fields, that is the device ID (/dev/sda2) and the mountpoint (/). In this case it is the root partition, on any other partition it will normally be mounted to something like /media/user/DataDrive or whatever your partition label is, if you have not labelled your partitions you will probably see something like /media/user/a84e9bb8-7b72-4efb-b065-c120f2464b4f but with a different series of characters, this is usually the UUID of the partition and will change if that partition is formatted.

Now we have this information we can start displaying some information. Start with the same configuration as we had in the first part of this guide but you could change the size (I made this one 400 wide) and location to suit your current display, and turn on graph borders.

We will start the text section with the usual

conky.text = [[

and then start adding some objects.

bar used${goto 120}${fs_bar 6,275 /}
bar free${goto 120}${fs_bar_free 6,275 /}
partition size${goto 120}${fs_size /}
partition free${goto 120}${fs_free /}
partition used${goto 120}${fs_used /}
partition free %${goto 120}${fs_free_perc /}
partition used %${goto 120}${fs_used_perc /}
partition type${goto 120}${fs_type /}
Diskio${goto 120}${diskio /dev/sdb2}
Diskio_read${goto 120}${diskio_read /dev/sdb2}
Diskio_write${goto 120}${diskio_write /dev/sdb2}
Diskiograph${goto 120}${diskiograph /dev/sdb2}
Diskiograph_read${goto 120}${diskiograph_read /dev/sdb2}
Diskiograph_write${goto 120}${diskiograph_write /dev/sdb2}

and then close the text section with


now we can run this to see the results.

You will notice that this time I have not added any formatting to the graphs except to add some text as descriptions for each line, you can add colours and other options to your preference. You might also notice that the sizes of used and free space do not add up to the size of the partition, I only use this as a visual approximation of my HDD space and do not need exact figures and there could be settings that would give better (more accurate) results but I would use my file manager to get better information. What I am mainly interested in is how close to capacity my partitions are and have shown all these options to give you an idea of what information we can obtain.

You can use the same overlay method I used for the cpu information with the disk information, and move things around, change colours until you are happy.

I generally just use a few of these objects for each of my partitions and also include an if statement to ensure correct display even when the partition is not mounted. a typical line (for me) would be something like :-

/dev/sdb2 Q4fujitsu ${if_mounted /}${color1}${goto 130}( ${fs_used /} / ${fs_size /} )${goto 250}${color lightblue}${fs_bar 6 /}${color}${else}${goto 110}Not Mounted${endif}

which looks like this :-

which shows my partition ID, the label (I used a text entry for this), used, total size and then a simple used bar. I add a little colour to fit my desktop better and that’s about it.

If this partition is not mounted it will display “Not Mounted” in place of the used bar.

There are many conky config files available on the internet and some good sources are

  1. Manjaro Forum conky thread
  2. Peachy’s blog some great lua scripts
  3. VERY LONG Ubuntu forum thread

Take a look at what others have made with their conky’s, it’s probably one of the easiest ways to learn new tricks.

Thanks for reading and if there is anything you would like me to add/edit to this guide please let me know in the comments.