Integrating a Block Storage on a Server (Linux)

If you assign a block of storage to a Linux Cloud Server, you must then mount it on that server. To mount a block of storage on your server, follow the steps below.

  • You have created a block of storage.

  • You have assigned the block storage to the server.

  • You have logged on to the server as administrator.

Create Partition

  • To list the block of storage that is assigned to your server, type the following command:
    :~# lsblk After typing the command, you will be shown all the important information about the available disks and the assigned block of storage.


    root@localhost:~# lsblk
    sda            8:0   0 100G 0 disk
    ├─sda1         8:1   0 487M 0 part /boot
    └─sda2         8:2   0 99.5G 0 part
     ├─vg00-lv00 253:0   0 1.9G 0 lvm [SWAP]
     └─vg00-lv01 253:1   0 97.6G 0 lvm /
    sdb            8:16  0  20G 0 disk
    sr0           11:0   1 1024M 0 rom
    In the above example, a block of storage with a size of 20 GB is assigned. This block has the name sdb.

  • To call the /dev/sdb partition in fdisk, type the following command:
    [root@localhost ~]# fdisk /dev/sdb After typing the command, the following message is displayed:
    [root@localhost ~]# fdisk /dev/sdb

    Welcome to fdisk (util-linux 2.32.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.

    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xd29fb520.

  • To add a partition, type n. Then press Enter.
    Command (m for help):
    Partition type:
       p   primary (2 primary, 0 extended, 2 free)
       e   extended


  • To select the partition type Primary, type p. Then press Enter.
    Select (default p): p

  • Enter the partition number of the partition. Example:
    Partition number (1-4, default 1): 1

  • Enter the start sector. Example:
    First sector (2048-41943039, default 1050624): 2048

  • To use all the available memory, press Enter and the following information will be displayed after entering:
    Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039):
    Created a new partition 1 of type 'Linux' and of size 20 GiB.


  • To check the changed partition table, type p. Then press Enter.

  • To write the partition table to the Storage block and exit the program, type w.

  • Restart the server.

Formatting the hard disk

When you use the Storage block for the first time, you must format this drive before using it for the first time. Formatting the drive will erase all data on it.

To format the drive, type the command sudo mkfs.ext4 in the following format:

[root@localhost ~]# sudo mkfs.ext4 [name of the block storage]


[root@localhost ~]# sudo mkfs.ext4 /dev/sdb1
mke2fs 1.44.6 (5-Mar-2019)
Creating filesystem with 5242624 4k blocks and 1310720 inodes
Filesystem UUID: 1c6b3ca0-ac85-4a64-8c50-c267ad829f99
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

The block Storage is formatted.

Mount Block Storage

  • In order to mount the Block Storage, a mount point must be created. To create this, type the following command:
    [root@localhost ~]# sudo mkdir /mnt/block

  • Open /etc/fstab with the editor (e.g. vi) and insert the desired mount point in the following format:
    /dev/sdb1 /mnt/block auto defaults 0 0

  • To check the new entry in /etc/fstab and mount the Storage block, type the following command:
    [root@localhost ~]# mount -a

  • To access the drive, type the following command:
    [root@localhost ~]# cd /mnt/block