Skip to main content

Guide to Adding a Disk to a Cloud Server

This guide will show you how to add a new disk to your operating system. It includes the steps to create a disk in the management panel and then configure it in the operating system.

Creating a New Disk

Before adding the disk to the operating system, you must create it in your server management panel.

Steps to Create a Disk in the Management Panel

  1. Log into the control panel:
    • Sign in to your account and go to the Cloud Server section in the control panel.
  2. Navigate to the Disk section. attach1
  3. Click on Create Disk. attach2
  4. Enter the following information:
    • Disk Name: Enter a specific name for your disk.
    • Disk Type: Select the type of disk from the dropdown menu ("Standard (SSD)" is selected here).
    • Disk Size: Use the slider to set the disk size (1 GB is selected here).
    • Attach to Server: Select the server to which you want to attach the disk from the dropdown menu. attach1
  5. Click the Create Disk button.
  6. Your disk will be created and attached to the selected server within a few seconds.

Configuring the Disk in the Operating System

Once the disk is attached to the server, it must be configured in the operating system. This includes identifying the disk, partitioning it, formatting it, and mounting it.

Identifying the Disk

First, check the list of available disks:

lsblk

To ensure the disk is empty, use the following command:

sudo fdisk -l /dev/vdX

Partitioning the Disk

To partition the disk, use the appropriate tool for your operating system:

sudo fdisk /dev/vdX

In Linux fdisk mode, enter the following commands:

  • n to create a new partition.
  • p to select the primary partition.
  • Enter the partition number (usually 1).
  • Press Enter to accept default start and end sectors.
  • w to write changes and exit.

Formatting the Partition

To format the partition with the appropriate filesystem:

sudo mkfs.ext4 /dev/vdX1

Creating a Mount Directory

Create a directory for mounting the disk:

sudo mkdir -p /mnt/data

Temporarily Mounting the Disk

Mount the disk temporarily:

sudo mount /dev/vdX1 /mnt/data

Permanently Mounting the Disk

To mount the disk permanently at system startup, edit the fstab file:

sudo nano /etc/fstab

Add the following line at the end of the file:

/dev/vdX1    /mnt/data    ext4    defaults    0    2

Save the file and exit the editor.

Applying Changes Without Rebooting

To apply changes without rebooting:

sudo mount -a

Verifying the Disk Mount

Check if the disk is mounted correctly:

df -h /mnt/data

Setting Permissions (Optional)

Ensure the correct permissions are set for the mounted directory:

sudo chmod 755 /mnt/data
sudo chown username:groupname /mnt/data