Created
September 7, 2024 12:41
-
-
Save chapmanjacobd/7674ee8f77e807ca87d265cdce47e044 to your computer and use it in GitHub Desktop.
re-sparse hydrated files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_sparse_file | |
set actual_size (du --block-size=1 "$argv" | awk '{print $1}') | |
set apparent_size (du --block-size=1 --apparent-size "$argv" | awk '{print $1}') | |
if test $actual_size -eq $apparent_size | |
return 1 | |
else | |
return 0 | |
end | |
end | |
for f in (fd -tf . /fs/.tmp/) | |
if is_sparse_file "$f" | |
fallocate --dig-holes "$f" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment