Warning: the following will delete all your containers and all your images. Make sure that you backup any precious data!
Remember what we said above: Docker will create the data and metadata files if they don’t exist. So the solution is pretty simple: just create the files for Docker, before starting it!
- Stop the Docker daemon, because we are going to reset the storage plugin, and if we remove files while it is running, Bad Things Will Happen©.
- Wipe out
/var/lib/docker
. Warning: as mentioned above, this will delete all your containers all all your images. - Create the storage directory:
mkdir -p /var/lib/docker/devicemapper/devicemapper
. - Create your pool:
dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1G count=0 seek=250
will create a sparse file of 250G. If you specifybs=1G count=250
(without the seek option) then it will create a normal file (instead of a sparse file). - Restart the Docker daemon. Note: by default, if you have AUFS support, Docker will use it; so if you want to enforce the use of the Device Mapper plugin, you should add
-s devicemapper
to the command-line flags of the daemon. - Check with docker info that Data Space Total reflects the correct amount.
From https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/