Difference between revisions of "Volumes"
(Created page with "Volumes are detachable block storage devices that are stored volumes on a fault-tolerant distributed filesystem, and can be attached and detached from virtual machine instance...") |
|||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | Volumes are detachable block storage devices that are stored volumes on a fault-tolerant distributed | + | Volumes are detachable block storage devices that are stored volumes on a fault-tolerant distributed block storage cluster (Ceph RBD), and can be attached and detached from virtual machine instances on the fly. |
== Use cases == | == Use cases == | ||
Line 9: | Line 9: | ||
== Managing volumes == | == Managing volumes == | ||
− | Start off by creating a new, empty volume. Head over to the [https://dynamic.lunanode.com/panel/volumes | + | Start off by creating a new, empty volume. Head over to the [https://dynamic.lunanode.com/panel/volumes volume management page], enter a label (like "myvolume") and a size in gigabytes, and press the create button. Note that volume storage is charged at $0.03 per GB per month, billed hourly. |
After a few seconds, your volume should be ready. You can view volume details by selecting the name from the volume list. | After a few seconds, your volume should be ready. You can view volume details by selecting the name from the volume list. | ||
− | Once the status on the volume details page shows as '''available''', the volume is ready to be attached to a virtual machine instance. You can select the virtual machine from the dropdown and hit "Attach volume" (leave target device as auto; if that fails, then try setting it to /dev/vdc). | + | Once the status on the volume details page shows as '''available''', the volume is ready to be attached to a virtual machine instance. You can select the virtual machine from the dropdown and hit "Attach volume" (leave target device as auto; if that fails, then try setting it to /dev/vdc or /dev/hdc, depending on your disk driver). |
Now, login to your virtual machine; in /dev, you should see the volume appear now. You will want to format it so that you can mount it as a filesystem on your VM: | Now, login to your virtual machine; in /dev, you should see the volume appear now. You will want to format it so that you can mount it as a filesystem on your VM: | ||
<nowiki>mkfs.ext4 /dev/vdc | <nowiki>mkfs.ext4 /dev/vdc | ||
− | mkdir /mnt/ | + | mkdir /mnt/myvolume |
mount /dev/vdc /mnt/myvolume</nowiki> | mount /dev/vdc /mnt/myvolume</nowiki> | ||
− | Then, you will be able to access the volume via '''/mnt/myvolume'''. | + | Then, you will be able to access the volume via '''/mnt/myvolume'''. (Note that the device might be '''/dev/hdc''' or '''/dev/sdc''' or something else instead of '''/dev/vdc'''.) |
+ | |||
+ | You can also boot a new virtual machine instance from a volume by selecting the volume in the VM creation page. The volume must be available or this will throw an error. | ||
+ | |||
+ | '''Note for IDE driver''': if you are using IDE driver (didn't select virtio when adding an image; Windows for example does not natively support virtio) then you will need to shut-down your VM prior to attaching the volume. The "auto" target will also not work, you should enter /dev/hdc instead. |
Latest revision as of 18:28, 23 January 2017
Volumes are detachable block storage devices that are stored volumes on a fault-tolerant distributed block storage cluster (Ceph RBD), and can be attached and detached from virtual machine instances on the fly.
Use cases
- Keep non-disposable data, such as database files or images, on a detachable volume. Then, if you need to terminate the virtual machine instance for some reason (such as OS upgrade), you can simply detach the volume from the old instance and attach it to a new one.
- If a host node fails, you can transfer the volume to a different VM and remain online.
- Increase the capacity of your virtual machine (volumes are stored on DFS so can have larger capacity than a locally-stored VM).
Managing volumes
Start off by creating a new, empty volume. Head over to the volume management page, enter a label (like "myvolume") and a size in gigabytes, and press the create button. Note that volume storage is charged at $0.03 per GB per month, billed hourly.
After a few seconds, your volume should be ready. You can view volume details by selecting the name from the volume list.
Once the status on the volume details page shows as available, the volume is ready to be attached to a virtual machine instance. You can select the virtual machine from the dropdown and hit "Attach volume" (leave target device as auto; if that fails, then try setting it to /dev/vdc or /dev/hdc, depending on your disk driver).
Now, login to your virtual machine; in /dev, you should see the volume appear now. You will want to format it so that you can mount it as a filesystem on your VM:
mkfs.ext4 /dev/vdc mkdir /mnt/myvolume mount /dev/vdc /mnt/myvolume
Then, you will be able to access the volume via /mnt/myvolume. (Note that the device might be /dev/hdc or /dev/sdc or something else instead of /dev/vdc.)
You can also boot a new virtual machine instance from a volume by selecting the volume in the VM creation page. The volume must be available or this will throw an error.
Note for IDE driver: if you are using IDE driver (didn't select virtio when adding an image; Windows for example does not natively support virtio) then you will need to shut-down your VM prior to attaching the volume. The "auto" target will also not work, you should enter /dev/hdc instead.