Symptoms

A ploop-based container cannot be resized with a following error:

~# vzctl set 101 --diskspace 250G --save
Resize the image /vz/private/101/root.hdd to 262144000K
dumpe2fs 1.41.12 (17-May-2010)
Failed to resize image /vz/private/101/root.hdd: Unable to change image size to 524279808 sectors, minimal size is 795978752
Saved parameters for Container 101

However, real consumption is less than 250G:

~#vzctl exec 101 df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/ploop42782p1     196G  125G   48G  73% /
tmpfs                 1.0G     0  1.0G   0% /lib/init/rw
tmpfs                 1.0G     0  1.0G   0% /dev/shm

Container may have a huge balloon:

~# ploop-balloon show -m /vz/root/101/
Current size of hidden balloon is 69986156544 bytes

Cause

One of the possible reasons is that the container had its diskspace limit set to a significantly greater value than it is right now, or converted from VZFS to ploop, and source container had relatively high diskinodes limit. Such containers have filesystem with a huge space reserved for inodes table, e.g. container with 5 Tb diskspace limit will have ~70Gb reserved for the inodes table.

Resolution

To resolve the issue offline resize should be performed.

  1. Stop the container:

    ~# vzctl stop 101
    
  2. Resize the container in offline mode:

    ~# vzctl set 101 --diskspace 250G --save --offline
    

NOTE: At least the same amount of space consumed by the container should be free on the node to perform offline resize operation.

Internal content