After creating a Block Storage volume in the Cloud Panel and assigning it to a server, Linux servers will need to be configured to access the new Block Storage. Learn how to add Block Storage to a Cloud Server with Linux.
- A Cloud Server with Linux (any version)
- A Block Storage volume created, with the Cloud Server assigned to it.
Create a Snapshot
Before you proceed, we recommend you create a Snapshot to use as a restore point for your server. If necessary, you can "roll back" your changes by restoring the Snapshot.
See our article Creating a Snapshot for step-by-step instructions on how to create and restore a Snapshot.
Find the Block Storage Device Name
Connect to the server with SSH, then use the
lsblk command to list all available block storage devices:
[user@localhost ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 50G 0 disk ├─sda1 8:1 0 500M 0 part /boot └─sda2 8:2 0 49.5G 0 part ├─centos-swap 253:0 0 2G 0 lvm [SWAP] └─centos-root 253:1 0 47.5G 0 lvm / sdb 8:16 0 20G 0 disk sr0 11:0 1 1024M 0 rom
In the example above, we have created a 20G Block Storage device. As you can see, its name is
Format the Block Storage Device
NOTE The Block Storage device will only need to be formatted the first time you use it. If you detach the Block Storage device then attach it to another server, do not format the device.
Formatting the Block Storage device will erase all data on the device.
Use the following command to format the Block Storage device:
sudo mkfs.ext4 [Block Storage device name]
For the example shown above, the command is:
sudo mkfs.ext4 /dev/sdb
The server will respond with:
/dev/sdb is entire device, not just one partition! Proceed anyway? (y,n)
y to proceed. The Block Storage device will be formatted.
Mount the Block Storage Device
First, create a mount point for the Block Storage. For this example we will create
/mnt/block as the mount point:
sudo mkidr /mnt/block
Next, mount the block storage device at this mount point with the command:
sudo mount [Block Storage device name] [mount point]
For the above example with a Block Storage device of
/dev/sdb and a mount point of
/mnt/block the command is:
sudo mount /dev/sdb /mnt/block
The Block Storage device will be mounted, and will be accessible at