[Users] Fragmentation on VZ7

Gena Makhomed gmm at csdoc.com
Tue Nov 1 15:11:49 PDT 2016


On 01.11.2016 22:52, Chris James wrote:

> It doesn't seem to do anything if the container is running:

It works with running containers too.

pcompact do nothing if threshold is not exceeded.

/etc/vz/pcompact.conf

# Start compacting if unused space is greater than specified THRESHOLD 
in percent to ploop size
THRESHOLD=10

> [root at sovereign ~]# du -sch /vz/private/101/root.hdd/
> 114G    /vz/private/101/root.hdd/
>
> [root at sovereign ~]# vzctl exec 101 df -h /
> Filesystem         Size  Used Avail Use% Mounted on
> /dev/ploop42957p1  277G  101G  162G  39% /
>
> [root at sovereign ~]# /usr/sbin/pcompact
> ...
> Inspect 5120cb33-6817-4888-bd9a-fdbfa87b913e
> Inspect /vz/private/101/root.hdd/DiskDescriptor.xml
> Disk: /vz/private/101/root.hdd/DiskDescriptor.xml
> ploop=288000MB image=115754MB data=108013MB balloon=0MB
> Rate: 2.7 (threshold=10)

image=115754MB (114G)
data=108013MB (101G)
Rate: 2.7 (threshold=10)

> [root at sovereign ~]# du -sch /vz/private/101/root.hdd/
> 114G    /vz/private/101/root.hdd/
>
> [root at sovereign ~]# vzctl exec 101 df -h /
> Filesystem         Size  Used Avail Use% Mounted on
> /dev/ploop42957p1  277G  101G  162G  39% /
>
> [root at sovereign ~]# vzctl stop 101

!!! you have used 101G inside container.

after stop container - free space is changed to 57G

threshold is exceeded, and pcompact start to work.

> [root at sovereign ~]# /usr/sbin/pcompact
> ...
> pass4 group:2224 Relocated inodes:0, local:0 extents: 0, blocks 0
> Starting relocation
> Opening delta /vz/private/101/root.hdd/root.hds
> TRUNCATED: 116 cluster-blocks (121634816 bytes)
> ...
> < tons of output >
>
> [root at sovereign ~]# vzctl start 101
>
> [root at sovereign ~]# du -sch /vz/private/101/root.hdd/
> 76G    /vz/private/101/root.hdd/
>
> [root at sovereign ~]# vzctl exec 101 df -h /
> Filesystem         Size  Used Avail Use% Mounted on
> /dev/ploop42957p1  277G   57G  207G  22% /
>
> So I guess my question is am I expect to /stop/ and compact my
> containers regularly?

You have 44G *DELETED* *OPEN* files inside contaier.

This is not normal situation.

If you can't prevent such deleted but still open files -
you have only one way: restart containers (by cron?)
and run pcompact by cron after restarting containers.

Better way - prevent deleted but still open files
inside your containers, and use pcompact on running containers.

P.S.

Try to set THRESHOLD=1 in /etc/vz/pcompact.conf for better compacting.

-- 
Best regards,
  Gena


More information about the Users mailing list