Create extra disk
How can I add additional storage space/extra disk to my Virtual Machine (VM)?
To add additional storage to your VM, please follow the steps below:
- Open the Virtual Machine located under the Dashboard
- Select the Storage section.
- Select an extra disk size from the template (100GB, 500GB or 1000GB) or add the exact disk space you need.
- Click Create.
You’ve got … GB of storage!
How much disk space can I add to my VM?
You can add between 10GB and 10TB of disk space to your VM.
How to add an extra disk in OS?
The extra disk is not automatically added to the OS. You can add an extra disk to your VM by following the instructions below - depending on OS type, Linux or Windows.
- List information about all available block devices.
lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 364K 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 59.9G 0 part /
├─vda14 252:14 0 4M 0 part
└─vda15 252:15 0 106M 0 part /boot/efi
vdb 252:16 0 100G 0 disk
vdb block device is extra disk, without partition.
- Create partition for vdb block device.
parted -s -a optimal /dev/vdb mklabel gpt -- mkpart primary ext4 0% 100%
- Let’s check created partition for vdb.
lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 364K 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 59.9G 0 part /
├─vda14 252:14 0 4M 0 part
└─vda15 252:15 0 106M 0 part /boot/efi
vdb 252:16 0 100G 0 disk
└─vdb1 252:17 0 100G 0 part
vdb block device have partition vdb1 of 100GB storage space.
- Create filesystem for partition vdb1 (ext4 for example).
mkfs.ext4 /dev/vdb1
Output:
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 26213888 4k blocks and 6553600 inodes
Filesystem UUID: 01b6aa01-424d-4e68-86cd-88f028b04252
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
- Let’s mount created partition with ext4 filesystem to /mnt for example.
mount /dev/vdb1 /mnt
- Let’s check partition was successfully mounted on /mnt.
df -h
Output
Filesystem 1K-blocks Used Available Use% Mounted on
udev 997880 0 997880 0% /dev
tmpfs 203072 760 202312 1% /run
/dev/vda1 60782776 3852632 56913760 7% /
tmpfs 1015340 0 1015340 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1015340 0 1015340 0% /sys/fs/cgroup
/dev/vda15 106858 5313 101545 5% /boot/efi
tmpfs 203068 0 203068 0% /run/user/0
/dev/vdb1 102624184 24 97365000 1% /mnt
vdb1 ext4 partition mounted on /mnt, you can start use it!
- Please don’t forget to add this partition in /etc/fstab , is very iportant part for server reboot!
echo "/dev/vdb1 /mnt ext4 defaults 0 0" >> /etc/fstab
The /etc/fstab file is a system configuration file that contains all available disks, disk partitions and their options. Each file system is described on a separate line.
to be continued
Upgrade existing extra disk
VM action in Dashboard
- Open the instance located under the Dashboard.
- Select the Storage section.
- Select an extra disk size from template (100GB, 500GB or 1000GB) or add the exact disk space you need for the upgrade.
- Click Upgrade.
In this case, we need to upgrade the 100 GB of storage to 200 GB; add 100GB more.
Let’s check partition size for vdb
lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 364K 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 59.9G 0 part /
├─vda14 252:14 0 4M 0 part
└─vda15 252:15 0 106M 0 part /boot/efi
vdb 252:16 0 200G 0 disk
└─vdb1 252:17 0 100G 0 part
Block device now has a 200GB size, but vdb1 partition only has a 100GB size. Now, we can continue to the next steps.
Resize existing partition from vdb block device and filesystem.
- Grow partition 1 for blockdevice vdb.
growpart /dev/vdb 1
- Resize filesystem for vdb1 partition.
resize2fs /dev/vdb1
Let’s check again partition size for vdb
lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 364K 0 rom
vda 252:0 0 60G 0 disk
├─vda1 252:1 0 59.9G 0 part /
├─vda14 252:14 0 4M 0 part
└─vda15 252:15 0 106M 0 part /boot/efi
vdb 252:16 0 200G 0 disk
└─vdb1 252:17 0 200G 0 part
Now your Virtual Machine’s additional drive has been upgraded from 100GB to 200GB!