How to make Block Storage available for Linux?
Overview
In a computer's file-sharing system, mounting typically refers to making the file system accessible to a number of users. MS Windows has the option to automatically mount discs. However, Linux does not and hence require a storage device to be mounted (attached) to the operating system manually before it can be used. This mounted storage is subsequently used to build a filesystem and store data.
In this tutorial, we'll help you know how to mount the attached volume on an Ubuntu instance.
Prerequisites
An Ubuntu instance
Attached volume
Code editor
Good internet connectivity
Get Started
Step 1: Login as: ubuntu
Step 2: Listing Disk Partition Table
i. Execute the below command to see the list of mounted file systems as well as file systems in RAM, usage percentage, availability, and the path it's mounted on. This command displays the details in 'human-readable' size format, i.e., gigabytes, megabytes, and kilobytes. Moreover, it will help us draw the difference in the partition table in the last (step 10).
ii. Run the following command to get the report of the device's major and minor numbers, block size, amount of free and total space on the device, as well as information on all available or specified block devices.
Step3: Create Disk partition
The Linux command fdisk, commonly referred to as format disc, is used to create and modify the disc partition table. It is used to examine, create, delete, modify, resize, copy, and transfer partitions on a hard drive.
Use the following commands to create a disk partition for your volume.
i. Sudo -i
ii. fdisk /path <give the path of your attached volume>
Step 4: Type m for help, and you'll be prompted to a list of commands.
Step 5: Building Partition Tables:
i. Enter n for adding a new partition.
Linux has two partition styles, namely:
Primary partition: The computer's operating system(s) are located on the primary disc, which is a bootable partition.
Extended partition: The extended partition is non-bootable; these are used to store data and often have numerous logical partitions.
ii. Enter p for selecting the number of primary partitions, which range from 1 to 4, and default value of 1. Then, you may choose the sectors of your choice; else, it'll pick the default values. Here, we have taken the default values.
iii. Enter w to write table to disk and exit.
Step 6: Creating a File System
Use the following command to create an ext4 file system from disc partitions, which is used to build a Linux file system on a device.
Step 7: Creating a drive for mounting volume
Volume is always mounted on a drive. For that, we'll create a drive with the following command.
Step 8: Creating a configuration file
Use the following command to edit the configuration file. Here, we are using nano code editor.
This file has some default settings, which need to remain untouched. You need to fill the following details into the file:
UUID (already copied from the partition table in Step.7)
Path of drive (refer to step.7)
File system type, i.e., ext4
Settings- default
0- If you want the volume backup
1- If you want the volume bootup at the startup
Step 9: Mounting the volume
i. Reload the daemon using the command:
ii. Mount the volume
If the below error appears
Use the following command for mounting:
Step 10: Verifying the volume mount
The following commands will show our drive in the Disk partition table, which was missing earlier in step 2:
Last updated