If you run out of disk space on your server, then there are two main ways to add more storage to your server.
Let’s take a look at each of them.
Method 1: Expanding Current Storage (Recommended)
RunCloud fully supports expanding the current storage of your server’s root (/
) partition.
This method is recommended when you need to increase your server’s storage capacity, and ensures compatibility with all RunCloud features and functionalities. After expansion, the increased storage should be reflected in the RunCloud panel automatically.
If you want to change the disk size of your VPS instance, you will need to do this from your VPS provider’s settings, not from the RunCloud dashboard.
In most cases, RunCloud will automatically detect the new size of your VPS instance, and continue managing and monitoring it as usual. However, sometimes you may need to manually increase the volume of your disk.
This tutorial will show you how to check the disk space size, resize the partition, and resize the file system on RunCloud.
Warning: Resizing your VPS instance may involve some risks. Make sure you have a backup of your server before you proceed with any disk resizing. You should also note that some VPS providers may not allow you to downgrade your VPS size after you upgrade it.
Step 1: Check the Disk Space Size
To see how much disk space you have, and how much has been used, you can use the df -h
command. This will show you the file system, size, used space, available space, percentage use, and mount point of each disk.
df -h
The /dev/root
disk is the main disk that contains the root directory (/
). You can see the size, space used, and available space of this disk, as well as the percentage of usage.
Step 2: Check the Partitions
To see how the disk is partitioned, you can use the lsblk
command with sudo
privileges. This will show you the name, major and minor number, removable flag, size, read-only flag, type, and mount point of each partition. For example:
sudo lsblk
Note down the name of your disk and partition. In the above example, the xvda
disk has one partition (xvda1
) that occupies the entire disk, and is mounted on the root directory (/
).
Step 3: Increase Disk Size
You will need to increase the size of your disk from your VPS provider’s settings. This will vary depending on which provider you use, but usually there is an option to resize or upgrade your disk in the dashboard or console.
You should refer to your provider’s documentation for more details.
Step 4: Resize the Partition
After increasing the disk size from your VPS provider’s settings, you will need to resize the partition on your server to reflect the change. You can use the growpart
command with sudo
privileges to do this.
You will need to specify the disk name (/dev/xvda
) and the partition number (1
) as arguments. For example:
sudo growpart /dev/xvda 1
After executing the above command, you should get an output similar to the following line:
CHANGED: partition=1 start=227328 old: size=41715679 end=41943007 new: size=62687199 end=62914527
This will extend the /dev/xvda1
partition to occupy the entire /dev/xvda
disk.
Step 5: Resize the File System
After resizing the partition, you will need to resize the file system on it to make use of the extra space. You can use the resize2fs
command with sudo
privileges to do this.
You will need to specify the partition name (/dev/xvda1
) as an argument. For example:
sudo resize2fs /dev/xvda1
The above command will resize the file system on /dev/xvda1
to match the partition size, and produce an output similar to the following line:
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/xvda1 is now 7835899 (4k) blocks long.
Step 6: Verify the File System Changes
To verify that the file system changes have taken effect, you can use the df -h
command again to see if the available space has increased.
In the above example, you can see that the /dev/root
disk now has a size of 30G
instead of 20G
.
You can also see the updated disk size in the RunCloud dashboard.
Method 2: Mounting New Storage (Not Recommended)
While it’s technically possible to mount new block storage to your server, this approach comes with several caveats and limitations when used with RunCloud:
- Newly mounted storage will not be reflected in the RunCloud panel.
- Even if you manage to make it visible in the panel, many aspects remain untested – and could potentially render your server unusable.
- Issues may arise related to file paths and permissions, which are critical for proper server operation.
- If you must add new block storage, you should be prepared to manage it independently of the RunCloud panel, as RunCloud won’t notify you if the additional disks run out of storage capacity.