Skipping Swap Files and Partitions in VM Backup
Michael Bose, posted on July 17, 2017
If a machine does not have enough physical memory (RAM) to hold all application and OS data, the OS takes up some space on a hard disc to be used as a virtual memory, extending the RAM.
In Windows OS, this disc space is named a “swap file” and identified as pagefile.sys.
In Linux OS, the swap space is called a “swap partition”.
The size of any swap file/partition is typically set at about 1.5 times the total amount of RAM. So, swap files/partitions greatly enlarge the size of the backup/replica virtual machines: because swap data changes constantly, every time you run your backup or replication jobs the swap data is included in the backup/replica. That’s why it is reasonable to exclude these unnecessary swap files and swap partitions from a backup/replica.
To perform the swap file/partition exclusion, you need to make sure that the VM backup solution you use supports this operation. NAKIVO Backup & Replication automatically skips swap files and swap partitions during the backup process by default.
NOTE: The real amount of excluded data in a backup depends on how much actual swap was used.
Skipping Swap Files and Partitions with NAKIVO Backup & Replication
First, let’s log in to the product’s web interface, then go to the Configuration dashboard.
Under System settings, you can see that Skip swap files and partitions during processing is Enabled by default.
Let’s perform a backup with this option Enabled.
The backup of a Windows-based VM with skipped swap file transferred and stored 17.2 GB of data, as shown in the picture below.
The backup of a Linux-based VM with skipped swap partition transferred and stored 2.6 GB of data, as you can see in the picture below.
In this step, we will disable the Skip swap files and partitions during processing option:
After clicking Apply we can see that Skip swap files and partitions during processing is Disabled.
Finally, let’s perform a backup of the same VMs with the disabled Skip swap files and partitions during processing option.
The backup of the Windows-based VM with the swap file included took up 18.6 GB of the backup repository space, as shown in the picture below.
The backup of a Linux-based VM with swap partition included took up 10.0 GB of the backup repository space, as shown in the picture below.
Here’s the difference in size between the two runs:
|Backup with Swap Data Included, GB||Backup with Swap Data Excluded, GB||Skipped, GB|
The size of swap files and partitions within a backup depends on the amount of VM RAM and VM workload at the time the backup is created. This size can be large, like in our test with Linux (that is 7.4 GB), or small, like in our test with Windows (that is 1.4 GB). However, you need to keep in mind that swap data changes for every backup. If we take an average from the test above (8.8 GB / 2 = 4.4 GB) we’ll see that 10 VMs will generate almost a terabyte of swap data during one month (4.4 GB x 10 VMs x 22 working days = 968 GB) and this data has to be processed, transferred, and stored. But what if you have 20 VMs, or 50, 100, or more? The math is simple…
NAKIVO Backup & Replication does a great job by automatically skipping swap files and partitions in VMs. As a result, backups are created faster and take up less space in the backup repository.