Maintenance

Growing the disk image

Increasing the size of an encrypted disk is slightly more complicated than an unencrypted vps disk image. Because cryptops partitions the disk and the encryption adds another layer in the form of a virtual disk device, we need to grow several structures in the right order.

The first step is to grow the disk image at the virtualization level. How to do this depends on your cloud provider or self-hosted VPS setup. For a Greenhost VPS: log in to our Service Centre, and resize the disk image and restart the VPS as described in step 1 and 2 of this helpdesk article.

Instead of step 3, perform the following steps:

  • Log in to the initrd ssh server of the VPS (typically on port 2222), and input the password to boot it.

  • When the VPS is fully booted, log in again but now to the regular ssh server (typically on port 22).

  • Install the required software:

    sudo apt install cloud-utils cryptsetup xfsprogs
    
  • Grow the partition. Note the space before the 2.

    sudo growpart /dev/xvda 2
    
  • Grow the encrypted volume

    sudo cryptsetup resize xvda1_crypt
    
  • Grow the filesystem

    sudo xfs_growfs /
    

You can check with df -h / that the filesystem now has more space available.