🎉 Announcing new lower pricing — up to 40% lower costs for Cloud Servers and Cloud SQL! Read more →

Contents

Resizing a Cloud Server

Cloud Servers that use Block Storage instead of local SSD storage can be resized at any time.

Resizing to a larger type

When increasing the RAM amount, the resize can be initiated with the Cloud Server in active or inactive state.

  1. From the Cloud Server view, choose Resize from the Server Type details panel
  2. Choose the new Server Type you wish to resize to and click Save

The increased RAM and CPU allocations are made available to the Cloud Server straightaway but operating systems may handle this differently.

Typically, the increased RAM is recognised and usable straightaway, but any additional CPUs may need to be brought “online” to be used by the operating system, or may need to be shutdown and restarted.

Check how many CPUs are currently in use:

$ cat /proc/cpuinfo | grep processor | wc -l
2

Or, using lscpu we can get a bit more detail:

$ lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0    0      0    0 0:0:0:0          yes
1    0      1    1 1:1:1:1          yes
2    -      -    - :::               no
3    -      -    - :::               no

In this example, we have increased CPUs from 2 to 4 and the operating system recognises there are two additional CPUs present but they are not currently online.

Bring the additional offline CPUs online:

$ echo 1 | sudo tee /sys/devices/system/cpu/cpu[0-9]*/online

Confirm all CPUs are now online:

$ cat /proc/cpuinfo | grep processor | wc -l
4

or

$ lscpu -e
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0    0      0    0 0:0:0:0          yes
1    0      1    1 1:1:1:1          yes
2    0      2    2 2:2:2:2          yes
3    0      3    3 3:3:3:3          yes

Resizing to a smaller type

When decreasing the RAM amount the Cloud Server must be in inactive state (i.e shut down) before the resize request can be initiated. The reduced allocations will be available as soon as the Cloud Server is started again.

Configuring udev rules

The operating system can be instructed to bring new CPUs online immediately by creating a udev rule:

$ echo 'SUBSYSTEM=="cpu", ACTION=="add", DEVPATH=="/devices/system/cpu/cpu[0-9]*", TEST=="online", ATTR{online}!="1", ATTR{online}="1"' | sudo tee /etc/udev/rules.d/40-vm-hotadd-brightbox.rules

We can also use cloud-init user data to add the udev rule when the Cloud Server is initially created:

#cloud-config
# vim: syntax=yaml
write_files:
- path: /etc/udev/rules.d/40-vm-hotadd-brightbox.rules
content: |
    SUBSYSTEM=="cpu", ACTION=="add", DEVPATH=="/devices/system/cpu/cpu[0-9]*", TEST=="online", ATTR{online}!="1", ATTR{online}="1" 

Last updated: 04 Mar 2022 at 15:16 UTC

Try Brightbox risk-free with £50 free credit Sign up takes just two minutes...