Operations 10 min read

Linux System Disk Management: Adding Virtual Disks, Partitioning, Formatting, Mounting, and Auto‑Mount Configuration

This guide explains how to add virtual disks to a Linux VM, identify them, create partitions with fdisk, format them with XFS or ext4, mount and unmount the filesystems, and configure automatic mounting at boot using /etc/fstab.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Linux System Disk Management: Adding Virtual Disks, Partitioning, Formatting, Mounting, and Auto‑Mount Configuration

This article demonstrates the complete workflow for managing disks on a Linux system, starting with adding three virtual disks to a virtual machine, verifying their presence, partitioning them, creating filesystems, mounting, unmounting, and configuring automatic mounting on boot.

Adding Virtual Machine Disks (3 disks)

First shut down the VM, open the VM settings, and add three new disks.

After the VM boots, the new disks appear under /dev as sda , sdb , sdc , and sdd . Use the following command to list them:

ls | grep sd

The output shows devices such as sda1 , sda2 , sdb1 , sdb2 , etc., confirming that the disks were added successfully.

Disk Usage Process (Linux)

Make the disk online (the virtual disk is now attached to the VM).

Partition and format the disk (create a filesystem).

Mount the partition so it can be used.

Partitioning

Use fdisk to create partitions on /dev/sdb (the second disk). Example session:

[root@myserver ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x1fb209a3.
Command (m for help): n   # create partition
Partition type
  p   primary (0 primary, 0 extended, 4 free)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): +5G
Created a new partition 1 of type 'Linux' and of size 5 GiB.
Command (m for help): p   # print partition table
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
...
Device     Boot Start       End   Sectors Size Id Type
/dev/sdb1        2048 10487807 10485760   5G 83 Linux

Command (m for help): n   # create second partition
Select (default p): p
Partition number (2-4, default 2):
First sector (10487808-41943039, default 10487808):
Last sector, +sectors or +size{K,M,G,T,P} (10487808-41943039, default 41943039): +6G
Created a new partition 2 of type 'Linux' and of size 6 GiB.
Command (m for help): p
...
Device     Boot Start       End   Sectors Size Id Type
/dev/sdb1        2048 10487807 10485760   5G 83 Linux
/dev/sdb2      10487808 23070719 12582912   6G 83 Linux
Command (m for help): wq   # write table and quit

Verify the partitions with:

ls /dev/ | grep sd

Formatting

Create filesystems on the new partitions. XFS is recommended for /dev/sdb1 and ext4 for /dev/sdb2 :

# mkfs -t xfs /dev/sdb1
# mkfs -t ext4 /dev/sdb2

Mounting (Start Using)

Create mount points and mount the partitions:

mkdir -p /data/sdb1
mount /dev/sdb1 /data/sdb1/

Check the mounted filesystems:

df -h

Unmounting

To unmount, use either the device name or the mount point:

umount /dev/sdb1   # or umount /data/sdb1

Automatic Mount at Boot

Add an entry to /etc/fstab (be careful to avoid syntax errors):

/dev/sdb1 /data/sdb1 xfs defaults 0 0

Test the configuration without rebooting:

mount -av

After confirming the mount succeeds, reboot the system and verify that /dev/sdb1 is automatically mounted:

reboot
# after reboot
df -h

FAQ

Do not run umount from inside the mount point directory; use another directory to avoid “target is busy” errors.

Additional notes mention RAID 0, BIOS RAID cards, and LVM logical volumes as alternative storage solutions.

LinuxSystem AdministrationpartitioningFilesystemDisk ManagementMounting
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.