Welcome, Guest Login

Support Center

Disk defragmentation in containers best practices

Last Updated: Sep 27, 2016 06:16PM UTC


This article describes how to perform container disk defragmentation on Parallels Virtuozzo Containers for Windows.

The following methods can be used to perform container's disk defragmentation:

  • Using vzctl defrag;
  • Switching the container disk to plain and then back to compact;
  • Using native Windows tools.

Avoiding high fragmentation

We suggest placing the \vz folder into a separate NTFS partition formatted with a 64K block size to reduce the container's root.efd file fragmentation:

Checking container fragmentation

It is possible to check a container's disk fragmentation level using either a custom batch script or native Windows tools:

Performing container defragmentation

Using vzctl defrag

vzctl defrag CTID

For additional disks:

vzctl defrag CTID --drive D:

NOTE: The command does not work for Windows 2008 R2 containers:

  • Article #2509297 Disk defragmentation for Windows 2008 R2 containers fails when you launch it using the vzctl utility

Switching the container disk to plain and then back to compact

vzctl set CTID --save --disktype plain
vzctl restart CTID
vzctl set CTID --save --disktype compact
vzctl restart CTID

For additional container disks, it is possible to use the --drive option:

vzctl set CTID --save --disktype plain --drive D:
vzctl set CTID --save --disktype compact --drive D:

NOTE: The operation requires around 1.5 times the container diskspace limit on a partition with container private areas.

NOTE: This operation may be time consuming, depending on the container diskspace limit and overall disk I\O activity.

Using native Windows tools 

Connect to the container (via RDP) and launch the defragmentation tool from the graphical interface or by using the command-line:

defrag /C /H /V

Note: native Windows​ defrag will not compact the efd image size in Windows 2008 R2

Open a new case

  • You can call our Support Team:

     +1 855-466-6670  Toll-free
     +1 425-689-7142  US
     +44 203-389-8331  UK
     +49 8914-379-4365  DE
     +7 499-609-2754  RU
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found