How to decrease devicemapper/data file size?

i need to move the docker folder “/var/lib/docker” to another VPS but the “devicemapper/data” file take 100G and it actually used about 9G, I can’t move the folder because this file is too large
please help me to decrease his size

docker info
 Context:    default
 Debug Mode: false
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  scan: Docker Scan (Docker Inc., v0.21.0)

 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 20.10.21
 Storage Driver: devicemapper
  Pool Name: docker-253:1-17287261-pool
  Pool Blocksize: 65.54kB
  Base Device Size: 10.74GB
  Backing Filesystem: xfs
  Udev Sync Supported: true
  Data file: /dev/loop0
  Metadata file: /dev/loop1
  Data loop file: /var/lib/docker/devicemapper/devicemapper/data
  Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
  Data Space Used: 9.183GB
  Data Space Total: 107.4GB
  Data Space Available: 11.51GB
  Metadata Space Used: 24.63MB
  Metadata Space Total: 2.147GB
  Metadata Space Available: 2.123GB
  Thin Pool Minimum Free Space: 10.74GB
  Deferred Removal Enabled: true
  Deferred Deletion Enabled: true
  Deferred Deleted Device Count: 0
  Library Version: 1.02.170-RHEL7 (2020-03-24)
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1c90a442489720eec95342e1789ee8a5e1b9536f
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
   Profile: default
 Kernel Version: 3.10.0-1160.76.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.7GiB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
 Live Restore Enabled: false

WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release.
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
         Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.

I would not move the whole /var/lib/docker to anywhere. Instead of that I would create a backup of the volumes, restore it on the new server and just pull the images on the new server and run the containers using the same volumes and bind mounts.

Regardless of that, I think you are looking for this: Increase capacity on a running device

It is about increasing the capacity, but I guess the method is the same for decreasing it.

very thanks
i’m tried to move volumes and pull images and run it on new servers but there’s a container use another container, one for odoo and one for postgres and odoo linked to postgress. it’s not working for me.

but the article you mentioned is helped me to decrease the data file and I’m trying to move the folder now

very thanks :slight_smile: