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 make other changes to the disk configurations, this guide will help you to perform the required operations on Linux and Windows hosts.

The server must be powered down before attaching or removing disks.

Contents

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.

Disk management view

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.

Creating new disk device

After the attaching process is complete, power the server up again.

Disk management view

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 Linux distributions and Windows servers.

Linux operations

Connect to your server, for example, using SSH. Check the names of the storage disks currently attached with the following command.

lsblk
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.

Partitioning and formatting the disk

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.

> w

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.

lsblk
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.

Mounting a new disk manually

Mounting a disk is as simple as making a new directory where you wish to attach the disk to, for example, /disk1 at your root directory.

sudo mkdir /disk1

Then, 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.

df -h
Filesystem  Size  Used  Avail  Use%  Mounted on
/dev/vda1    25G  1.4G    23G    6%  /
/dev/vdb1    25G   44M    24G    1%  /disk1

That is it, you can then start using the new storage space.

Remounting a new disk automatically

To enable the new storage disk to mount automatically at boot, you still need to add it in the fstab file. The fstab file contains descriptive information about the various file systems on your server and needs to be maintained properly. Each file system is described on a separate line in the order they should be mounted.

Start by checking the UUID of the new disk using the command below.

blkid
/dev/vda1: UUID="9dbc7ddd-5c2b-4e66-b284-ffd3f146c80b" TYPE="ext4" PARTUUID="861dadf7-01"
/dev/vdb1: UUID="3dfce0f1-1c50-455d-adbc-16bd1c0560a2" TYPE="ext4" PARTUUID="3b9f0276-01"

Note down the UUID of the new disk, usually the last on the list. Most systems use the UUID to identify disk devices in the fstab file but the /dev/<partiton> denomination would also work.

Next, open the fstab file with your favourite text editor and add the new disk description similarly to the examples according to your OS. Remember to set the <UUID of the new disk> like on the first line.

Below are shown examples of the fstab file from Ubuntu and CentOS.

# On Ubuntu or Debian
nano /etc/fstab
# <file system>                          <mount point> <type> <options>      <dump> <pass>
UUID=9dbc7ddd-5c2b-4e66-b284-ffd3f146c80b /             ext4   errors=remount-ro 0      1
UUID=<UUID of the new disk>               /disk1        ext4   defaults          1      2
# On CentOS
vi /etc/fstab
# <file system>                          <mount point> <type> <options> <dump> <pass>
UUID=e0c76c31-e8c6-49a1-879c-238266e0fb07 /             xfs    defaults  1      1
UUID=<UUID of the new disk>               /disk1        xfs    defaults  1      2

Once you have added the description of the new disk device, save the file and exit the editor.

All done! The new disk will now be always automatically mounted at boot.

Windows operations

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.

Windows bring disk online

Next, you will need to initialize it by right-clicking the disk and selecting Initialize Disk.

Windows initialize disk

In the next window, initialize the newly attached disk by selecting MBR and clicking OK.

Windows initializing new 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.

Windows create new simple volume

The formatting might take a moment depending on the size of the new volume. You can continue using the server normally until the process is completed.

Windows new volume ready

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 for either Linux or Windows hosts.

Linux

Unmount the disk being removed with the command underneath.

sudo umount <mounting point>
# For example
sudo umount /disk1

If you are permanently removing a disk that was configured to automount at boot, you will also need to remove the disk in question from the fstab file.

# On Ubuntu and Debian
nano /etc/fstab
# Or on CentOS
vi /etc/fstab

Delete the line describing the disk you want to remove. These are usually easiest to identify according to their mounting points. Then save the file and exit the editor.

Then, shut down your server either with the Shutdown request at your 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.

Windows

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.

Windows removing disk

Shut down your server at Windows over a Remote Desktop Connection or through the Web Console at your UpCloud control panel.

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.

  1. Detaching a disk simply frees the storage and keeps the data for later use.
  2. 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.

Disk management view

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.