Linux Cloud Server Storage Expansion: Methods and Step‑by‑Step Guide
The guide shows how to enlarge storage on a Tencent Cloud Linux VM by adding and expanding CBS cloud disks using three approaches—direct bare‑device formatting, MBR partitioning for disks under 2 TB, and GPT partitioning for larger disks—detailing step‑by‑step commands, online vs offline resizing, and best‑practice recommendations.
This article explains how to expand storage on Linux cloud servers (Tencent Cloud CVM with CBS) when business data grows and the original disk space becomes insufficient. It first describes the environment (CentOS 7.6, Tencent Cloud CVM with CBS) and then introduces three ways to use cloud disks in Linux: bare device (no partition), MBR partition, and GPT partition.
1. Storage Expansion Overview
Cloud disks can be expanded on demand, but there are two limitations: system disks cannot be expanded, and local disks (host‑attached) cannot be expanded. The article focuses on CBS cloud disks.
2. Bare Device Disk Usage
Creating a filesystem directly on the raw block device (e.g., /dev/vdb ) without any partition simplifies management and supports online expansion.
Typical steps:
[root@VM_0_89_centos ~]# fdisk -l
Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors # data disk
[root@VM_0_89_centos ~]# mkfs.ext4 /dev/vdb # create ext4 filesystem
[root@VM_0_89_centos ~]# blkid /dev/vdb
/dev/vdb: UUID="7fb2c90a-fcd1-472c-b07c-8a20e2e9a436" TYPE="ext4"
# add to /etc/fstab
UUID="7fb2c90a-fcd1-472c-b07c-8a20e2e9a436" /data ext4 defaults 0 0
# mount
[root@VM_0_89_centos ~]# mount -a
[root@VM_0_89_centos ~]# df -hAfter expanding the cloud disk in the console, the filesystem can be enlarged online with resize2fs (ext4) or xfs_growfs (xfs).
3. MBR Disk Partition
Suitable for disks < 2 TB. The process includes creating a primary partition with fdisk , formatting it (ext4 or xfs), adding an entry to /etc/fstab , and mounting.
[root@VM_0_89_centos ~]# fdisk /dev/vdb
Command (m for help): n
Partition type: p (primary)
Partition number: 1
First sector: 2048
Last sector: +100G
Command (m for help): w
# format
[root@VM_0_89_centos ~]# mkfs.xfs /dev/vdb1
# get UUID and add to fstab
UUID="448467bd-f3fa-41cc-a5ad-ab316f7b62e2" /data1 xfs defaults 0 0
# mount and verify
[root@VM_0_89_centos ~]# mount -a
[root@VM_0_89_centos ~]# df -hWhen expanding an MBR disk, a snapshot must be taken first, the disk must be unmounted, and the partition table is edited (often with parted or fdisk ) before resizing the filesystem.
4. GPT Disk Partition
Used for disks > 2 TB. The steps are similar to MBR but use parted to create a GPT label and partitions.
# create GPT label
[root@VM_0_89_centos ~]# parted /dev/vdb mklabel gpt
# create a partition covering the whole disk
[root@VM_0_89_centos ~]# parted /dev/vdb mkpart primary 2048s 100%
# format
[root@VM_0_89_centos ~]# mkfs.xfs /dev/vdb1
# add to fstab and mount
UUID="aa6fc333-e702-4daa-ad0b-10efde57a7f0" /data xfs defaults 0 0
# mount and verify
[root@VM_0_89_centos ~]# mount -a
[root@VM_0_89_centos ~]# df -hTo expand a GPT partition, the disk must be unmounted, the existing partition deleted, a new larger partition created (keeping the same start sector), and the filesystem enlarged (e.g., xfs_growfs or resize2fs ).
5. Summary
Three CBS usage methods: bare device, MBR partition, GPT partition.
Bare device allows online expansion; MBR/GPT require offline operations (unmount, repartition).
For cloud environments, bare‑device filesystems are recommended for simplicity and flexibility.
The article also provides author information and reference links to official Tencent Cloud documentation and video tutorials.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.