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 working on other operations that depend on making changes to the disk configurations, this guide lists the steps to perform on Linux or Windows hosts.
Adding a new disk
Start by creating a new disk with the preferred size at the UpCloud Control Panel. Go to the Disks -tab in your Server settings, click the row underneath your existing storage drive to Add new disk. Give the new disk the required size and a name, then click Accept to confirm. After the attaching process is complete, turn on the server again.
Once your server is up and running you can continue with the process at the OS level. Find the operating system specific instructions below for the CentOS, Debian and Ubuntu distributions as well as Windows Servers.
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 30G 0 disk └─vda1 253:1 0 30G 0 part / vdb 253:16 0 30G 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 it’s 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 wizard 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 Blocks Id System /dev/vdb1 * 2048 62914559 31456256 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 30G 0 disk └─vda1 253:1 0 30G 0 part / vdb 253:16 0 30G 0 disk └─vdb1 253:17 0 30G 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 prefer 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 30G 4.0G 25G 14% / /dev/vdb1 30G 44M 28G 1% /disk1
Start by opening the Disk Management -panel by typing diskmgmt.msc in the search or run window and then pressing enter. On Windows Server 2012 you can alternatively right-click the Windows Start -button and select Disk Management from the appearing list.
When the management window opens, initiate the newly attached disk by selecting MBR and clicking OK.
If the initialization popup doesn’t appear, the disk is probably listed as Offline. Newly attached storage device is usually listed as the last disk in the bottom part of the window. Right-click the new disk and select Online to enable the device.
After bringing the disk online, you will need to manually initialize it by right-clicking the disk and selecting Initialize Disk.
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. 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>
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 safely shut down, you can continue removing the disk at your UpCloud Control Panel Disks -tab under Server settings by clicking the Detach -button on the disk you wish to remove.
Shut down your server over a Remote Desktop Connection.
With your server powered down, go to your UpCloud Control Panel Disks -tab under Server settings and 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.