Estos contenidos se han traducido de forma automática para su comodidad, pero Huawei Cloud no garantiza la exactitud de estos. Para consultar los contenidos originales, acceda a la versión en inglés.
Cómputo
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Redes
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
Gestión y gobernanza
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
Cloud Operations Center
Resource Governance Center
Migración
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
Análisis
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
IoT
IoT Device Access
Otros
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Seguridad y cumplimiento
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Servicios multimedia
Media Processing Center
Video On Demand
Live
SparkRTC
Almacenamiento
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Contenedores
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Bases de datos
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
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Aplicaciones empresariales
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Data Lake Factory
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Distribución de contenido y cómputo de borde
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Soluciones
SAP Cloud
High Performance Computing
Servicios para desarrolladores
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
Cloud Application Engine
aPaaS MacroVerse
KooPhone
KooDrive
En esta página

Mostrar todo

Centro de ayuda/ Elastic Cloud Server/ Preguntas frecuentes/ Disk Management/ Disk Capacity Expansion/ How Can I Add the Empty Partition of an Expanded System Disk to the Non-end Root Partition Online?

How Can I Add the Empty Partition of an Expanded System Disk to the Non-end Root Partition Online?

Actualización más reciente 2023-08-08 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 add the empty partition to the root partition of the system disk.

This section describes how to add the empty partition to the non-end root partition online.

Procedure

In the following operations, the ECS that runs CentOS 6.5 64bit and has a 100 GB system disk is used as an example. The system disk has two partitions, /dev/xvda1: root and /dev/xvda2: swap, and the root partition is not the end partition.

  1. Run the following command to view disk partitions:
    parted -l /dev/xvda
    [root@sluo-ecs-a611 ~]# parted -l /dev/xvda
    Disk /dev/xvda: 107GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End     Size    Type     File system     Flags
     1      1049kB  41.0GB  40.9GB  primary  ext4            boot
     2      41.0GB  42.9GB  2000MB  primary  linux-swap(v1)

    The first is the root partition, and the second is the swap partition.

  2. View and edit the fstab partition table to delete the swap partition attaching information.
    1. Run the following command to view the fstab partition table:

      tail -n 3 /etc/fstab

      [root@sluo-ecs-a611 ~]# tail -n 3 /etc/fstab 
      #
      UUID=7c4fce5d-f8f7-4ed6-8463-f2bd22d0ddea /                       ext4    defaults        1 1
      UUID=5de3cf2c-30c6-4fb2-9e63-830439d4e674 swap                    swap    defaults        0 0
    2. Run the following command to edit the fstab partition table and delete the swap partition attaching information.

      vi /etc/fstab

      tail -n 3 /etc/fstab
      [root@sluo-ecs-a611 ~]# vi /etc/fstab 
      [root@sluo-ecs-a611 ~]# tail -n 3 /etc/fstab 
      #
      UUID=7c4fce5d-f8f7-4ed6-8463-f2bd22d0ddea /                       ext4    defaults        1 1
  3. Run the following command to disable the swap partition:

    swapoff -a

  4. Delete the swap partition.
    1. Run the following command to view the partition:
      parted /dev/xvda
      [root@sluo-ecs-a611 ~]# parted /dev/xvda
      GNU Parted 3.1
      Using /dev/xvda
      Welcome to GNU Parted! Type ´help´ to view a list of commands.
      (parted) help                                                             
        align-check TYPE N                        check partition N for TYPE(min|opt) alignment
        help [COMMAND]                           print general help, or help on COMMAND
        mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
        mkpart PART-TYPE [FS-TYPE] START END     make a partition
        name NUMBER NAME                         name partition NUMBER as NAME
        print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a
              particular partition
        quit                                     exit program
        rescue START END                         rescue a lost partition near START and END
        rm NUMBER                                delete partition NUMBER
        select DEVICE                            choose the device to edit
        disk_set FLAG STATE                      change the FLAG on selected device
        disk_toggle [FLAG]                       toggle the state of FLAG on selected device
        set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
        toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
        unit UNIT                                set the default unit to UNIT
        version                                  display the version number and copyright information of GNU Parted
      (parted)                                                         
    2. Press p.
      Disk /dev/xvda: 107GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos
      Disk Flags: 
      
      Number  Start   End     Size    Type     File system     Flags
       1      1049kB  41.0GB  40.9GB  primary  ext4            boot
       2      41.0GB  42.9GB  2000MB  primary  linux-swap(v1)
                                                             
    3. Run the following command to delete the partition:
      rm 2
      (parted) rm2   
    4. Press p.
      (parted) p 
      Disk /dev/xvda: 107GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos
      Disk Flags: 
      
      Number  Start   End     Size    Type     File system  Flags
       1      1049kB  41.0GB  40.9GB  primary  ext4         boot
    5. Run the following command to edit the fstab partition table:
      quit
      (parted) quit                                                     
      Information: You may need to update /etc/fstab.
  5. Run the following command to view partition after the swap partition is deleted:

    parted -l /dev/xvda

    [root@sluo-ecs-a611 ~]# parted -l /dev/xvda
    Disk /dev/xvda: 107GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  41.0GB  40.9GB  primary  ext4         boot
  6. Run the following command to install the growpart tool:

    This tool may be integrated in the cloud-utils-growpart/cloud-utils/cloud-initramfs-tools/cloud-init package. Run the yum install cloud-* command to ensure it is available.

    yum install cloud-utils-growpart

  7. Run the following command to expand the root partition (the first partition) using growpart:

    growpart /dev/xvda 1

    [root@sluo-ecs-a611 ~]# growpart /dev/xvda 1
    CHANGED: partition=1 start=2048 old: size=79978496 end=79980544 new: size=209710462,end=209712510
  8. Run the following command to verify that online capacity expansion is successful:
    [root@sluo-ecs-a611 ~]# parted -l /dev/xvda
    Disk /dev/xvda: 107GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End    Size   Type     File system  Flags
     1      1049kB  107GB  107GB  primary  ext4         boot
  9. Run the following command to expand the capacity of the file system:

    resize2fs -f $Partition name

    Suppose the partition name is /dev/xvda1, run the following command:

    [root@sluo-ecs-a611 ~]# resize2fs -f /dev/xvda1
    resize2fs 1.42.9 (28-Dec-2013)
    Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
    old_desc_blocks = 3, new_desc_blocks = 3
    ....
    [root@sluo-ecs-a611 ~] # df -hT     //Check file system capacity expansion

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

Comentarios

Comentarios

Comentarios

0/500

Seleccionar contenido

Enviar el contenido seleccionado con los comentarios