El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Elastic Cloud Server/ User Guide (Paris Regions)/ FAQs/ Disk Management/ How Can I Adjust System Disk Partitions?

How Can I Adjust System Disk Partitions?

Updated on 2024-06-21 GMT+08:00

Scenarios

If the capacity of system disk partitions is inconsistent with the actual system disk capacity after an ECS is created, you can manually adjust the partitions to expand the system disk.

There are two ways to expand a system disk:

Procedure

This section uses an ECS running CentOS 7.3 64bit as an example. A 60 GB system disk was created with the ECS. However, the capacity of the system disk partition is displayed as only 40 GB.

To use the 20 GB capacity, performing the following operations:

  1. View disk partitions.

    1. Log in to the Linux ECS.
    2. Run the following command to switch to user root:

      sudo su -

    3. Run the following command to view details about the ECS disk:

      fdisk -l

      In the following command output, /dev/xvda or /dev/vda indicates the system disk.

      Figure 1 Viewing details about the disk
    4. Run the following command to view disk partitions:

      parted -l /dev/xvda

      Figure 2 Viewing disk partitions

  2. Create a partition for the expanded system disk capacity.

    1. Run the following command to switch to the fdisk mode (taking /dev/xvda as an example):

      fdisk /dev/xvda

      Information similar to the following is displayed:

      [root@ecs-8d6c ]# fdisk /dev/xvda
      Welcome to fdisk (util-linux 2.23.2).
      
      Changes will remain in memory only, until you decide to write them.
      Be careful before using the write command.
      
      Command (m for help):
    2. Enter n and press Enter to create a new partition.

      Because the system disk has two existing partitions, the system automatically creates the third one.

      Information similar to the following is displayed.

      Figure 3 Creating a new partition
    3. Enter the new partition's start cylinder number and press Enter.

      The start cylinder number must be greater than the end cylinder numbers of existing partitions. In this example, use the default value for the new partition's start cylinder number and press Enter. Information similar to the following is displayed.

      Figure 4 Specifying the new partition's start cylinder number
    4. Enter the new partition's end cylinder number and press Enter.

      In this example, use the default value for the new partition's end cylinder number and press Enter. Information similar to the following is displayed.

      Figure 5 Specifying the new partition's end cylinder number
    5. Enter p and press Enter to view the created partition.

      Information similar to the following is displayed.

      Figure 6 Viewing the created partition
    6. Enter w and press Enter. The system saves and exits the partition.

      The system automatically writes the partition result into the partition list. Then, the partition is created.

      Information similar to the following is displayed.

      Figure 7 Completing the partition creation
    7. Run the following command to view disk partitions:

      parted -l /dev/xvda

      Figure 8 Viewing disk partitions

  3. Run the following command to synchronize the modifications in the partition list with the OS:

    partprobe

  4. Configure the type of the new partition file system.

    1. Run the following command to view the type of the file system:

      df -TH

      Figure 9 Viewing the file system type
    2. Run the following command to format the partition (taking the ext4 type as an example):

      mkfs -t ext4 /dev/xvda3

      NOTE:

      Formatting the partition requires a period of time. During this time, observe the system running status and do not exit the system.

      Information similar to the following is displayed:

      [root@ecs-86dc ]# mkfs -t ext4 /dev/xvda3
      mke2fs 1.42.9 (28-Dec-2013)
      Filesystem label=
      OS type: Linux
      Block size=4096 (log=2)
      Fragment size=4096 (log=2)
      Stride=0 blocks, Stripe width=0 blocks
      1790544 inodes, 7156992 blocks
      357849 blocks (5.00%) reserved for the super user
      First data block=0
      Maximum filesystem blocks=2155872256
      219 block groups
      32768 blocks per group, 32768 fragments per group
      8176 inodes per group
      Superblock backups stored on blocks:
              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
              4096000
      
      Allocating group tables: done
      Writing inode tables: done
      Creating journal (32768 blocks): done
      Writing superblocks and filesystem accounting information: done

  5. Mount the new partition to the target directory.

    If you mount the new partition to a directory that is not empty, the subdirectories and files in the directory will be hidden. It is a good practice to mount the new partition to an empty directory or a newly created directory. If you want to mount the new partition to a directory that is not empty, temporarily move the subdirectories and files in the directory to another directory. After the partition is mounted, move the subdirectories and files back.

    Take the newly created directory /root/new as an example.
    1. Run the following command to create the /root/new directory:

      mkdir /root/new

    2. Run the following command to mount the new partition to the /root/new directory:

      mount /dev/xvda3 /root/new

      Information similar to the following is displayed:

      [root@ecs-86dc ]# mount /dev/xvda3 /root/new
      [root@ecs-86dc ]#
    3. Run the following command to view the mounted file systems:

      df -TH

      Information similar to the following is displayed:

      Figure 10 Viewing the mounted file systems

  6. Determine whether to set automatic mounting upon system startup for the new disk.

    If you do not set automatic mounting upon system startup, you must mount the new partition to the specified directory again after the ECS is restarted.
    • If automatic mounting is required, go to 7.
    • If automatic mounting is not required, no further action is required.

  7. Set automatic mounting upon system startup for the new disk.

    NOTE:

    Do not set automatic mounting upon system startup for unformatted disks because this will cause ECS startup failures.

    1. Run the following command to obtain the file system type and UUID:

      blkid

      Figure 11 Viewing the file system type

      According to the preceding figure, the UUID of the new partition is 96e5e028-b0fb-4547-a82a-35ace1086c4f.

    2. Run the following command to open the fstab file using the vi editor:

      vi /etc/fstab

    3. Press i to enter editing mode.
    4. Move the cursor to the end of the file and press Enter. Then, add the following information:

      UUID=96e5e028-b0fb-4547-a82a-35ace1086c4f /root/new ext4 defaults 0 0

    5. Press Esc, run the following command, and press Enter. The system saves the configurations and exits the vi editor.

      :wq

    NOTE:

    If you want to detach a new disk for which automatic mounting upon system startup has been set, you must delete the automatic mounting configuration before you detach the disk. Otherwise, the ECS cannot be started after you detach the disk. To delete the automatic mounting configuration, perform the following operations:

    1. Run the following command to open the fstab file using the vi editor:

      vi /etc/fstab

    2. Press i to enter editing mode.
    3. Delete the following statement:

      UUID=96e5e028-b0fb-4547-a82a-35ace1086c4f /root/new ext4 defaults 0 0

    4. Press Esc, run the following command, and press Enter. The system saves the configurations and exits the vi editor.

      :wq

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback