Vultr Block Storage

Last Updated: Wed, Sep 16, 2020
FAQ Linux Guides

Introduction

Vultr's Cloud Block Storage technology allows you to mount high-performance scalable storage to your instance, making space management significantly more flexible. This storage is highly available, redundant, and SSD backed for superior performance. Block Storage is available in our New Jersey location.

Use this guide to manage your block storage.

Create Block Storage

Navigate to the Add Block Storage page in the customer portal.

  1. Select the block storage size.
  2. Enter a descriptive label.
  3. Click Add Block Storage.

Vultr will allocate your storage. Refresh the page and wait until you see Active in the status column before proceeding.

Attach to a Server Instance

You can attach block storage to one server in the New Jersey location at a time.

  1. Go to: https://my.vultr.com/blockstorage/
  2. Click on the pencil icon next to the volume to attach.
  3. Select the server instance from the drop down box.
  4. Click Attach.

The server instance will restart, and the block storage will be available as a new device.

Mount Block Storage - Linux

🛑 Warning: The commands below may destroy data on existing volumes. These instructions are for newly-deployed block storage volumes without data. Before proceeding, back up your files. Vultr does not have any backups of your block storage. Verify your backups and store them separately from the server instance.

Vultr snapshots and backups of server instances do not include block storage.

By default, Vultr does not create any filesystems on block storage volumes. Use these steps to initialize, delete all data, and mount the block storage volume.

  1. Verify the new device name. The first block storage device is connected to your server as /dev/vdb. Additional devices will be labeled /dev/vdc, /dev/vdd, and so forth. Use the lsblk command to verify your device name. This example shows a 10 GB volume available as /dev/vdb.

    # lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sr0     11:0    1 1024M  0 rom
    vda    252:0    0   55G  0 disk
    └─vda1 252:1    0   55G  0 part /
    vdb    252:16   0   10G  0 disk
    
  2. Create a new disk label using parted.

    # parted -s /dev/vdb mklabel gpt
    
  3. Make a primary partition to fill the entire disk.

    # parted -s /dev/vdb unit mib mkpart primary 0% 100%
    
  4. Create an EXT4 filesystem on the primary partition and format it.

    # mkfs.ext4 /dev/vdb1
    
  5. Make a mount point.

    # mkdir /mnt/blockstorage
    
  6. Add a blank line and a mount entry to /etc/fstab. This will automatically mount the block storage at /mnt/blockstorage at reboot.

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

    You can also manually mount the block storage without rebooting.

    # mount /mnt/blockstorage
    

Mount Block Storage - Windows

🛑 Warning: The commands below may destroy data on existing volumes. These instructions are for newly-deployed block storage volumes without data. Before proceeding, back up your files. Vultr does not have any backups of your block storage. Verify your backups and store them separately from the server instance.

Vultr snapshots and backups of server instances do not include block storage.

By default, Vultr does not create any filesystems on block storage volumes. Use these steps to initialize, delete all data, and mount the block storage volume. The following steps are based on Windows Server 2016, however the basic process is very similar for all current versions of Windows.

  1. Click "Start", search for "Computer Management", and launch it.
  2. Select "Storage -> Disk Management" on the left side menu.
  3. The right pane displays the current disk configuration. The first block storage device connected to your server is usually Disk 1. Additional devices will be Disk 2, Disk 3, and so forth. This example shows a 10 GB volume as Disk 1.

    Computer Management

  4. If the disk is offline, right-click on the new disk volume and select Online.

    Online

  5. Right-click on the new disk volume and select Initialize.

    Initialize

  6. Select MBR or GPT partition style and click OK.

    OK

  7. Right click on the Unallocated Space and select New Simple Volume.

    Simple Volume

    Follow the wizard to format and attach the volume.

Detach a Block Storage

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

  1. Go to https://my.vultr.com/blockstorage/
  2. Click on the pencil icon next to the volume that you wish to detach.
  3. Click Detach.
  4. The instance will restart.

Move Block Storage to a New Server

You can move block storage between servers, but take care to properly dismount the volume and remount it on the new server. 🤚 Attention: If you need to preserve data, do not re-partition, create a new filesystem, or perform the initialization steps that delete data.

How to Upgrade Block Storage

Expanding block storage requires two steps:

  • Upgrade block storage size in the customer portal
  • Resize your filesystem in the instance OS

Upgrade block storage size

  1. Navigate to your Vultr customer portal.
  2. Select Products.
  3. Click Block Storage.
  4. Click the Manage icon on the desired Block Storage instance.

    Block Storage

  5. Click the Size link to adjust the size.

    Edit Block Storage

  6. Enter the new size, type YES in the confirmation field, then click Continue.

    Upgrade Block Storage

  7. Reboot the attached server instance using the server control panel to apply the new size. Rebooting the OS from an SSH session will not apply the changes.

Resize the filesystem - Linux

You can resize your block storage to reflect the changes made in your panel with the growpart utility. The growpart utility is provided by cloud-init and is available for all major Linux distributions and *BSD.

  1. Unmount the block storage.

    # umount /mnt/blockstorage
    
  2. Use the lsblk command to verify the partition name. This example shows a 10 GB partiton as /dev/vdb1. Note that the mountpoint is blank, because it was dismounted in step 1.

    # lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sr0     11:0    1 1024M  0 rom
    vda    252:0    0   55G  0 disk
    └─vda1 252:1    0   55G  0 part /
    vdb    252:16   0   10G  0 disk
    └─vdb1 252:17   0   10G  0 part
    
  3. Grow the partition to fill all available block storage space.

    # growpart /dev/vdb 1
    
  4. Force a filesystem check before resizing.

    # e2fsck -fp /dev/vdb1
    
  5. Resize the filesystem to fill the entire partition.

    # resize2fs /dev/vdb1
    
  6. Remount the block storage.

    # mount /mnt/blockstorage
    

Resize the filesystem - Windows

  1. Click "Start", search for "Computer Management", and launch it.
  2. Select "Storage -> Disk Management" on the left side menu.
  3. The right pane displays the current disk configuration. The block storage device will have new unallocated space available. Right-click on the volume and select Extend Volume... as shown.

    Extend Volume

    Follow the wizard to extend the volume.

How to Downgrade Block Storage

It's not possible to perform an in-place downgrade or "shrink" block storage. If you'd like to move your files to a smaller block storage subscription, perform these steps:

  1. Make a backup of your block storage volume.
  2. Inventory your files to determine the space needed. Windows users can use Windows Explorer, while Linux users may want to use df.
  3. Create a new subscription of the correct size.
  4. Attach the new volume on your instance, then mount it.
  5. Copy your files from the larger block storage volume to the new, smaller volume. Use the tools appropriate for your platform.
  6. Detach the old block storage subscription.
  7. Your instance will reboot.
  8. Verify your new volume is correct.
  9. When satisfied with the new volume, destroy the old block storage subscription.

Frequently Asked Questions

Can I upgrade or downgrade block storage?

You can upgrade block storage by using the steps described here. You must resize your file system manually, which does pose the risk of possible data loss if performed incorrectly. You cannot perform an in-place downgrade of block storage, but you can use these steps to migrate your files to a smaller block storage subscription.

Can I mount block storage to different regions?

No. Block storage may only be attached to instances in the same region.

Can I make snapshots, or restore a snapshot of a block storage device?

No, this is not currently supported. Additionally, automated backup do not back up block storage volumes.

Can I mount block storage to multiple servers at the same time?

No, this is not possible.

Can I mount multiple block storage volumes to the same Vultr instance?

Yes, you can mount multiple volumes to the same instance. While there is no hard limit set, you should not mount more than 8 to 10 volumes to ensure system stability.

Can I mount a block storage volume on a Vultr dedicated instance?

No, this is not possible.

Want to contribute?

You could earn up to $300 by adding new articles