Skip to content

Instantly share code, notes, and snippets.

@mvxt
Last active December 15, 2020 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvxt/24458ab2ff2cefe66b86e8d15ed28da5 to your computer and use it in GitHub Desktop.
Save mvxt/24458ab2ff2cefe66b86e8d15ed28da5 to your computer and use it in GitHub Desktop.
Increasing number of inodes on DLC volume for machine executor, CircleCI
# Steps to reformat DLC drive and add more inodes. Should increase number from ~3m to ~52m
# Copy the contents of this file to a bash script and execute the script in a run step
# Alternatively, copy the commands into a multi-line command in the CircleCI config
function reformat() {
# (2) Stop Docker daemon
# If using Docker 18+, then use `sudo systemctl stop docker` instead
sudo service docker stop
# (3) Unmount the device
sudo umount /var/lib/docker
# (4) Force reformat the device
sudo mke2fs -FF -i 1024 /dev/sdb
# (5) Remount the device
sudo mount /dev/sdb /var/lib/docker
# (6) Restart Docker daemon
# If using Docker 18+, then use commented command instead
# sudo systemctl start docker
sudo service docker start
# (7) Create sentinel file for future jobs to check and avoid formatting
echo "formatted" > /var/lib/docker/inodes
}
# (1) Check sentinel file to see if volume already formatted. If not, reformat
test -f /var/lib/docker/inodes && reformat || echo "Already increased inodes. Skipping"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment