[systemd-devel] No space left errors on shutdown with systemd-homed /home dir

Chris Murphy lists at colorremedies.com
Sat Jan 29 18:01:54 UTC 2022


On Sat, Jan 29, 2022 at 2:53 AM Goffredo Baroncelli <kreijack at libero.it> wrote:
>
> I think that for the systemd uses cases (singled device FS), a simpler
> approach would be:
>
>      fstatfs(fd, &sfs)
>      needed = sfs.f_blocks - sfs.f_bavail;
>      needed *= sfs.f_bsize
>
>      needed = roundup_64(needed, 3*(1024*1024*1024))
>
> Comparing the original systemd-homed code, I made the following changes
> - 1) f_bfree is replaced by f_bavail (which seem to be more consistent to the disk usage; to me it seems to consider also the metadata chunk allocation)
> - 2) the needing value is rounded up of 3GB in order to consider a further 1 data chunk and 2 metadata chunk (DUP))
>
> Comments ?

I'm still wondering if such a significant shrink is even indicated, in
lieu of trim. Isn't it sufficient to just trim on logout, thus
returning unused blocks to the underlying filesystem? And then do an
fs resize (shrink or grow) as needed on login, so that the user home
shows ~80% of the free space in the underlying file system?

homework-luks.c:3407:                                /* Before we
shrink, let's trim the file system, so that we need less space on disk
during the shrinking */



-- 
Chris Murphy


More information about the systemd-devel mailing list