Attaching Block Storage

Published on: Mon, Jul 31, 2017 at 4:28 pm EST
FAQ System Admin

Block storage volumes attach to instances as additional disks. You must attach the volume to an instance before it can be used. Multiple volumes can be attached to a single instance, however you can only attach a volume to one instance at a time. When a volume is first created, it will be completely empty and will need to be partitioned and formatted within your instance's OS before it can be used by your instance.

Attaching the volume

  • Go to: https://my.vultr.com/blockstorage/
  • Click on the pencil icon next to the volume that you wish to attach.
  • Select the instance from the drop down box.
  • Click "Attach". The instance will restart.

Detaching the volume

Note: For Linux instances, you will need to remove the any references to the block storage volume from your /etc/fstab file before detaching to prevent system boot failure due to the OS waiting on a drive that no longer exists.

Preparing the volume - Linux

Linux will see the first block storage volume as /dev/vdb. If you attach additional volumes, they will appear as /dev/vdc, /dev/vdd, etc.

The following series of commands will format the volume with EXT4 and mount it under /mnt/blockstorage. If you wish to have another filesystem type or mount point, then you will need to modify the commands accordingly.

Create partitions.

parted -s /dev/vdb mklabel gpt
parted -s /dev/vdb unit mib mkpart primary 0% 100%

Create EXT4 filesystem.

mkfs.ext4 /dev/vdb1

Mount block storage.

mkdir /mnt/blockstorage
echo >> /etc/fstab
echo /dev/vdb1 /mnt/blockstorage ext4 defaults,noatime,nofail 0 0 >> /etc/fstab 
mount /mnt/blockstorage

Preparing the volume - Windows

The following steps are based on Windows Server 2016, however the basic process is very similar for all current versions of Windows.

  • Click on "Start" and search for "Computer Management". Once it appears, select it to bring up the "Computer Management MMC".
  • Select "Storage -> Disk Management" on the left side menu.
  • The right pane will show the disks on the system and the current configurations.
  • Right click on "Disk 1" and select "Initialize". Confirm with "OK".
  • Right click on the "Unallocated Space" on "Disk 1" and select "New Simple Volume". Follow the wizard to format and attach the volume.

Want to contribute ?

You could earn up to $300 by adding new articles