Appendix D. Enabling Swap Partition
By enabling a swap partition on the EC2 instance where Veeam Backup for AWS is installed, you can prevent runtime issues on the backup appliance. The swap partition allows the system to allocate additional resources when the backup appliance runs out of physically allocated memory due to overload caused by multiple concurrent operations.
To enable the swap partition on the backup appliance, you must first create and attach an additional EBS volume to the EC2 instance running Veeam Backup for AWS, and then perform a number of configuration actions on the instance.
Creating and Attaching EBS Volume in AWS
To create a new EBS volume and attach it to the backup appliance, perform the following steps:
- Log in to the AWS Management Console using credentials of an AWS account where the backup appliance resides.
- Navigate to Services > Compute and click EC2. The EC2 console will open.
- To create the EBS volume, navigate to Volumes and click Create Volume. The Create volume wizard will open.
- At the Volume settings section of the wizard, do the following:
- From the Volume type drop-down list, select General Purpose SSD (gp3). For more information on EBS volume types, see AWS Documentation.
- In the Size (GB) field, specify the size of the volume. For swap partition purposes, it is recommended that you create an EBS volume with a minimum size equal to the memory size of the EC2 instance.
For more information on EC2 instance memory sizes, see AWS Documentation.
- In the IOPS field, specify the maximum number of input/output operations per second that the volume must provide. For swap partition purposes, 4000 IOPS is recommended.
- In the Throughput field, specify the throughput that the volume must provide. It is recommended that you specify the maximum throughput available for the selected volume size.
- From the Availability Zone drop-down list, select the availability zone in which the backup appliance resides.
- From the Snapshot ID drop-down list, select the Don't create volume from a snapshot option.
- If you want to encrypt the EBS volume, select the Encrypt the volume check box. You can either select a default KMS key from the KMS key drop-down list, which is automatically created by Amazon EBS in the specified AWS Region, or specify the amazon resource number (ARN) of the key in the Specify a custom KMS key window.
If you choose to encrypt the EBS volume, make sure that the EC2 instance type of the backup appliance supports Amazon EBS encryption. For more information, see AWS Documentation.
For more information on KMS keys, see AWS Documentation.
- At the Tags section of the wizard, you can specify AWS tags that will be assigned to the volume.
- Click Create volume.
- To attach the created EBS volume to the EC2 instance, select the volume from the Volumes list and click Actions > Attach volume. The Attach volume wizard will open.
- From the Instance drop-down list, select the EC2 instance running Veeam Backup for AWS.
The backup appliance and the EBS volume that you want to attach must reside in the same availability zone.
- In the Device name field, specify a name for the volume that will be used by Amazon EC2. Note that the name must conform the available device name rules, and it will be changed later by the block device driver when mounting the volume. For more information, see AWS Documentation.
- Click Attach volume.
Configuring Swap Partition on EC2 Instance
After you have attached the created volume to the backup appliance, you must perform a number of configuration actions to enable a swap partition:
- Connect to the EC2 instance where Veeam Backup for AWS is installed. To do that, run the following ssh command in a terminal window:
ssh -i /path/EC2_instance.pem key ubuntu@<Public DNS hostname or IPv4 address of the EC2 instance>
- To get a list of available volumes, run the following command:
You can identify the newly added volume by the absence by the mount point. Save the volume name for future reference.
- To create a swap file system on the new volume, run the following command:
sudo mkswap /dev/<volume_name> -L "vbaws_swap"
- To add the newly created file system to the /etc/fstab file, do the following:
- Open the file:
sudo nano /etc/fstab.conf
- Add the following file system label:
LABEL=vbaws_swap swap swap defaults,nofail 0 0
- Save the changes.
- To enable the swap partition, run the following command:
sudo swapon –all
- To confirm that the swap partition is enabled, run the following command:
- To allow Veeam Backup for AWS to use swap space preference, do the following:
- Open the file:
sudo nano /etc/sysctl.d/99-sysctl.conf
- Add the following variable to the file and set its value to 1:
vm.swappiness = 1
- Save the changes.
- Reload the /etc/sysctl.d/99-sysctl.conf file to apply the changes without rebooting EC2 instance:
sudo sysctl -p /etc/sysctl.d/99-sysctl.conf