Why use volumes?
A volume is an attachable block storage device, similar to an external hard drive. You can attach a volume to one instance at a time. Use volumes to store important data you want to reuse, even when your instance is deleted. You can also use a volume for data you want to move from one instance to another.
Attached volumes are automatically stored under /mnt/vol_<letter> and formatted with the ext4 file system. You can always reformat these volumes or store them differently.
How to create a new volume?
Navigate to the Volumes section (Compute > Volume) and click “Create New Volume” on the bottom right. First, specify the name and add a description. Then choose the size (in GiB) and click “Create Volume”. The File system is automatically set to ext4.
How to attach the volume to an instance?
In the Volumes section (Compute > Volumes) click on the name of the Volume you want to attach. You will be directed to the details page of that volume. Chose an instance from the dropdown menu in the box on the right side. Click then on “Attach to Instance”.
To get an overview of all volumes attached to an instance, click on the instance details page (Compute > Instances > click on the name of the instance). You find a list of attached volumes on the bottom - including the volume device names and the location of storage.
How to detach a volume from an instance?
Navigate to the details page of the volume (Compute > Volumes > click on volume name) you want to detach from a particular instance. Click the detach button next to the instance name in the box on the right side.
To avoid corruption of your data, it is highly recommended to run the unmount command before detaching the instance.