You may want to create additional storage volumes or disks to attach to your VMs in addition to the root volume where the operating system resides.
Those will only be visible and mountable from that particular VM, so if you want to share this storage with other VMs, you may want to expose it through NFS. |
If you haven't created the instance yet, this is how you can provision extra volumes along with the creation of the instance itself
If you want to expand the storage of an existing instance with extra volumes, you can do so following these steps:
Before you begin, make sure the VM you will alter is ready for being rebooted! It may be better to shut it down cleanly. |
Current to 2022, there is a bug in Morpheus such that if the disk creation fails (e.g. due to hitting a quota limit), no error is reported. You can check in the instance details → storage if the disk is there before proceeding. |
That extra volume is not mounted (or even formatted) by default. You must log in to your VM and then follow the instructions below:
lsblk
, which shows disks (e.g. vda, vdb) and partitions on the disks (vda1, vda2, etc for partitions 1 & 2 on vda) You should expect to see something like this, showing vdb with no partitions:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 20G 0 disk ├─vda1 252:1 0 19.9G 0 part / ├─vda14 252:14 0 4M 0 part └─vda15 252:15 0 106M 0 part /boot/efi vdb 252:16 0 128G 0 disk |
vda is your root disk - do not reformat this! |
Create a single partition (number 1, so vdb1) filling the disk, labelled "data-1" here, and format it. You may use parted and mkfs.ext4:
Please change the label name to match what you called the new disk in the Morpheus interface (this is not a requirement, but reduces confusion later)
sudo parted --script -- /dev/vdb mklabel gpt sudo parted --script --align optimal -- /dev/vdb mkpart primary ext4 0% 100% sudo mkfs.ext4 -L data-1 /dev/vdb1 |
You may partition the disk differently and use any other filesystem type. It is a good idea to use the same name for the volume to set the label of the new filesystem |
echo "LABEL=data-1 /data1 ext4 defaults 0 0" | sudo tee -a /etc/fstab > /dev/null |
Create the directory where you are mounting your filesystem. Make sure you use the same path as defined in fstab:
sudo mkdir /data1 |
Mount the file system this first time around and check its ok. It should be automatically mounted on future reboots (test this now if it's important).
sudo mount -av |
Related articles
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|