udisks icon indicating copy to clipboard operation
udisks copied to clipboard

[RFE] Add GetUsed/AvailableSpace properties to the o.f.Udisks2.Filesystem

Open aruiz opened this issue 7 years ago • 6 comments
trafficstars

It is not possible to know the available or used space using UDisks2 having to fallback to parsing "df", Getter methods for Used and/or Available space would be handy.

aruiz avatar Sep 14 '18 15:09 aruiz

You can have a look at statvfs here: https://gitlab.gnome.org/GNOME/gnome-disk-utility/blob/master/src/libgdu/gduutils.c#L1713

pothos avatar Sep 15 '18 12:09 pothos

statvfs works if the filesystem is mounted, but not for an unmounted fs

aruiz avatar Sep 16 '18 20:09 aruiz

statvfs works if the filesystem is mounted, but not for an unmounted fs

The same applies to df, right?

vpodzime avatar Sep 21 '18 14:09 vpodzime

Sure, but as an example, GParted shows filesystem usage information even for unmounted partitions. This is handy for partition resizing (which is done on unmounted filesystems).

aruiz avatar Sep 21 '18 16:09 aruiz

We already have the functionality to get free blocks in libblockdev (for ext, vfat and ntfs) so it should be quite easy to implement this in udisks.

vojtechtrefny avatar Sep 24 '18 06:09 vojtechtrefny

There's a org.freedesktop.UDisks2.Filesystem.Size property that indicates actual size of the filesystem (incl. metadata, journal, etc.) on a block device, that can happen to be larger (think of a filesystem grow scenario).

However the Size property turned out to be a nightmare to keep updated as it generated too much I/O. We've worked hard to make the property value retrieval on demand, placing hack on top of other hacks to avoid breaking the public API.

So in case something like df is ever set to be added to UDisks, it will be a method call. I'm still not convinced we want it at all.

tbzatek avatar Jun 26 '23 14:06 tbzatek