How to configure the Disk Usage module?

duc index /var
Indexed 22759 files and 4779 directories, (1.8GB total) in 0.74 secs.

So You are Wrong @Adam

option that should be changed :

 # directory indexing
/usr/bin/duc index $INDEX_DIR --exclude=var --database=$DUC_DB

and only after it it make right graphs :slight_smile:

Good catch! You’re totally right! … except he wants to exclude /opt, not /var… :wink:

I have no files in /opt so for testing purpose i choose /var :slight_smile:

so Dear @Jim as workaroud make changes to:

vi /etc/e-smith/events/actions/nethserver-duc-index

   # directory indexing
/usr/bin/duc index $INDEX_DIR --exclude=opt --database=$DUC_DB

and after it run

signal-event nethserver-duc-save
2 Likes

Exactly,

I will try when I go back home.

@edoardo_spadoni please, could you help these nice guys? :smile:

Alessio we have already find rigth way :slight_smile:
as to @Adam you should make test of functionality before post , do not judge me it is only suggestion :slight_smile:

I do not think that FR required it this case.

I did test. It did not display the folder I specified, so it looked correct at first glance. I may be wrong, but I think the folder was still included in indexing, but was excluded from the export to xml, which is what the web ui is displaying. But what you mentioned was obviously the better and more accurate way to exclude a folder.

Since you’re so persistent in pointing out flaws, you may want to be sure and fully understand a problem before sending people commands to run on their server in the future. Just a suggestion.

It’s work

The disk usage have a better face now :grinning:
Thank you wery much @Adam, @Nas and @alefattorini

1 Like

I think we could add a prop (a variable in the configuration database) that lists excluded paths.
I’ve vague memories of thinking about it when we planned disk usage, but it seems that it was not implemented.

2 Likes

Recently an update newly incluse the /opt directory :grin:

I had to do again this tip

I made some tests trying to exclude some directories from the disk usage scan, but I never succeeded: excludes seem to be ignored.
It may be a problem in the tool we use (DUC) or an error on my side. I can’t figure it out.

Excluding /opt work fine for me😉
It’s the directory where I put my Time Machine Backup.

But sometime, a NethServer update is replacing the modified e-smith script.

Can I suggest to have a “user e-smith directory” that will never be swap by an update :grimacing:

@Nas wrote --exclude=opt, you are using --exclude=/opt ?
I recall I tried both and /opt was never excluded.
If you could confirm a working syntax, I’ll try to release an update which will support user-configurable exclusions.

The working syntax is

# directory indexing
/usr/bin/duc index $INDEX_DIR --exclude=opt -d $DUC_DB

@giacomo found why my tests with exclusions never worked: it’s a feature that needs additional development efforts from duc author:

1 Like

I have mouted some volumes from /etc/fstab ( see below )
Because of this the DUC Index did not work, a white screen and an error "Task completed with errors: S20nethserver-duc-index #1 (exit status 256) apeared in red above a white screen.

To solve the problem i removed the block "# remove backup dir elem"
from the file //usr/share/duc/xml2json.py

This is the part that seems to stop the DUC Index from working.

'# remove backup dir elem
if(child.attrib[‘name’] == a[0]):
size = recToDelete(child, a)
child.attrib[‘size_actual’] = str(int(child.attrib[‘size_actual’]) - size)
if(int(child.attrib[‘size_actual’]) < MIN_SIZE):
elem.remove(child)

On one of my servers this was the solution and the DUC Index works again.

On another server i wanted to exclude the /mnt folder from being displayed, it was easy to change this in the same file as above, i jus added a line below in the middle of the block called # remove fake folder.

‘# remove fake folder
for child in elem:
if( child.attrib[‘name’] == ‘dev’ or
child.attrib[‘name’] == ‘proc’ or
child.attrib[‘name’] == ‘sys’ or
’# child.attrib[‘name’] == ‘mnt’ or << Added this for example
child.attrib[‘name’] == ‘selinux’):
elem.remove(child)

It now looks like this, and the DUC Index does not show the /mnt (and subdirs) anymore.

On another server:

I also reoved the '# remove backup dir elem part as described above, but then changed the contents of /etc/e-smith/events/actions/nethserver-duc-index

Under the section: # directory indexing i added the following line

/usr/bin/duc index $INDEX_DIR --exclude=mnt --database=$DUC_DB

After running

signal-event nethserver-duc-save
/etc/e-smith/events/nethserver-duc-save/S20nethserver-duc-index

It seems te produce the same result as the the first method. The /mnt is not shown and the DUC Index works perfect.

Conclusion:
Whenever you see this message in place of your DUC Index:
S20nethserver-duc-index #1 (exit status 256) apeared in red above a white screen.

Check your DUC Index while your mounted storage volume(s) are dismouted.
Example:

umount -a
signal-event nethserver-duc-save
/etc/e-smith/events/nethserver-duc-save/S20nethserver-duc-index
NOW YOUR DUC INDEX WORKS ?

mount -a ( note the difference with above, now mounting again )
signal-event nethserver-duc-save
/etc/e-smith/events/nethserver-duc-save/S20nethserver-duc-index
AGAIN THE ERROR ?

Then remove the “# remove backup dir elem” block from //usr/share/duc/xml2json.py

For who want’s to know, i installed on a VM with a 150 GB SSD as /vdb1 and a 2TB Storage as /vdb2, I changed my /etc/fstab and used bind mounts to relocate some folders to the storage drives.

My /etc/fstab as sample:
/dev/vdb1 /mnt/bigstorage xfs defaults 0 0
/dev/vdb1 /mnt/backup_storage xfs defaults 0 0
/mnt/bigstorage/DATA/opt /opt nofail,x-systemd.device-timeout=1 bind 0 0
/mnt/bigstorage/DATA/media /media nofail,x-systemd.device-timeout=1 bind 0 0
/mnt/bigstorage/DATA/var/lib/nethserver /var/lib/nethserver nofail,x-systemd.device-timeout=1 bind 0 0
/mnt/bigstorage/DATA/var/www /var/www nofail,x-systemd.device-timeout=1 bind 0 0

For me, it fixed the bug…
Greetings from the Netherlands!
Bastiaan de Jonge // Xonline

2 Likes