Vultr has a generous disk quota with the cloud servers you can set up. But what do you do when you want more space than the default allocation (for backup or application data)?
I have blogged before about setting up an Ubuntu server on the cloud on Vultr and configuring it if you do not already have a cloud server.
Vultr allows you to set up a server in minutes.
A Vultr $2.5 a month server comes with 20GB storage, a $20 a month server comes with 60GB of SSD storage.
Vultr does offer more storage for about 0.10c per GB. At this time or writing Vultr allows you to add more storage to serves in NY/NJ (only). Read my guide on moving data between servers with RSync. And cond forget yo secure your server with a free SSL certificate and secure it (read more here and here).
An additional 10GB of storage would cost $1/m.
An additional 50GB of storage would cost $5/m.
An additional 100GB of storage would cost $10/m.
An additional 250 GB of storage would cost $25/m
View the Vultr pricing calculator here. Vultr does say that you can resize your block storage volume but there are manual actions and risks involved so get the space you need early on and prevent resizing later.
Vultr did offer early customers in (limited location’s) a free 50GB storage (read more on these limits here).
I am going to spin up a Block storage and attach to my server in Sydney.
fyi: Read the official guide on Attacking Block Storage to a Vultr server.
2. Click Add Block Storage
3. Choose the size of your block storage volume.
Darn, I can’t choose Syndey yet as a location to create a block storage volume (I have asked Vultr when we can) so I’ll continue this guide with my existing (free) 50GB volume in New Jersey) and mount it in a server in NY/NJ (and also Syndey).
It appears I can’t connect to a Block Storage volume outside the block storages location (data centre).
You will need to attach the block storage volume to the server at that data centre location or you will get this error when you try and connect to it later.
In my case, the server did not automatically restart so I manually restarted it.
Connecting the Block Storage to your VM
(Linux Example) Create partitions:
# parted -s /dev/vdb mklabel gpt
# parted -s /dev/vdb unit mib mkpart primary 0% 100%
(Linux Example) Create filesystem:
# mkfs.ext4 /dev/vdb1
(Linux Example) Mount block storage:
# mkdir /mnt/blockstorage
# echo >> /etc/fstab
# echo /dev/vdb1 /mnt/blockstorage ext4 defaults,noatime 0 0 >> /etc/fstab
# mount /mnt/blockstorage
FYI: You can only connect to a block storage from the same location (one server at a time I’d imagine).
4. From he Vultr Admin panel SSH into the server (in the same location). See my guide here on setting up a Vultr server and configuring it.
Vultr say’s “Block storage is connected to your server as /dev/vdb. We do not create any filesystems on it by default.” Official Block storage documentation is located here.
5. Run the commands listed in the Block Storage screen (above)
Error: In my case, the echo command failed add to configuration to the /etc/fstab file (even with sudo) and the mount command failed?
mount: can't find /mnt/blockstorage in /etc/fstab
I checked the /etc/fstab file contents
sudo cat /etc/fstab
# ..missing mount commands from Vultr..
I manually edited the /etc/fstab file and added the mount point configuration as suggested by Vultr.
sudo nano ./etc/fstab
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/vda1 during installation
UUID=removedGUID / ext4 errors=remount-ro 0 1
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/vdb1 /mnt/blockstorage ext4 defaults,noatime 0 0 >> /etc/fstab
6. I re-ran the mount command
sudo mount /mnt/blockstorage
I can now directory list in the block storage volume.
ls /dev/vdb1 -al
brw-rw---- 1 username disk 253, 17 Nov 7 21:18 /dev/vdb1
Now let’s attach it to another folder in the root folder (e.g /data)
First, unmount the volume
sudo umount /mnt/blockstorage
Edit the /etc/fstab file with sudo nano
sudo nano /etc/fstab
Change the mount point somewhere else (e.g /data)
/dev/vdb1 /data ext4 defaults,noatime 0 0 >> /etc/fstab
Make a folder in the new path (/data), If you don’t do this the mount will fail.
sudo mkdir /data
Remount the volume (but use the new path)
sudo mount /data
You can now use the path and new storage.
sudo nano /data/test/test.txt
Disposing of Block Storage
TIP: Move or backup any data before you destroy or detach the volume.
First, you will need to unmount the volume (SSH session with your server).
sudo umount /data
Then remove the entry from the /etc/fstab file
Then you can navigate to the https://my.vultr.com/blockstorage/ and edit the said block storage volume and detach the volume (this will cause the server to reboot).
After a few minutes you can delete the volume from the edited Block Storage Volume page (click the Trashcan up the upper right).
Done, You can now add and remove Block Storage volumes on Vultr.
How to check the disk usage of the block storage volume
You may need to remind yourself of the block storage volume (cat the /etc/fstab file and view the drive information on the mount line).
# .. /dev/vdb1 ..
How much space is used/free
df -h /dev/vdb1
Filesystem Size Used Avail Use% Mounted on
/dev/vdb1 50G 52M 47G 1% /data
You can also show the usage information in that mounted folder
du -xsch /data
Use the pydf tool to view mounted partitions
sudo apt-get install pydf
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 3496M 15G 17.4 [##########...............................................] /
/dev/vdb1 49G 52M 47G 0.1 [.........................................................] /data
- You need to attach the block storage volume and reboot in the Vultr admin panel before mounting.
- The echo command (as documented by Vultr) may not add information to the /etc/fstab file (a manual edit will work).
How to Resize a Block Storage Volume on Vultr.
Coming soon (if requested below).
Donate and make this blog better
Ask a question or recommend an article
v1.2 added disk usage information