Page 1 of 1

Conky hard disk info

Posted: Sat Sep 16, 2023 5:29 am
by Mjaakko
How to show the size and used of total hard disk? I have many partitions, but this only shows current root and home.

Code: Select all

ROOT free: ${fs_free /} used: ${fs_used /} total: ${fs_size /}
HOME free: ${fs_free /home} used: ${fs_free /home} total: ${fs_size /home}

Re: Conky hard disk info

Posted: Sat Sep 16, 2023 8:06 am
by wdscharff
There are several variants of the conkys supplied.
For some, the script "semplice-conky-harddisks.sh".
then an example of how to integrate INXI, shortened to the device output (found with google search)
and then you can also do it yourself, by foot, for each drive individually, as is currently the case.
There are also enough examples in the www, google is very helpful.

Code: Select all

${font Open Sans:Bold:size=12}${color}mounted ${color0}${hr 2}$color$font$

${font Open Sans:size=12}Data ${goto 80}${fs_used /media/DATA} / ${fs_size /media/DATA}   ${goto 220} ${color5}${fs_bar 8,250 /media/DATA}${color}  ${goto 500}${fs_free_perc /media/DATA}% frei ${color} ${goto 580}I/O: ${color5}${diskio_read /dev/disk/by-label/DATA}${color}  :  ${color5}${diskio_write  /dev/disk/by-label/DATA}${color}
 
${font Open Sans:size=12}evo850 ${goto 80}${fs_used /media/evo850} / ${fs_size /media/evo850}   ${goto 220} ${color5}${fs_bar 8,250 /media/evo850}${color}  ${goto 500}${fs_free_perc /media/evo850}% frei ${goto 580}I/O: ${color5}${diskio_read /dev/disk/by-label/evo850}${color}  :  ${color5}${diskio_write  /dev/disk/by-label/evo850}${color}

Re: Conky hard disk info

Posted: Sat Sep 16, 2023 3:06 pm
by Mjaakko
wdscharff wrote: Sat Sep 16, 2023 8:06 am then an example of how to integrate INXI, shortened to the device output (found with google search)
Inxi package is installed on MX and gives the total hard disk storage:

Code: Select all

Storage: 386.94 GiB (78.5% used)
How to add in Conky, I found something like this....

Code: Select all

create small bash scripts that produce conky syntax, and then call them with
${execp /path/to/script}
https://forums.bunsenlabs.org/viewtopic.php?id=4984

Re: Conky hard disk info

Posted: Sat Sep 16, 2023 4:27 pm
by siamhie
I find it easier to point the directories to their locations instead of going through scripts.

Code: Select all

Root:   ${fs_used /}${alignr}/${fs_size /}
Stream: ${fs_used /media/Stream/}${alignr}/${fs_size /media/Stream/}
Data:   ${fs_used /media/Data/}${alignr}/${fs_size /media/Data/}
file_system.png


I use this web site for all the code. http://ifxgroup.net/conky.htm#fs_bar

Re: Conky hard disk info

Posted: Sat Sep 16, 2023 6:43 pm
by Mjaakko
siamhie wrote: Sat Sep 16, 2023 4:27 pm I use this web site for all the code. http://ifxgroup.net/conky.htm#fs_bar
Thanks, that's interesting.
${execp cat hdd-storage.txt} works fine but is better if not sent to a text file but a direct command. This syntax Conky doesn't accept or I am missing something? The shell command is correct.

Code: Select all

${execp inxi | grep '^Storage:' | awk '{print $1 " " $2 " " $3 " " $4 " " $5}'}

Re: Conky hard disk info

Posted: Sun Sep 17, 2023 3:44 am
by MikeR
${color blue}${font LCDMono:bold:size=10}sdb${font}${if_match ""!="${execi 60 mount | grep /dev/sdb }"} \
(${execi 60 mount | grep 'sdb' | awk '{print $3}' | awk -F"/" '{print $3}'}) \
read/write: $color${diskio_read sdb}/${diskio_write sdb} ${else}${color red} Not Mounted ${endif}

Re: Conky hard disk info

Posted: Sun Sep 17, 2023 8:38 am
by amlug
Mjaakko wrote: Sat Sep 16, 2023 6:43 pm This syntax Conky doesn't accept or I am missing something? The shell command is correct.
Conky is corrupting inxi output by adding strange characters.... one small horizontal triangle and number 12 (forum doesn't show the triangle)

12Storage 476.94 GiB (71.5% used) 12Procs 305 12Client Unknown Client: conky 12inxi 3.3.26

Re: Conky hard disk info

Posted: Sun Sep 17, 2023 3:33 pm
by Mjaakko
amlug wrote: Sun Sep 17, 2023 8:38 am Conky is corrupting inxi output by adding strange characters....
That's bad either Conky or Inxi causing it. I like the clean and informative info of inxi, example inxi -b
Drives:
Local Storage: total: 953.87 GiB used: 75.44 GiB (7.9%)
https://opensource.com/article/22/9/linux-inxi-command

I will add bash script until better idea.

Code: Select all

inxi -b | grep 'Local Storage:' > hdd-storage.txt
In Conky

Code: Select all

${execp cat hdd-storage.txt | sed 's/  Local Storage:/HDD/'}
Result:

Code: Select all

HDD total: 386.94 GiB used: 322.05 GiB (83.1%)

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 4:45 am
by wdscharff
so i still find my variant attractive, even though it's a lot to write myself.
Once done, done. There are more drives in there, but they are commented out because they are not connected.
Above all, I decide how it looks, in terms of colour, font and display bars.
mounted.jpg

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 11:30 am
by Mjaakko
wdscharff wrote: Mon Sep 18, 2023 4:45 am so i still find my variant attractive, even though it's a lot to write myself.
Looks great.
I want information that shows storage capacity and current use of my Hard Disk. Is the Total/use: 243 GIB / 31,1 GIB capacity of your Hard Disk? If so, what's the Conky syntax?

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 12:08 pm
by wdscharff
i have already listed the corresponding conky commands above, simply adapt the font and colour specifications to your own system (or throw them out) and the "goto" instructions for formatting as well.

Code: Select all

${font Open Sans:Bold:size=12}${color}mounted ${color0}${hr 2}$color$font$

${font Open Sans:size=12}Data ${goto 80}${fs_used /media/DATA} / ${fs_size /media/DATA}   ${goto 220} ${color5}${fs_bar 8,250 /media/DATA}${color}  ${goto 500}${fs_free_perc /media/DATA}% frei ${color} ${goto 580}I/O: ${color5}${diskio_read /dev/disk/by-label/DATA}${color}  :  ${color5}${diskio_write  /dev/disk/by-label/DATA}${color}
 
${font Open Sans:size=12}evo850 ${goto 80}${fs_used /media/evo850} / ${fs_size /media/evo850}   ${goto 220} ${color5}${fs_bar 8,250 /media/evo850}${color}  ${goto 500}${fs_free_perc /media/evo850}% frei ${goto 580}I/O: ${color5}${diskio_read /dev/disk/by-label/evo850}${color}  :  ${color5}${diskio_write  /dev/disk/by-label/evo850}${color}
in my case it is also a matter of the fact that they have to fit into a rather wide conky, since my conky is 700px wide.
mounted.jpg

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 6:42 pm
by Mjaakko
wdscharff wrote: Mon Sep 18, 2023 12:08 pm i have already listed the corresponding conky commands above...
That I already saw but what's under Root and Home.... syntax for Total/use: 243 GIB/31,1 GIB. Does it show HDD capacity or the / and /home. Until now, after several Google searches, only Inxi shows total capacity but doesn't work with Conky. Also, not with FvwmConsole.

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 6:52 pm
by siamhie
@Mjaakko The link I posted (http://ifxgroup.net/conky.htm#fs_bar) has all the conky variables regarding hard drive information that can be shown.

Re: Conky hard disk info

Posted: Mon Sep 18, 2023 8:42 pm
by entropyfoe
Is what you want found in the MX-Antix17 conky?

Those last four lines provide the memory, swap, root partition, and data disk; both amount used, and the total size.

Code: Select all

....
${if_up $template4}
${color}$template4 up: $alignr${color3} ${upspeed $template4}
${color}$alignr${upspeedgraph   $template4 25,170 5599cc 5599cc}
${color}$template4 down: $alignr${color3} ${downspeed $template4}
${color2}$alignr${downspeedgraph $template4 25,170  5599cc 5599cc}${endif}${if_up $template5}
${color}$template5 up: $alignr${color3} ${upspeed $template5}
${color}$alignr${upspeedgraph   $template5 25,170 5599cc 5599cc}
${color}$template5 down: $alignr${color3} ${downspeed $template5}
${color2}$alignr${downspeedgraph $template5 25,170  5599cc 5599cc}${endif}${if_up $template6}
${color}$template6 up: $alignr${color3} ${upspeed $template6}
${color2}$alignr${upspeedgraph   $template6 25,170 5599cc 5599cc}
${color}$template6 down: $alignr${color3} ${downspeed $template6}
${color2}$alignr${downspeedgraph $template6 25,170 5599cc 5599cc}${endif}${if_up $template7}
${color}$template7 up: $alignr${color3} ${upspeed $template7}
${color2}$alignr${upspeedgraph   $template7 25,170 5599cc 5599cc}
${color}$template7 down: $alignr${color3} ${downspeed $template7}
${color2}$alignr${downspeedgraph $template7 25,170 5599cc 5599cc}${endif}
${color}${alignr}${color8}Used / Total
${color}mem:${alignr}$mem ${color3} /${color} $memmax
${color}swap:${alignr}$swap ${color3} /${color} $swapmax
${color}root:${alignr}${fs_used /} ${color3} /${color} ${fs_size /}
${color}Data:${alignr}${fs_used /media/Data} ${color3} /${color} ${fs_size /media/Data}
]]

Re: Conky hard disk info

Posted: Tue Sep 19, 2023 3:35 am
by wdscharff
Mjaakko wrote: Mon Sep 18, 2023 6:42 pm
That I already saw but what's under Root and Home.... syntax for Total/use: 243 GIB/31,1 GIB. Does it show HDD capacity or the / and /home. Until now, after several Google searches, only Inxi shows total capacity but doesn't work with Conky. Also, not with FvwmConsole.
Since root and /home are on the same partition for me, they are displayed together, otherwise I would have a different entry for /home, similar to the one for /DATA, which is my data partition to /home on the same SSD.
Here is the missing root/home

Code: Select all

${voffset 4}${color}${font Open Sans:Bold:size=12}Root and Home ${color0}${hr 3}
${font Open Sans:size=12}${color}total/use: ${fs_size /} / ${fs_used /} ${goto 230}${color5}${fs_bar 10,100 /}${color}${goto 350}Disk I/O: ${color5}${diskio /dev/nvme0n1p1}${color} ${goto 480}R: ${color5}${diskio_read /dev/nvme0n1p1}${color} ${goto 560}W: ${color5}${diskio_write /dev/nvme0n1p1}${color}  ${color}${goto 645}°C : ${color5}${hwmon 1 temp 3}${color}
ps: fs_size always shows the size of a partition not the whole ssd/hdd, which is of little interest to me because most of my ssd only has one partition and it occupies the entire space. Mi Inxi you can still see the space that all the disks have together, how much is occupied and how much is free. i think that's nice, but if you want to know that, you have to add half a dozen numbers in your head, the use of the calculator is legitimate, nowadays not everyone can do mental arithmetic :-)
Somewhere I also have a conky in which I have integrated inxi, but the same full package as with qsi. if you find the right command line, you can do a lot with inxi in conky, but not everything.

Re: Conky hard disk info  [Solved]

Posted: Thu Sep 21, 2023 8:27 am
by Mjaakko
siamhie wrote: Mon Sep 18, 2023 6:52 pm @Mjaakko The link I posted (http://ifxgroup.net/conky.htm#fs_bar) has all the conky variables regarding hard drive information that can be shown.
I checked but only for mounted partitions. Usually, for everything need sudo such as sudo fdisk -l. I spent hours searching and experimenting to get rid of inxi generated triangle characters. Found the trick. With sed, copy specified selected alpha, numeric and character symbols. This excludes garbage characters when not specified.

Code: Select all

sed 's/[^a-z  A-Z 0-9 . % ( )]//g' file.txt
Trick when using FvwmConsole:

Code: Select all

Exec inxi -b > ~/.fvwm/core/7Modules/ConkyBtn/tmp.txt

Exec grep 'Storage' ~/.fvwm/core/7Modules/ConkyBtn/tmp.txt | \ 
   sed 's/[^a-z  A-Z 0-9 . % ( )]//g' | \
   sed 's/12//g' > ~/.fvwm/core/7Modules/ConkyBtn/hdd-storage.conf
Conky

Code: Select all

${execp cat ~/.fvwm/core/7Modules/ConkyBtn/hdd-storage.conf | sed 's/  Local Storage/HDD/'}
Result:
HDD total 386.94 GIB used 322.16 GIB (83.2%)

Re: Conky hard disk info

Posted: Thu Sep 21, 2023 10:56 am
by siamhie
Mjaakko wrote: Thu Sep 21, 2023 8:27 am
siamhie wrote: Mon Sep 18, 2023 6:52 pm @Mjaakko The link I posted (http://ifxgroup.net/conky.htm#fs_bar) has all the conky variables regarding hard drive information that can be shown.
I checked but only for mounted partitions. Usually, for everything need sudo such as sudo fdisk -l.

I use blkid to find out all partitions on my system (mounted or not). sudo not required.

I spent hours searching and experimenting to get rid of inxi generated triangle characters. Found the trick. With sed, copy specified selected alpha, numeric and character symbols. This excludes garbage characters when not specified.

Code: Select all

sed 's/[^a-z  A-Z 0-9 . % ( )]//g' file.txt
Trick when using FvwmConsole:

Code: Select all

Exec inxi -b > ~/.fvwm/core/7Modules/ConkyBtn/tmp.txt

Exec grep 'Storage' ~/.fvwm/core/7Modules/ConkyBtn/tmp.txt | \ 
   sed 's/[^a-z  A-Z 0-9 . % ( )]//g' | \
   sed 's/12//g' > ~/.fvwm/core/7Modules/ConkyBtn/hdd-storage.conf
Conky

Code: Select all

${execp cat ~/.fvwm/core/7Modules/ConkyBtn/hdd-storage.conf | sed 's/  Local Storage/HDD/'}
Result:
HDD total 386.94 GIB used 322.16 GIB (83.2%)

@Mjaakko Glad you found a way to get it working. Mark your post (that worked) solved (check mark icon) so that others may find it useful.

Re: Conky hard disk info

Posted: Thu Sep 21, 2023 5:29 pm
by rasat
Thanks @Mjaakko you made it. I was following this topic with interest. Would be great to have one conky button in Fvwm. Here it is, embedded in one push button (FvwmButtons).

Image

Re: Conky hard disk info

Posted: Fri Sep 22, 2023 5:27 am
by Mjaakko
One more question, @rasat how did you get the Battery bar and percentage? Looked at different places but there are too many options and configs.

Re: Conky hard disk info

Posted: Fri Sep 22, 2023 3:51 pm
by rasat
Here is the battery syntax.

Code: Select all

${color2}${color grey}Battery:  \
${if_existing /sys/class/power_supply/BAT0/status}${voffset 1}${color6}${battery_bar 6,80 BAT0}  ${voffset -1}${color3}${battery_percent BAT0}%${endif}\
${if_existing /sys/class/power_supply/BAT1/status}${voffset 1}${color6}${battery_bar 6,80 BAT1}  ${voffset -1}${color3}${battery_percent BAT1}%${endif}

Re: Conky hard disk info

Posted: Sat Sep 23, 2023 5:09 am
by Mjaakko
Thanks, works ok.

This topic is [Solved} and has interesting posts.

Re: Conky hard disk info [Solved]

Posted: Sat Sep 23, 2023 6:46 am
by Eadwine Rose
Please click the checkmark next to the username in the post that holds the solution to mark the topic solved, thanks :)

Re: Conky hard disk info

Posted: Sat Sep 23, 2023 5:25 pm
by Mjaakko
Thanks, got the point. No need to edit first post title.