Adding and removing storage disks on a cloud server at your UpCloud control panel is easy, but the changes also require actions on the operating system level. Whether you are looking to increase data storage or making other changes to the disk configurations, this guide will help you to perform the required operations on Linux or Windows hosts.
Adding a new disk
Start by logging into your UpCloud control panel. Shut down the server in questions and go to the Disks tab in your Server settings.
Create a new disk with the preferred size by clicking the Add new disk text underneath your existing storage devices.
Give the new disk a size in gigabytes as required and name it, then click Accept to confirm.
After the attaching process is complete, power the server up again.
Connect to your server, for example, using SSH. Check the names of the storage disks currently attached using the following command.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 25G 0 disk └─vda1 253:1 0 25G 0 part / vdb 253:16 0 25G 0 disk
The disk you are looking for is usually the last on the list, and will not have partitions on it like vdb in the example above. Create a new partition on the new disk using fdisk. Replace the <disk> in the command below with the new disk name.
sudo fdisk /dev/<disk>
The utility will open its own command prompt showing Command (m for help): instead of the usual [email protected]:/$. The following one letter commands will be entered in the fdisk utility.
First, start a new partition configuration with n. Use default values by just pressing enter on each of the options, or type in the required parameter if no default value is given.
> n # Primary p, partition 1, start sector 2048, end sector at disk end.
If you are looking to install an OS on the new disk, make it bootable with command a.
> a # Partition 1 if asked.
Afterwards, you can check that the partition was configured properly, it should show something along the lines of the example underneath.
> p Device Boot Start End Sectors Size Id Type /dev/vdb1 * 2048 52428799 52426752 25G 83 Linux
If everything is in order, write partition changes to the disk with command w. In case there was a mistake in the setup, delete the faulty partition by entering the command d and then create a new one again with command n.
Once fdisk has finished writing the partition table to the disk it will exit and return you to the usual command prompt. Check that the new partition shows up using the lsblk command.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 25G 0 disk └─vda1 253:1 0 25G 0 part / vdb 253:16 0 25G 0 disk └─vdb1 253:17 0 25G 0 part
You should now see both storage disks and their partitions with their correct sizes. The disks will be named like vda or vdb and their partitions with the added partition identifier number e.g. vda1 and vdb1. Notice that some of the commands below require you to enter the disk name while others use the partitions.
Set up the partition with a file system type appropriate for your server. Ubuntu and other Debian variants should use EXT4 while CentOS 7 hosts might be using XFS instead.
# Creating an EXT4 file system on Debian, Ubuntu or CentOS 6.5 sudo mkfs.ext4 /dev/<partition>
# Creating an XFS file system on CentOS 7.0 sudo mkfs.xfs /dev/<partition>
With the formatting complete, you will next need to create a mounting point for the device. This is as simple as making a new directory where you wish to attach the disk, for example, /disk1 at your root directory.
sudo mkdir /disk1
Finally, mount the new storage disk on your system at the mounting point you just created.
sudo mount /dev/<partition> /disk1
The added storage space will now be available as a directory on your system.
Filesystem Size Used Avail Use% Mounted on /dev/vda1 25G 1.4G 23G 6% / /dev/vdb1 25G 44M 24G 1% /disk1
All done! You can then start using the new storage space.
Start by opening the Disk Management panel by right-clicking the Windows Start button and select Disk Management from the appearing list. Alternatively, type diskmgmt.msc in the search or run window and then pressing enter.
The newly attached storage device should be listed as the last disk in the bottom part of the window. Start by right-clicking the new disk and selecting Online to enable the device.
Next, you will need to initialize it by right-clicking the disk and selecting Initialize Disk.
In the next window, initialize the newly attached disk by selecting MBR and clicking OK.
Before the new disk can be accessed you will need to format it. Right-click the unallocated partition and select New Simple Volume. Go through the wizard, the default options are fine for most cases.
Once the volume creation wizard is done formatting the new partition, the device will show with blue indicator and report status as Healthy.
Done! You can then start using the added storage space as usual.
Removing an existing disk
Detaching a storage disk is a considerably simpler process than attaching one.
To ensure data integrity on your cloud server after the detachment, check that the host does not have active services using the disk being removed. Once you are sure it is safe to detach the device proceed with the steps below.
Unmount the disk being removed with the command underneath.
sudo umount <mounting point> # For example sudo umount /disk1
Then, shut down your server either with the Shutdown request at your UpCloud Control Panel or by using the command below in your server terminal.
sudo shutdown -h now
When the server is powered down, continue to your UpCloud control panel to remove the disk.
Open the Disk Management panel by right-clicking the Windows Start button and select Disk Management from the appearing list. Alternatively, type diskmgmt.msc in the search or run window and then pressing enter.
Right-click the disk you wish to remove and select Offline to turn off the device.
Detaching a disk
With your server powered down, go to your UpCloud control panel and open the Disks tab under the Server settings.
There are two ways of removing storage disks.
- Detaching a disk simply frees the storage and keeps the data for later use.
- Deleting a disk removes the device from the server and deletes all data on it.
Scheduled backups will continue to even while the disk is detached according to the settings and retention time. Any backups made from the original disk are retained when deleting disks and can be used to restore a deleted disk.
Click the Detach button on the disk you wish to remove.
Once the removal operation is complete, you can start up your server again.
When you are confident that your cloud server runs normally with the device removed, you can delete the detached disk at your UpCloud Control Panel in the My disk resources section under Disks menu.