You are not logged in.

#1 2016-06-15 08:10:57

alain.roger
Member
Registered: 2016-06-15
Posts: 5
Website

How to get real space used by network directory in Conky

Hi,

i use conky and the standard fs_used command in my case return the same result as in my NAS there is 3 mounted points sharing the same NAS disks
However, i would like to have the disk space used by each mounted point
/mnt/perso
/mnt/work
/mnt/storage

du -sh /mnt/perso requires about 10-15 minutes to return results which is not good at all and it is CPU consumming sad

is there a better way to get accurate value faster ? i mean on NAS volume of data change every time as some backup/sync are done and it is necessary for me to have an quickly overview.

thx

Offline

#2 2016-06-15 23:27:08

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: How to get real space used by network directory in Conky

Moved to GUI & Apps ... see here

Since fs_{something} uses mount points and you have three: /mnt/perso, /mnt/work, /mnt/storage I don't understand why they don't work.

With my partitions this works:

 15 Jun 16 @ 20:09:53 ~
  $ du -sh /media/5
49G	/media/5
 
 15 Jun 16 @ 20:20:16 ~
  $ du -sh /media/10
4.8G	/media/10
 
 15 Jun 16 @ 20:20:24 ~
  $ du -sh /home/sector11
2.3G	/home/sector11
 
 15 Jun 16 @ 20:21:09 ~
  $ 
${alignc}${color7}/S11${color}
${alignc}${fs_used /home}
${alignc}${fs_free /home}
${alignc}${fs_size /home}
${alignc}${color7}M/5${color}
${alignc}${fs_used /media/5}
${alignc}${fs_free /media/5}
${alignc}${fs_size /media/5}
${alignc}${color7}M/10${color}
${alignc}${fs_used /media/10}
${alignc}${fs_free /media/10}
${alignc}${fs_size /media/10}

This doesn't work for you?

${alignc}${color7}/mnt/perso${color}
${alignc}${fs_used /mnt/perso}
${alignc}${fs_free /mnt/perso}
${alignc}${fs_size /mnt/perso}
${alignc}${color7}mnt/work${color}
${alignc}${fs_used /mnt/work}
${alignc}${fs_free /mnt/work}
${alignc}${fs_size /mnt/work}
${alignc}${color7}mnt/storage${color}
${alignc}${fs_used /mnt/storage}
${alignc}${fs_free /mnt/storage}
${alignc}${fs_size /mnt/storage}

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2016-06-16 07:39:11

alain.roger
Member
Registered: 2016-06-15
Posts: 5
Website

Re: How to get real space used by network directory in Conky

in fact, du as fs_something do not work with NAS and my mounted points, as NAS is 1 filesystem but with several directory mounted as /mnt/perso, /mnt/work etc...

fs_used for /mnt/perso and /mnt/work returns the same values but in fact /mnt/perso should return 850GB and /mnt/work should returns 480GB

df returns also the same value for all mounted points.

everything works great when they should return value from different disk/drive, ut if 2 mounted points are on the same fs, it returns the same values....

like ${fs_used /home} and ${fs_used /} returns in conky script.... du does not, but du does not return correct value on NAS sad

Offline

#4 2016-06-16 08:19:59

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: How to get real space used by network directory in Conky

df gets its information from the filesystem 'superblock', which is updated after each operation on the filesystem, so that it contains up-to-date figures for space used.

There is no such info kept current and available per directory.

To know how much space a directory, and all its subfiles and subdirectories take up, you need to run 'du' on the directory, and that will inevitable take some time to compute.

If you want that info displayed in conky, one acceptable way to get it is ro run du on the directories you are interested in at regular intervals using a cron job, capture the 'du' output in a file and parse that file in conky.

Offline

#5 2016-06-16 16:35:03

alain.roger
Member
Registered: 2016-06-15
Posts: 5
Website

Re: How to get real space used by network directory in Conky

But even 'du' returns wrong value... it returns 255TB instead of 850GB (returned by Double COmmander - which is the correct value by the way)

Offline

#6 2016-06-16 17:24:49

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: How to get real space used by network directory in Conky

I've stepped back - but watching - as I have never seen this issue before.  Hope you find a solution alain.roger


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#7 2016-06-16 19:01:23

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: How to get real space used by network directory in Conky

alain.rogier wrote:

But even 'du' returns wrong value... it returns 255TB instead of 850GB

255TB looks like 'du' ran into some limit...
You don't have 255TB online, do you?

I did not know 'double commander' before you mentioned it. I have it installed now, but obviously I lack expertise on it. Is it possible to export that info to a file that can easily be scanned by conky?

Offline

#8 2016-06-18 13:34:20

alain.roger
Member
Registered: 2016-06-15
Posts: 5
Website

Re: How to get real space used by network directory in Conky

for sur no smile or should I ? tongue

in fact my NAS is 4x4TB max in JBOD but it is mounted as raid6 so i have a lot less.

in fact to have a correct value from du i must:
1. run it with sudo
2. use --apparent-size

but till now i didn't find any better solution and result sad

Offline

#9 2016-06-18 15:18:43

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: How to get real space used by network directory in Conky

Perhaps you should look into reorganizing your directory setup and split it up in static directories that don't change much in size on the one side and directories that do change in size more frequently.

Then you can run 'du' un the first type of directories less frequently than on the more dynamic libraries, and still have a means to follow up your global file usage?

Offline

#10 2016-06-18 18:54:21

alain.roger
Member
Registered: 2016-06-15
Posts: 5
Website

Re: How to get real space used by network directory in Conky

ok so in fact, to make it work correctly you have to:

1. sudo chmod u+s /usr/bin/du
2. now you can get right value with du -hs /mnt/perso

smile

Offline

Board footer

Powered by FluxBB