How to format and mount a BuyVM block storage slab to a slice

275

BuyVM is a long-time established VPS provider that has a high reputation on LowEndTalk because their services are stable and production ready. A slice is basically a VPS with a high-frequency Ryzen 9 3900X or 5900X CPU and a slab is block storage that can be only attached to an active BuyVM slice. This article will show you how to format and mount a BuyVM block storage to a slice properly.

Prerequisites

  • A BuyVM VPS in any location (Any size)
  • A BuyVM block storage slab in the same location as the VPS (Otherwise, you can’t attach it at all.)

You must have a block storage slab attached to a slice already before going further.

BuyVM block storage slabs
BuyVM block storage slabs in Stallion

Installing parted

We’ll be using parted to format the partition in this tutorial, so make sure to have it installed first.

sudo apt-get update
sudo apt-get install parted

Checking the block storage device

Check the block storage device if it’s ready using the command below. In this case, it’s /dev/sda and yours may be different if you have multiple volumes attached. This step is very important to make sure that you won’t be formatting the wrong volume.

lsblk -f

Partitioning the block storage

Run parted to partition the attached volume using the following command.

sudo parted /dev/sda

Type mkpart and proceed through the questions according to your preferences. If you want only one big partition with the ext4 file system, you can simply type the following. Save changes and quit the program.

(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext4
Start? 0%
End? 100%

Formatting the partition

Format the newly-created partition using the ext4 file system. Note sda1 this time. Now you have it ready to mount.

sudo mkfs.ext4 /dev/sda1

Creating the mount point

Create an empty directory to use as the mount point on your VPS. We’ll mount the volume at /mnt/storage.

sudo mkdir /mnt/storage

Editing the fstab file

Open the fstab file with your preferred text editor. I’ll use Vim in this case.

sudo vi /etc/fstab

Append the following line to the fstab file so that the volume will be automatically mounted to the VPS when booting every time.

/dev/sda1 /mnt/storage ext4 defaults 0 0

After editing the fstab file, you can run the mount -a command to mount it manually and see if everything works correctly.

sudo mount -a

If you find this tutorial useful, please consider using my BuyVM aff link.