/var/lib/docker to the new disk with sudo rsync -aHAX /var/lib/docker/ /mnt/data/docker/, add "data-root": "/mnt/data/docker" to /etc/docker/daemon.json and start Docker again. On new Docker 29 installs, images are stored by containerd in /var/lib/containerd, so move that folder too by setting root in /etc/containerd/config.toml.
Before you start
- Mount the new disk first, with an
/etc/fstabentry so it mounts at boot. This guide uses/mnt/data. See mount a new disk on Linux. - Use a local Linux filesystem such as ext4 or XFS. Docker’s docs warn against sharing one data directory between two daemons, for example over NFS.
- All containers stop while you move the data. Plan a short maintenance window.
- Back up your volumes or take a server backup first.
- Root users can leave out
sudo.
Where does Docker store its data?
Check which folder is large with
sudo du -sh /var/lib/docker /var/lib/containerd.
How to move the Docker data directory
1
Stop Docker
docker.socket as well stops it from starting Docker again on the next docker command. Wait until systemctl is-active docker prints inactive.2
Copy the data
-aHAX keeps permissions, owners, hard links, ACLs and extended attributes. The trailing slashes copy the folder’s contents.3
Set data-root
Create or edit Test it:It prints
/etc/docker/daemon.json. If the file already has settings, add the line inside the existing braces.configuration OK.4
Keep the old folder aside
5
Start Docker
How to move containerd’s image storage
Do this as well ifdocker info showed overlayfs, because your images are in /var/lib/containerd, which data-root doesn’t change.
1
Stop Docker and containerd
2
Copy the data
3
Set the new root
Open Leave
/etc/containerd/config.toml. The file installed with Docker has the line #root = "/var/lib/containerd". Remove the # and change the path:disabled_plugins = ["cri"] and the other lines as they are.4
Keep the old folder aside and start both services
How to check it worked
/mnt/data/docker. Your images, volumes and containers are all listed. Start your apps (docker compose up -d in each project folder) and check that their data is there. Containers with a restart policy start on their own.
When everything has worked for a few days, delete the old copies to free the space:
How to roll back
Stop Docker (and containerd), move the.old folders back to their original names, remove the data-root line (and set root back to /var/lib/containerd), then start the services again.
Frequently asked questions
Can I use a symlink instead of data-root?
Docker documents thedata-root setting for this, so use it. A symlink or bind mount of /var/lib/docker can work, but some tools resolve paths differently and it is harder to see later what you changed.
Can I move only the volumes?
Not with a Docker setting: volumes always live underdata-root. To keep a single app’s data elsewhere, use a bind mount in its compose.yaml, such as /mnt/data/nextcloud:/var/www/html.
Why is the disk still full after moving?
The old copy is still there until you delete the.old folders. Also check for large container logs, which log rotation limits.
My VPS got a bigger disk. Do I need to move Docker?
No. Grow the existing partition instead; see resize a partition after a disk upgrade.Related guides
VPS and dedicated server guides
Every guide in this section.
Mount a new disk
Format and mount the target disk.
Clean up Docker disk space
Free space before you move anything.
Back up Docker volumes
A safety copy before the move.
Fix No space left on device
When the disk is already full.
Checked against the official Docker daemon configuration documentation on 4 November 2026; the stop,
rsync, data-root and start steps tested on Ubuntu 24.04 LTS with Docker Engine 29.9.2 (images, volumes and containers all present afterwards), daemon.json validated with dockerd --validate, and the config.toml change checked with containerd config dump (containerd 2.4.2). Commands can differ on other distributions or releases.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026