Last active
August 29, 2018 21:10
-
-
Save gravcat/7b849ea40ce358fc83c324df5f0ddfc0 to your computer and use it in GitHub Desktop.
example of how to pick up and relocate docker to a new disk, data intact
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
#!/bin/bash | |
export DATA_DISK_DEVICE=/dev/nvme1n1 | |
export DATA_DISK_MOUNT=/data | |
sudo mkfs.ext4 $DATA_DISK_DEVICE | |
echo "$DATA_DISK_DEVICE $DATA_DISK_MOUNT ext4 defaults 0 0" | sudo tee -a /etc/fstab && sudo mount -a | |
sudo systemctl stop docker | |
sudo mv /var/lib/docker $DATA_DISK_MOUNT/docker | |
sudo ln -s $DATA_DISK_MOUNT/docker /var/lib/docker | |
sudo systemctl start docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
may have issue with some commands, see: moby/moby#3127 (comment)