Mounting Block Storage on a CentOS 8 Server

If you assign a block of storage to a cloud server running the CentOS 8 Linux distribution installed, you must then mount it on the server. We'll show you how to do it in this article.

  • You have created a Block Storage.

  • You have assigned the Block Storage to the server.

  • You have logged on to the server as an administrator.

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

    sda               8:0    0   120G  0 disk
    ├─sda1            8:1    0   512M  0 part /boot
    └─sda2            8:2    0 119.5G  0 part
      ├─centos-root 253:0    0 117.5G  0 lvm  /
      └─centos-swap 253:1    0     2G  0 lvm  [SWAP]
    sdb               8:16   0    20G  0 disk
    sr0              11:0    1  1024M  0 rom
    In the above example, the server is assigned a block of storage with a size of 20 GB. This has the name sdb.

  • Optional: If you use the Storage block for the first time, you must format this drive before using it for the first time. If you format the drive, all data on it will be erased. To format the drive, type the command sudo mkfs.ext4 in the following format:
    :~# sudo mkfs.ext4 [name of the block storage]
    :~# sudo mkfs.ext4 /dev/sdb
    After you type the command, the block storage is formatted and you will see a message. Example:
    mke2fs 1.44.3 (10-July-2018)
    Creating filesystem with 5242880 4k blocks and 1310720 inodes
    Filesystem UUID: 6c45046b-f039-4d98-97a0-023a6693d3c8
    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

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

  • Open the file /etc/fstab with the editor (e.g. vi) and insert the desired mount point in the following format:
    /dev/sdc /mnt/block auto defaults 0 0
    The drive will now be mounted.

  • To check the new entry in the /etc/fstab file and mount the shared storage, type the following command:
    :~# mount -a

  • To access the drive, type the following command:
    cd /mnt/block

Did this article help you?

Your feedback helps us to further improve our services. To leave feedback, log in to your IONOS account by clicking on the login button at the top right. You can then submit a rating below the article.