Extend Disk Partition on Linux System Disk

CDS

  • API Reference
    • Disk Related Interfaces
  • Dedicated Cluster Operation Guide
    • Charge
    • Create a dedicated cluster
    • Create Cloud Disk Server in Dedicated Cluster
    • Expand Dedicated Cluster
    • View Dedicated Cluster Information
    • What Is a Dedicated Cluster
  • Disk Operation Guide
    • Basic Operations
      • Create cloud disks
      • Disk encryption
        • Encrypt Data Disk and Snapshot
        • Encrypt System Disk and Image
        • Encryption Overview
      • Format cloud disks
        • Format Disk Partition on Linux System
        • Format Disk Partition on Windows System
        • Overview
      • Monitor alarm
      • mount Cloud Disk Server
      • Recycle bin
      • Release cloud disks
      • Tag Management
      • Unmount Cloud Disk Server
    • Billing management
      • Renew cloud disks
      • Shift Charge
    • Elastic Operations
      • Burst performance capability
      • Change cloud disk type
      • Performance preconfiguration
        • Use Performance Pre-Configuration
        • What Is Performance Pre-Configuration
      • Resize cloud disks
        • Expansion Overview
        • Extend Disk Partition on Linux Data Disk
        • Extend Disk Partition on Linux System Disk
        • Extend Disk Partition on Windows Data Disk
        • Extend Disk Partition on Windows System Disk
  • FAQs
    • Billing Problems
    • Common Questions Overview
    • Configuration-related questions
    • Fault-related questions
    • Performance-related questions
    • Security Problems
  • Peripheral Tools
    • CDSCMD Tool
      • Configure CDS CMD Tool
      • Install CDS CMD Tool
      • Operate Disk Using CDS CMD Tool
      • Overview
      • Tool Version History
  • Product Description
    • Application scenarios
    • Disk Status
    • Disk types
    • Product advantages
    • Product features
    • Product functions
    • Product Introduction
    • Type and Region
  • Product pricing
    • Disk charge type
      • Pay as you go
      • Subscription billing
    • Disk Expiration and Debt Reminder
    • Snapshot Charge Type
    • Universal Storage Capacity Package GSCP
  • Product Updates
    • Function Release Records
    • Product Announcement
      • Adjustments to prepay Disk renew, shift charge, and Unsubscribe Operations
  • Service Level Agreement (SLA)
    • Baidu Intelligent Cloud Block Storage Trusted Cloud
    • CDS Service Level Agreement (SLA V2_0)
  • Snapshot Operation Guide
    • Disk Snapshot
      • Automatic snapshot
      • Create a custom image
      • Create CDS disk from snapshot
      • Cross-region replication
      • Delete a snapshot
      • Manual Snapshot
      • Snapshot Rollback
      • Tag Management
    • Instance snapshots
      • Instance snapshots
    • Introduction to snapshot
      • Instructions for use
      • Snapshot chain
  • Typical Practices
    • Block Device Persistent Naming
All documents
menu
No results found, please re-enter

CDS

  • API Reference
    • Disk Related Interfaces
  • Dedicated Cluster Operation Guide
    • Charge
    • Create a dedicated cluster
    • Create Cloud Disk Server in Dedicated Cluster
    • Expand Dedicated Cluster
    • View Dedicated Cluster Information
    • What Is a Dedicated Cluster
  • Disk Operation Guide
    • Basic Operations
      • Create cloud disks
      • Disk encryption
        • Encrypt Data Disk and Snapshot
        • Encrypt System Disk and Image
        • Encryption Overview
      • Format cloud disks
        • Format Disk Partition on Linux System
        • Format Disk Partition on Windows System
        • Overview
      • Monitor alarm
      • mount Cloud Disk Server
      • Recycle bin
      • Release cloud disks
      • Tag Management
      • Unmount Cloud Disk Server
    • Billing management
      • Renew cloud disks
      • Shift Charge
    • Elastic Operations
      • Burst performance capability
      • Change cloud disk type
      • Performance preconfiguration
        • Use Performance Pre-Configuration
        • What Is Performance Pre-Configuration
      • Resize cloud disks
        • Expansion Overview
        • Extend Disk Partition on Linux Data Disk
        • Extend Disk Partition on Linux System Disk
        • Extend Disk Partition on Windows Data Disk
        • Extend Disk Partition on Windows System Disk
  • FAQs
    • Billing Problems
    • Common Questions Overview
    • Configuration-related questions
    • Fault-related questions
    • Performance-related questions
    • Security Problems
  • Peripheral Tools
    • CDSCMD Tool
      • Configure CDS CMD Tool
      • Install CDS CMD Tool
      • Operate Disk Using CDS CMD Tool
      • Overview
      • Tool Version History
  • Product Description
    • Application scenarios
    • Disk Status
    • Disk types
    • Product advantages
    • Product features
    • Product functions
    • Product Introduction
    • Type and Region
  • Product pricing
    • Disk charge type
      • Pay as you go
      • Subscription billing
    • Disk Expiration and Debt Reminder
    • Snapshot Charge Type
    • Universal Storage Capacity Package GSCP
  • Product Updates
    • Function Release Records
    • Product Announcement
      • Adjustments to prepay Disk renew, shift charge, and Unsubscribe Operations
  • Service Level Agreement (SLA)
    • Baidu Intelligent Cloud Block Storage Trusted Cloud
    • CDS Service Level Agreement (SLA V2_0)
  • Snapshot Operation Guide
    • Disk Snapshot
      • Automatic snapshot
      • Create a custom image
      • Create CDS disk from snapshot
      • Cross-region replication
      • Delete a snapshot
      • Manual Snapshot
      • Snapshot Rollback
      • Tag Management
    • Instance snapshots
      • Instance snapshots
    • Introduction to snapshot
      • Instructions for use
      • Snapshot chain
  • Typical Practices
    • Block Device Persistent Naming
  • Document center
  • arrow
  • CDS
  • arrow
  • Disk Operation Guide
  • arrow
  • Elastic Operations
  • arrow
  • Resize cloud disks
  • arrow
  • Extend Disk Partition on Linux System Disk
Table of contents on this page
  • Overview
  • Operation guide
  • Sign in to the instance and check the status

Extend Disk Partition on Linux System Disk

Updated at:2025-11-03

Overview

As your business grows, your current disk capacity may no longer suffice for storing data. You can expand the disk to your desired capacity while retaining the existing data. Expanding the system disk typically involves rebooting the server after the order is processed, and manual partition expansion is generally not required. However, if the partition is not automatically expanded after rebooting, you will need to perform the expansion manually by following the steps below.

Description:

  • Before expanding the partition, it is strongly recommended to create a snapshot for the disk. For details, please refer to [Create Disk Snapshot](CDS/Snapshot Operation Guide/Disk Snapshot/Manual Snapshot.md);
  • Before expanding the partition, confirm the existing partitioning method of the Cloud Disk Server (CDS) and ensure the current partitioning method matches it;
  • If you have any questions, please submit a Ticket in the console to contact professional technical service personnel;
  • The maximum expansion limit for the system disk is 500 GB;

If you are operating on a Windows system instance, please refer to [Windows Data Disk Partition](CDS/Disk Operation Guide/Elastic Operations/Resize cloud disks/Extend Disk Partition on Windows Data Disk.md).

Operation guide

This document uses an example of data disk expansion on CentOS 6.5 x86_64 (64bit); similar operations apply to other Linux systems.

Sign in to the instance and check the status

1. Sign in to BCC instance

You can sign in to the BCC instance in multiple ways, and you can refer to Sign in to Instance for specific login methods.

2. Install expansion tools

  • CentOS 6

    • Install the dracut-modules-growroot package.
    Plain Text
    1yum install -y dracut-modules-growroot
    • Run the following command to overwrite the initramfs file.
    Plain Text
    1dracut -f
  • CentOS 7、CentOS 8

    • Install the cloud-utils-growpart and xfsprogs packages.
    Plain Text
    1yum install -y cloud-utils-growpart xfsprogs
  • Ubuntu 14、Ubuntu 16、Ubuntu 18、Debian 9

    • Install the cloud-guest-utils and xfsprogs packages.
    Plain Text
    1apt install -y cloud-guest-utils xfsprogs

3. Check current partition status and partitioning method

Execute fdisk -l to view the current partition size. The current system disk is /dev/sda, and the disk has been expanded from 40 GB to 100 GB.

Plain Text
1[root@instance-xxx ~]# fdisk -l
2Disk /dev/sda: 107.4 GB, 107374182400 bytes
3255 heads, 63 sectors/track, 13054 cylinders
4Units = cylinders of 16065 * 512 = 8225280 bytes
5Sector size (logical/physical): 512 bytes / 512 bytes
6I/O size (minimum/optimal): 512 bytes / 512 bytes
7Disk identifier: 0x000344b8
8   Device Boot      Start         End      Blocks   Id  System
9/dev/sda1   *           1        5222    41942016   83  Linux

4. View file system type

Execute the command df -Th to view the current file system type. The current file system type of the system disk partition /dev/sda1 is ext4.

Plain Text
1[root@instance-xxx ~]# df -Th
2Filesystem     Type   Size  Used Avail Use% Mounted on
3/dev/sda1      ext4    40G  1.1G   37G   3% /
4tmpfs          tmpfs  1.9G     0  1.9G   0% /dev/shm

5. Adjust partition size

Run the following command to expand the partition.

Plain Text
1growpart <DeviceName> <PartionNumber>

As an example, expand /dev/sda1.

Plain Text
1[root@instance-xxx ~]# growpart /dev/sda 1
2CHANGED: partition=1 start=2048 old: size=83884032 end=83886080 new: size=209710462,end=209712510

Restarting the instance after the operation is required for lower kernel versions (CentOS 6.x).

6. Expand file system

  • For the ext file system, use resize2fs to expand the partition.
Plain Text
1[root@instance-xxx ~]# resize2fs /dev/sda1
2resize2fs 1.41.12 (17-May-2010)
3Filesystem at /dev/sda1 is mounted on /; on-line resizing required
4old desc_blocks = 3, new_desc_blocks = 7
5Performing an on-line resize of /dev/sda1 to 26213807 (4k) blocks.
6The filesystem on /dev/sda1 is now 26213807 blocks long.
  • For the xfs file system, use xfs_growfs to expand the partition.
Plain Text
1[root@instance-xxx ~]# xfs_growfs /

7. Check expansion result

Plain Text
1[root@instance-xxx ~]# df -Th
2Filesystem     Type   Size  Used Avail Use% Mounted on
3/dev/sda1      ext4    99G  1.1G   93G   2% /
4tmpfs          tmpfs  1.9G     0  1.9G   0% /dev/shm

Previous
Extend Disk Partition on Linux Data Disk
Next
Extend Disk Partition on Windows Data Disk