How to Attach Additional Disk on your KVM based VPS
Attaching an additional disk to your KVM-based Virtual Private Server (VPS) can provide you with extra storage space for data, applications, or any other specific needs. This process allows you to expand your server's storage capacity, making it a useful task for managing your VPS efficiently.
In this guide, we'll walk you through the steps to attach an additional disk to your KVM-based VPS. The process generally involves verifying the new disk, formatting it with a filesystem, mounting it, and configuring it for persistent mounting.
Make sure you identify the correct disk before proceeding. Formatting the wrong disk can result in permanent data loss. In this guide, the new disk is /dev/vdb, but the disk name may vary for your VPS.
Verify the New Disk
Once the additional disk has been assigned to your server, verify the disk by using the fdisk -l command:
Output:
As you can notice from the above output, there are two disks present on the server. The first disk /dev/vda contains the main system partitions, while the second disk /dev/vdb is the newly added disk with no partitions present.
Partition, Format, and Mount the Disk
Format the Disk
The following command is for EXT4 filesystems only.
Format the new disk with the EXT4 filesystem using the following command:
Create a Mount Directory
Create a mount directory on the server where the new disk will be mounted. This can be named as per your requirements (for example, /disk2):
Mount the Disk
Mount the disk onto the /disk2 directory:
Configure Persistent Mounting
Add an entry into /etc/fstab so the disk is mounted automatically upon reboot:
Add the following line to the end of the file:
Make sure the device name, mount point, and filesystem type are correct before saving /etc/fstab.
Save changes and exit the file.
Verify the Mounting
Verify that the disk is mounted correctly on /disk2 using the following commands:
Output:
What Changed
- Added
import { Steps } from '@rspress/core/theme';at the top of the file. - Wrapped formatting, directory creation, mounting, and
/etc/fstabconfiguration steps into a<Steps>block with###headings. - Converted GitHub-style warnings and notes (
> [!WARNING],> [!NOTE],> [!IMPORTANT]) into proper Rspress container syntax (:::warning,:::note,:::important) with correct blank lines. - Added language tags (
bash,text) to all code blocks. - Fixed duplicated "Save changes and exit the file." line from the original text.
Check Before Pushing
- Disk Device Names: Verify that users are cautioned to check their actual disk identifier (e.g.,
/dev/vdb) usingfdisk -lbefore runningmkfs.ext4, as secondary disks can vary across environments. - File Extension: Ensure the file is renamed to
.mdxwhen placed in the repository.
Remember to rename the file to .mdx, update any links that include the .md extension, and keep the blank lines around <Steps>, inside <details>, and inside callouts.

