Support > About cybersecurity > How to add a new disk to an existing Linux server
How to add a new disk to an existing Linux server
Time : 2025-01-21 15:47:58
Edit : Jtti

If you use a Linux server, you may need to upgrade the server capacity or replace disks. How to add a new disk in Linu?

Creating a new partition can be configured through the fdisk utility, if we need to add a 20GB mount for the /data partition. Fdisk is an imperative utility that can view and manage hard drives and partitions on Linux systems:

# fdisk -l

The result is the current partition and configuration. After connecting the 20GB hard drive, continue to use the command:

fdisk-1

The newly added disk is displayed as /dev/xvdc. If we are adding a physical disk, it will appear /dev/sda based on the disk type. Partition the disk according to the specific disk, for example, /dev/xvdc.

# fdisk /dev/xvdc

Here's how it all fits into one paragraph:

fdisk is a common disk partitioning tool, and its common commands include: n for creating partitions, p for printing partition tables, d for deleting partitions, q for exiting without saving changes, and w for writing changes and exiting. By default, a maximum of four primary partitions can be created for creating partitions or extended partitions. Enter the partition number as required. The recommended default value is 1. Give the first sector value, if it is a new disk use the default value, if the same disk create 2 partitions, add 1 to the last sector of the previous partition.

Gives the value of the last sector or partition size. It is always recommended to give the size of the partition. Always add a prefix + to avoid value out-of-range errors. Save the changes and exit.

Then use the mkfs command to format the disk:

# mkfs.ext4 /dev/xvdc1

Mount the partition after formatting:

# mount /dev/xvdc1 /data

Create an entry in the /etc/fstab file to be mounted permanently at startup.

/dev/xvdc1 /data ext4 defaults     0   0

This is how the fdisk command is used to mount and partition a disk.

Relevant contents

Key differences and detailed comparisons between 32-bit and 64-bit systems What to do if the temporary file on the server has no permission File copy/move method with progress bar in Linux Hong Kong Server hardware network topology and bandwidth management Discard weak Hash algorithm to ensure SSL/TLS certificate security Method to ensure SSL/TLS certificate security This section describes how to manage the /etc/shadow password file in Linux How to configure network interfaces in Linux using ifconfig Impact and defense strategy of DNS pollution Common methods for changing the MySQL password Jtti Data Center Selection Guide
Go back

24/7/365 support.We work when you work

Support