Plasma 5: Keeping an Eye on the Disk Quota

At this year’s KDE conference Akademy, I was working on a small plasmoid to continuously track the disk quota.

The disk quota is usually used in enterprise installations where network shares are mounted locally. Typically, sysadmins want to avoid that users copy lots of data into their folders, and therefor set quotas (the quota limit has nothing to do with the physical size of a partition). Typically, once a user gets over the hard limit of the quota, the account is blocked and the user cannot login anymore. This happens from time to time, since the users are not really aware of the current quota limit and the already used disk space.

Disk Quota as Plasmoid

Here is where the “Disk Quota” plasmoid helps: Once added to the panel, it shows all quota limits when clicking on the plasmoid:

Disk QuotaOn mouse over, a nice tool tip shows the used quota in percent (in case multiple quota limits exist, the highest quota is displayed):

Disk Quota ToolTipWhen a quota is > 50% but smaller than 75%, the quota icon gets orange:

Disk Quota > 50% And if the quota is between 75% and 90%, the quota icon gets red: diskquota-mediumFinally, a quota > 90% will urge the user to cleanup data by showing a exclamation mark as well:

High Disk QuotaClicking on a quota entry will launch Filelight in the correct folder, if it is installed.

Disk Quota in System Tray

If the quota plasmoid is shown in the system tray (configure the systray and add it there), then the quota information is shown inline in the system tray popup:

Disk Quota in System TrayAs soon as the quota is equal to or greater than 50%, the quota icon automatically gets visible in the system tray panel:

Disk Quota - AttentionFinally, if the quota is >= 98%, the quota icon pulses to get the user’s attention (a nice Plasma 5 feature!).

To decrease the quota again, simply click on the respective quota entry in the list view. This launches Filelight with the correct location.

Code Internals

As of now, the Disk Quota plasmoid internally calls the command line tool ‘quota‘ to retrieve the quota information. The output of this tool is parsed and then interpreted to show the quota information as can be seen in the screen shots. If the quota command line tool is not installed, then the Disk Quota plasmoid shows diagnostics like this:

Disk Quota missingInfos for Packagers

Since Disk Quota uses the command line tool ‘quota’ and launches ‘filelight’ when clicking on quota entries, you should ship ‘quota’ and ‘filelight’ when installing this applet. Most certainly, this plasmoid is only useful for networked systems (with remote mount points) and enterprise installations.

Release Info

Status: Included in Plasma 5.5. ( Review Request: Disk Quota)

Credit where Credit is Due

During implementation lots of questions popped up. Thankfully, we were all at the KDE conference Akademy, and Kai, Sebas, Marco, Martin and the Visual Design group (for design help and icons) were there for quick help – Thanks a lot! Hope you all like the result :-)

6 thoughts on “Plasma 5: Keeping an Eye on the Disk Quota

  1. Looks better than the one I wrote, though it’s too bad about the code duplication. Mine (which is a KDE4 systray applet) has been at for a while now. I even have a pending request for some design help on the visual design forum but I guess nobody was aware of it.

    I’m looking forward to seeing how this one works in practise. A couple of questions:

    Does this handle quota-controlled volumes coming and going due to the automounter?

    Does this one handle soft quotas, hard quotas and grace times?

    Is there (or would you consider) a provision for ignoring tiny nonzero quotas? A single machine may have mounted a large number of filesystems for which the user has the smallest possible nonzero quotas to indicate that the user cannot store data on that volume. (A zero quota means “no quota” and users can make mode 777 directories to let others leach free space on their volume if you don’t do this.)

    1. Yes, I’ve seen this applet just after I finished mine…

      To be honest, my knowledge about quotas is rather limited. Right now, only the plain numbers ‘blocks’ and ‘soft limit’ are read. The soft limit is assumed to be 100%. If there are tricks like having only very low numbers, then the current code will probably break.

      Do you know all the corner cases we have to consider here? That would be great!!!

      1. I can’t say that I know all of the corner cases, but I’ve had to deal with several of them. It would probably be better to discuss this elsewhere. I think you have my email address so feel free to use it. And of course everything is in git if you want to look at it. (It’s all in python3.)

        Also, my applet allows the admin to map from device name to a readable specifier (so /storage/tibbs maps to “Storage Volume” and such; /home is mapped to “home directory” automatically). Users here don’t know much about filesystem paths.

    2. > Does this one handle soft quotas, hard quotas and grace times?

      Yes, it should: As long as ‘quota’ tells us about it, all is fine. Appearing quota are added, and vanishing ones are removed.

  2. Nice idea. I wonder whether it would make sense to integrate with regular disk free plasmoid, to have all information “how much space can I use?” in one place.


Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top