Information in this article deals with modifying disks, partitions and filesystems and should be fully understood before following any examples as data loss or an inoperable system may otherwise result.
How to identify your Vultr Block Storage devices
Vultr block storage shows up as /dev/vtbd* devices (VirtIO Block Device)
View current /dev/vtbd entries with ls -al /dev/vtbd*
# ls -al /dev/vtbd*
crw-r----- 1 root operator 0x43 Mar 25 09:55 /dev/vtbd0
crw-r----- 1 root operator 0x45 Mar 25 09:55 /dev/vtbd0p1
crw-r----- 1 root operator 0x46 Mar 25 05:55 /dev/vtbd0p2
crw-r----- 1 root operator 0x44 Mar 25 09:55 /dev/vtbd1
vtbd0 and vtbd1 are individual devices. vtbd0p1 and vtbd0p2 are two partitions on the vtbd0 device.
Which is the new Vultr Block Storage device?
Since the newly added block storage hasn’t been partitioned yet, it’s probably vtbd1, but let’s verify.
View current GPT partitions with gpart show
(or gpart list
for more details) to show all GPT partitions on all devices.
# gpart show
=> 34 335544253 vtbd0 GPT (160G)
34 94 1 freebsd-boot (47K)
128 335544159 2 freebsd-ufs (160G)
So we see the two existing partitions and their filesystems on vtbd0. vtbd0 contains our existing boot device and root filesystem.
We can also verify this by running mount
to see what partition is mounted as /. This confirms that vtbd0 contains the root filesystem.
# mount
/dev/vtbd0p2 on / (ufs, local, soft-updates)
devfs on /dev (devfs, local, multilabel)
How to partition and mount your new Vultr Block Storage devices
To use a new Vultr block storage, it must be partitioned and a filesystem initialized and then mounted.
In this example we’re creating one partition (with a GPT partition scheme) for the entire block storage (50GB). We’ve already determined the name of our new block storage device (vtbd1 in this example), so use the gpart create -s GPT vtbd1
command.
# gpart create -s GPT vtbd1
vtbd1 created
Now add one partition with label ‘vultrblockstorage’ and set it to freebsd-ufs.
# gpart add -t freebsd-ufs -l vultr/_block/_storage vtbd1
vtbd1p1 added
This should have created a new device called /dev/vtbd1p1 and and can be verified by running gpart list vtbd1p1
Initialize the UFS2 filesystem on the new partition.
# newfs -U vtbd1p1
/dev/vtbd1p1: 51200.0MB (104857528 sectors) block size 32768, fragment size 4096
using 82 cylinder groups of 626.09MB, 20035 blks, 80256 inodes.
with soft updates
super-block backups (for fsck_ffs -b #) at:
192, 1282432, 2564672, 3846912, 5129152, 6411392, 7693632, 8975872, 10258112, 11540352, 12822592, 14104832, 15387072, 16669312, 17951552, 19233792, 20516032, 21798272, 23080512, 24362752, 25644992, 26927232, 28209472, 29491712,
30773952, 32056192, 33338432, 34620672, 35902912, 37185152, 38467392, 39749632, 41031872, 42314112, 43596352, 44878592, 46160832, 47443072, 48725312, 50007552, 51289792, 52572032, 53854272, 55136512, 56418752, 57700992, 58983232,
60265472, 61547712, 62829952, 64112192, 65394432, 66676672, 67958912, 69241152, 70523392, 71805632, 73087872, 74370112, 75652352, 76934592, 78216832, 79499072, 80781312, 82063552, 83345792, 84628032, 85910272, 87192512, 88474752,
89756992, 91039232, 92321472, 93603712, 94885952, 96168192, 97450432, 98732672, 100014912, 101297152, 102579392, 103861632
Now you’re ready to mount the new device for use!
Create a mount point
# mkdir /mnt/blockstorage
Add en entry to the /etc/fstab
file for easy mounting (and automounting at startup).
# echo /dev/vtbd1p1 /mnt/blockstorage ufs rw,noatime 0 2 >> /etc/fstab
Mount the new block storage device
# mount /mnt/blockstorage
The storage is now available and ready for use at /mnt/blockstorage
# df -h /mnt/blockstorage/
Filesystem Size Used Avail Capacity Mounted on
/dev/vtbd1p1 48G 8.0K 45G 0% /mnt/blockstorage
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article