Operations 7 min read

How to Partition, Format, and Mount a New Data Disk on an ECS Instance (Linux)

This guide walks through the safe preparation, partitioning, formatting, and mounting of a newly purchased data disk on an ECS instance, including device name discovery, creating an ext3 filesystem, updating /etc/fstab, and verifying the mount, with all necessary Linux commands.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
How to Partition, Format, and Mount a New Data Disk on an ECS Instance (Linux)

Disk partitioning and formatting are high‑risk actions; this document describes how to handle a newly purchased data disk, and advises creating a snapshot first if the disk already contains data to avoid loss.

Operation Notes

A data disk bought separately must be attached to the instance before it can be formatted. Disks purchased together with the instance can be formatted directly.

To find the device name of the attached data disk, go to the ECS Management Console > Disk Details > Disk Mount Information. The system assigns device names starting from /dev/xvdb up to /dev/xvdz .

In this example we use a new 20 GB data disk (device name /dev/xvdb ) to create a single‑partition disk and mount an ext3 file system on an I/O‑optimized instance running OS 6.8.

Run fdisk -l to check whether the instance has a data disk. If /dev/vdb is not listed, the instance has no data disk and the rest of the guide can be ignored. If the disk appears as dev/xvd? , you are using a non‑I/O‑optimized instance, where ? is any letter from a‑z.

Create a single‑partition data disk by executing the following commands: Run fdisk /dev/vdb to start partitioning. Enter n and press Enter to create a new partition. Enter p and press Enter to select a primary partition (only one primary is needed for a single‑partition disk). If you need more than four partitions, create an extended partition by choosing e . Enter the partition number (use 1 for the first partition). Accept the default first sector by pressing Enter. Accept the default last sector by pressing Enter. Enter wq and press Enter to write the table and quit.

Verify the new partition: Run fdisk -l again; you should see /dev/vdb1 listed, indicating the partition was created successfully.

Create a file system on the new partition: mkfs.ext3 /dev/vdb1 You may choose a different file system, such as mkfs.vfat for a VFAT file system that can be shared between Linux, Windows, and macOS. File‑system creation time depends on the size of the data disk.

(Recommended) Back up /etc/fstab : cp /etc/fstab /etc/fstab.bak Append the new partition entry to /etc/fstab : echo /dev/vdb1 /mnt ext3 defaults 0 0 >> /etc/fstab Note: Ubuntu 12.04 does not support the barrier option, so use: echo '/dev/vdb1 /mnt ext3 barrier=0 0 0' >> /etc/fstab If you want to mount the disk to a different directory (e.g., a web root), replace /mnt with the desired mount point.

Verify the /etc/fstab entry: cat /etc/fstab

Mount the file system: mount /dev/vdb1 /mnt

Check disk space and usage: df -h If the new file system appears in the output, the mount was successful and the disk is ready for use. No reboot is required.

LinuxECSFilesystemmountdisk partition
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

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.