92GB default.img

$ sudo ls -lh /var/snap/lxd/common/lxd/disks/default.img
-rw------- 1 root root 92G Aug 28 19:11 /var/snap/lxd/common/lxd/disks/default.img

Why do I have a 92GB default.img on my laptop?

$ lxd --version

Installed from the snap.

snap-id:      J60k4JY0HppjwOjW8dZdYc8obXKxujRu
tracking:     stable
refresh-date: 7 days ago, at 04:03 BST
  stable:        3.4         (8415) 57MB -
  candidate:     3.4         (8424) 57MB -
  beta:          ↑                       
  edge:          git-7427369 (8519) 57MB -
  3.0/stable:    3.0.1       (8028) 57MB -
  3.0/candidate: 3.0.2       (8332) 56MB -
  3.0/beta:      ↑                       
  3.0/edge:      git-927a1b7 (8453) 56MB -
  2.0/stable:    2.0.11      (8023) 28MB -
  2.0/candidate: 2.0.11      (8023) 28MB -
  2.0/beta:      ↑                       
  2.0/edge:      git-92a4fdc (8000) 26MB -
installed:       3.4         (8415) 57MB -

Because that’s what lxd init selected for you and you didn’t set it to something else then? :slight_smile:

The logic for the default value is:

  • 20% of free space available
  • Up to 100GB
  • At least 15GB

Sounds like your / had about 460GB of free space at the time of lxd init then.

Note that this is a sparse file, so that space isn’t actually in use, run du on the file to see how much is actually allocated by ZFS.

Thanks for the quick reply.

Yeah, my / is 460GB and now 96% full, and backups taking ages, so I’m regretting the defaults a little :slight_smile:

du as in du /var/snap/lxd/common/lxd/disks/default.img? Because that just says…

92G /var/snap/lxd/common/lxd/disks/default.img

Hmm, so looks like ZFS did end up using all that available disk space over time and it doesn’t know how to punch holes back into the sparse file, so it can grow but never shrink.

Your options at this point are somewhat limited since you can’t shrink a zpool.

It may be easiest to define a new ZFS storage pool in LXD and then move your containers over to that using the --storage option of lxc move. Once all the containers have been moved, you can update your default profile with lxc profile edit default and then delete the old storage pool with lxc storage delete.

1 Like