Attaching Volumes to a Linux VM
To attach a volume to one of your running virtual machines, locate the new volume and click the icon on the right side of the page.
You should now see "Attach Volume" overlay. Click the drop down and choose the VM to which you would like to attach the volume.
You should now see the drive state as ready and the VM to which it is attached. However, some versions of Linux may have implemented auto-discovery differently. Be prepared to reboot your instance in order to discover the new device.
NOTE: Sometimes, the volume will not attach to a running instance. This could happen if your instance does not have the correct PV drivers installed. Should this happen, you can can attach the volume to the instance if it is first stopped.
The next steps will be completed within the VM. Login to your VM as follows: ssh root@<VM IP ADDRESS>
Verify that you can see the newly attached device in "/dev". By default, the base OS is installed on "/dev/sda1". All additional attached volumes will be labeled in alphabetical order: e.g. /dev/sdb, /dev/sdc, etc.. If this is the first additional volume attached, it should be labeled "/dev/sdb"
To make use of the new volume, you have to now format it for the filesystem of choice (ext3, ext4, xfs, etc). Use the appropriate formatting tool. Eg., if you choose ext3, run "mkfs.ext3 /dev/sdb".
Your new volume is now usable and mountable. Create a mount point for this volume.You can use any valid name supported by the operating system. Run "mkdir -p / <ANY NAME YOU CHOOSE>.
To mount the volume, run "mount /dev/sdb / <ANY NAME YOU CHOOSE>. NOTE: Use the correct device path if it is something other /dev/sdb.
Your new volume is now mounted and ready for use. To verify the mount was successful, run "df -h".
To make sure the volume is persistent through machine reboots, add a line to the "/etc/fstab" file. Please note that there are many options and flags that can be set based on your needs so make sure you set the correct ones. Here is an example.
If you add a new volume to /etc/fstab, make certain that the system can be rebooted if that volume is not accessible for some reason. If the volume is not accessible and /etc/fstab is set to check that volume before proceeding, the boot will fail. If instead you were to set the volume to be able to be skipped on boot, your system will proceed to boot successfully even if the volume is not accessible. You will then be able to correct whatever issue you may be having with the other volume.
To do that, using the above example, you could configure /etc/fstab as follows:
/dev/sdb /documentation ext3 nofail 1 2
If your VM will not boot, you may be able to fix the problem. Go HERE for instructions.