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. |
That extra volume is not mounted (or even formatted) by default. You must log in to your freshly created instance, and then follow the instructions below:
sudo echo 1 > /sys/class/block/vdb/device/rescan |
or, alternatively:
sudo apt-get install scsitools # or yum install scitools for CentOS sudo rescan-scsi-bus.sh |
Then you will be able to see the vdb disk when you run lsblk.
Create a partition and format it. You may use parted to do all in one go:
sudo parted -s -a optimal -- /dev/vdb mkpart primary ext4 0% 100% |
You may partition the disk differently and use any other filesystem type. |
Add this entry to your VM's /etc/fstab:
echo "/dev/vdb1 /data1 ext4 defaults 0 0" | sudo tee -a /etc/fstab > /dev/null |
If your VM uses disk IDs then use the following command to find the vdb ID and amend the line above as required:
echo "UID-$(blkid /dev/vdb) /data1 ext4 defaults 0 0" | sudo tee -a /etc/fstab > /dev/null |
Make 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
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.
|