Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check free disk space before starting Docker (#2092) #2097

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
FailureAction=reboot

[Service]
ExecStartPre=/usr/libexec/docker-disk-check
ExecStopPost=/usr/libexec/docker-failure
12 changes: 12 additions & 0 deletions buildroot-external/rootfs-overlay/usr/libexec/docker-disk-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Check if less than 128MiB is available on /mnt/data (4k block size).
if [ "$(stat -f /mnt/data -c '%f')" -lt 32768 ]; then
echo "The system is very low on disk space!"
echo "This can cause Docker to fail to start, causing a boot loop."
echo "Asking systemd-journald to free up some space."
# systemd-journald defaults to 10% of disk size. So this should free up
# space for any system which has been running for a while (presumably it
# has when there is no space) and has a disk size larger than ~2.5GiB.
journalctl --vacuum-size=256M
fi