Files
libguestfs/cat
Pino Toscano b6bead0097 filesystems: fix size reporting for filesystems
The current way to get the size of a filesystem is to query the size in
bytes of the device. However, this gives the whole size of the device
where a filesystem is stored, and it does not consider the actual size
for which the filesystem is configured (e.g. in case it was shrunk).
A simple reproducer for this is:
$ guestfish -N test.img=fs:ext4:2G resize2fs-size /dev/sda1 1073741824

As result, try to mount the filesystem, and get its actual statistics to
determine its full size. In case mounting fails, fall back to the
previous method, which is still a good value in the majority of the
cases.

Thanks to: Erik Skultety.
2020-02-27 10:25:54 +01:00
..
2019-12-17 15:33:21 +01:00