My docker-compose experiments filled up the 50G SSD partition pretty quick. I still had 500 GB of my 1TB drive unallocated, so I figured out how to make a mount, then symlinked the docker dir there.
Format the partition
(Linux Mint UI) Menu > Disks > 1.0 TB Hard Disk > Unallocated > + > Ext4
Investigate the file system
|
|
I saw a new /dev/db3
device
Mount the device
|
|
note: to mount on subsequent reboots:
WARNING: make a backup and verify before rebooting. This changing fstab could prevent your machine from booting.
https://askubuntu.com/a/154184/514799
Add this line to /etc/fstab:
|
|
Stop and remove all images
http://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images
|
|
Symlink the docker dir to the mount
https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169
- Become su:
su
- Make target dirs:
mkdir -p /mnt/pd0/docker
- Stop docker:
service docker stop
. Verify no docker process is runningps faux
- Double check docker really isn’t running. Take a look at the current docker directory:
ls /var/lib/docker/
- 2b) Make a backup -
tar -zcC /var/lib docker > /mnt/pd0/var_lib_docker-backup-$(date +%s).tar.gz
- Move the
/var/lib/docker
directory to your new partition:mv /var/lib/docker /mnt/pd0/docker
- Make a symlink:
ln -s /mnt/pd0/docker /var/lib/docker
- Take a peek at the directory structure to make sure it looks like it did before the mv:
ls /var/lib/docker/
(note the trailing slash to resolve the symlink)- Start docker back up
service docker start
- deactivate su:
exit
- restart your containers
This is a potential candidate for ansibleization