<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div><br></div><div>On Wed, Jun 1, 2022, at 5:36 AM, Colin Guthrie wrote:<br></div><blockquote type="cite" id="qt" style=""><div>Goffredo Baroncelli wrote on 31/05/2022 19:12:<br></div><div><br></div><div>> I suppose that colin.home is a sparse file, so even it has a length of <br></div><div>> 394GB, it consumes only 184GB. So to me these are valid values. It <br></div><div>> doesn't matter the length of the files. What does matter is the value <br></div><div>> returned by "du -sh".<br></div><div>> <br></div><div>> Below I create a file with a length of 1000GB. However being a sparse <br></div><div>> file, it doesn't consume any space and "du -sh" returns 0<br></div><div>> <br></div><div>> $ truncate -s 1000GB foo<br></div><div>> $ du -sh foo<br></div><div>> 0 foo<br></div><div>> $ ls -l foo<br></div><div>> -rw-r--r-- 1 ghigo ghigo 1000000000000 May 31 19:29 foo<br></div><div><br></div><div>Yeah the file will be sparse.<br></div><div><br></div><div>That's not really an issue, I'm not worried about the fact it's not <br></div><div>consuming as much as it reports as that's all expected.<br></div><div><br></div><div>The issue is that systemd-homed (or btrfs's fallocate) can't handle this <br></div><div>situation and that user is effectively bricked unless migrated to a host <br></div><div>with more storage space!<br></div></blockquote><div><br></div><div>Hopefully there's time for systemd-252 for a change still? That version is what I expect to ship in Fedora 37 [1] There's merit to sd-homed and I want it to be safe and reliable for users to keep using, in order to build momentum. <br></div><div><div><br></div><div>I really think sd-homed must move the shrink on logout, to login.<br></div><div><br></div><div><div>When the user logs out, they are decently likely to immediately close the laptop lid thus suspend-to-ram; or shutdown. I don't know if shrink can be cancelled. But regardless, there's going to be a period of time where the file system and storage stacks are busy, right at the time the user is expecting *imminent* suspend or shutdown, which no matter what has to be inhibited until the shrink is cancelled or completed, and all pending writes are flushed to stable media.<br></div><div><br></div><div>Next, consider the low battery situation. Upon notification, anyone with an 18+ month old battery knows there may be no additional warnings, and you could in fact get a power failure next. In this scenario we have to depend on all storage stack layers, and the drive firmware, doing the exact correct thing in order for the file system to be in a consistent state to be mountable at next boot. I just think this is too much risk, and since sd-homed is targeted at laptop users primarily, all the more reason the fs resize operation should happen at login time, not logout.<br></div><div><br></div><div>In fact, sd-homed might want to inhibit a resize shrink operation if (a) AC power is not plugged in and (b) battery remaining is less than 30%, or some other reasonable value. The resize grow operation is sufficiently cheap and fast that I don't think it needs inhibiting.<br></div><div><br></div><div>Thoughts?<br></div><div><br></div><div>I also just found a few bug reports with a non-exhaustive search that also make me nervous about fs shrink at logout (also implying restart and shutdown) time.<br></div><div><br></div><div>On shutdown, homed resizes until it gets killed<br></div><div><a href="https://github.com/systemd/systemd/issues/22901">https://github.com/systemd/systemd/issues/22901</a><br></div><div>Getting "New partition doesn't fit into backing storage, refusing"<br></div><div><a href="https://github.com/systemd/systemd/issues/22255">https://github.com/systemd/systemd/issues/22255</a><br></div><div>fails to resize <br></div><div><a href="https://github.com/systemd/systemd/issues/22124">https://github.com/systemd/systemd/issues/22124</a></div><div><br></div><div><br></div><div><br></div><div>[1]<br></div><div>Branch from Rawhide August 9, the earliest release date would be October 18.<br></div><div><br></div><div><br></div></div></div><div><br></div><div id="sig127415184"><div class="signature">--<br></div><div class="signature">Chris Murphy<br></div></div><div><br></div></body></html>