1

I'm running the (linux) docker version of SQL server on Mac. I have the main data directory for SQL server defined as a mounted docker volume at:

/var/opt/mssql/data

My docker disk usage has now hit 92Gb. I've gone into SQL server and removed some unused databases, which removed about 60Gb of data. How do I reclaim that space? Right now docker still shows the same disk usage. I've logged into the running docker container and verified that the database files are removed, but I'm unsure how to reclaim the space. If I run the mount command inside the container I can see the mounted volume:

/dev/sda1 on /var/opt/mssql/data type ext4 (rw,relatime,stripe=1024,data=ordered)

If I do a df this volume now appears to be only using 26Gb, assuming it really is the volume shown as /dev/sda1 here:

[root@4a74a4f096d2 data]# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          88G   26G   59G  31% /
tmpfs            64M     0   64M   0% /dev
tmpfs          1000M     0 1000M   0% /sys/fs/cgroup
/dev/sda1        88G   26G   59G  31% /etc/hosts
shm              64M     0   64M   0% /dev/shm
tmpfs          1000M     0 1000M   0% /proc/acpi
tmpfs          1000M     0 1000M   0% /sys/firmware

docker system df doesn't appear to be much use as it doesn't seem to even think the volume is in use:

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              9                   1                   5.091GB             3.162GB (62%)
Containers          1                   1                   86.85MB             0B (0%)
Local Volumes       2                   0                   20.5GB              20.5GB (100%)
Build Cache         0                   0                   0B                  0B

How can I reclaim this space? Thanks.

Hedley
  • 1,060
  • 10
  • 24

1 Answers1

0

I followed the steps on this question:

Docker filling up storage on macOS

The answer "Why Does the file keep growing?" shows you how to run an fstrim command:

docker run --rm -it --privileged --pid=host walkerlee/nsenter -t 1 -m -u -i -n fstrim /var/lib/docker
Hedley
  • 1,060
  • 10
  • 24