azlux / log2ram

ramlog like for systemd (Put log into a ram folder)
MIT License
2.62k stars 193 forks source link

Handle sparse files correctly #217

Closed vxrtns closed 3 months ago

vxrtns commented 10 months ago

See issue #138. Right now, big sparse files (e.g. log files with big "holes" in them, like /var/log/lastlog when users/groups with large ids exist) take up much space when written to disk, because they are written as regular files, not sparse files. rsync supports --sparse in combination with --inplace since version 3.1.3 which was published early 2018.

azlux commented 10 months ago

Hello, I didn't knew about this option. Are you sure about it ? When I read the man page, I see:

Try to handle sparse files efficiently so they take up less space on the destination. Conflicts with --inplace because it's not possible to overwrite data in a sparse fashion.

The option inplace is used to avoid overwriting file on the SDcard.

vxrtns commented 10 months ago

Hi, as I mentioned, version 3.1.3 or later of rsync is needed. The last supported Debian version, Buster, has rsync 3.1.3 (see here), Bullseye and Bookworm have even newer ones. So all current Debian versions support the needed rsync version 3.1.3. Because of that checks shouldn't have to be implemented.

You're somewhat right with the man page, but it seems to be an old one. If you look at these lines in a commit that was merged into rsync version 3.1.3, you can see the man page was updated with a new text that says usage of --sparse in combination with --inplace is possible and just doesn't copy the holes in a file (as it's intended to be with sparse files), starting with rsync 3.1.3.

azlux commented 3 months ago

Sorry for the long delay. If still actual, We can test the feature for log2ram testers on the next beta release.

vxrtns commented 3 months ago

Yes, the problem still persists. Would be nice if you could include it for testing.