Mount Disk On a VM for additional storage capacity

Introduction

This is very usefull wehen you need to add additional storage on a Virtual Machine running in the cloud.

Mounting is a process by which the operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for user to access via the computer’s file system.

Before start with process, you have to log like root.

sudo su -

We want list information about all available or the specified block devices and read the sysfs filesystem to gather information with command:

lsblk

List all disks with the following command.

fdisk -l

Making a folder we will mount the device

mkdir /mnt/sdc

Create the EXT4 filesystem on the device.

mkfs.ext4 /dev/sdc

Manually mounting the disk

mount /dev/sdc /mnt/sdc/

List mounted disks

df -h

Edit /etc/fstab file:

nano /etc/fstab

Add mount to fstab

/dev/sdc /mnt/sdc ext4 defaults 0 1

Making the disk mount automatically on system boot

This is accomplished by adding an entry to the /etc/fstab file.

Edit fstab

nano /etc/fstab

Append to fstab

/dev/sdc /mnt/sdc ext4 defaults 0 1

To see your devices and their separate file-systems, simply use this command:

To display information about available block devices.

blkid

The blkid command displays available attributes such as its universally unique identifier (UUID), file system type (TYPE), or volume label (LABEL).

Enjoy! Contact us for more questions ;-)