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

Partition and File System Extension Preparations (Linux)

Updated on 2022-12-20 GMT+08:00

Before extending the disk partition and file system, you must check the disk partition style and file system format, and then select the appropriate operation accordingly.

  1. To view the disk partition style, see the following methods:
  2. To select the appropriate operation, see Table 1.
    Table 1 Disk partition and file system extension scenarios

    Disk

    Scenario

    Method

    System disk

    Create a new MBR partition with the additional space.

    Creating a New MBR Partition

    Allocate the additional space to an existing MBR partition.

    Data disk

    Create a new MBR partition with the additional space.

    Creating a New MBR Partition

    Allocate the additional space to an existing MBR partition.

    Extending an Existing MBR Partition

    Create a new GPT partition with the additional space.

    Creating a New GPT Partition

    Allocate the additional space to an existing GPT partition.

    Extending an Existing GPT Partition

    SCSI data disk

    Create a new MBR partition with the additional space.

    Creating a New MBR Partition

    Allocate the additional space to an existing MBR partition.

    Extending an Existing MBR Partition

    NOTE:

    The maximum disk capacity that MBR supports is 2 TiB, and the disk space exceeding 2 TiB cannot be used.

    If your disk uses MBR and you need to expand the disk capacity to over 2 TiB, change the partition style from MBR to GPT. Ensure that the disk data has been backed up before changing the partition style because services will be interrupted and data on the disk will be cleared during this change.

Method 1: Check Partition Style and File System Format Using fdisk

  1. Run the following command to view all the disks attached to the server:

    lsblk

    Information similar to the following is displayed:
    [root@ecs-test-0001 ~]# lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda    253:0    0   40G  0 disk
    └─vda1 253:1    0   40G  0 part /
    vdb    253:16   0  150G  0 disk
    └─vdb1 253:17   0  100G  0 part /mnt/sdc

    In this example, data disk /dev/vdb already has partition /dev/vdb1 before capacity expansion, and the additional 50 GiB added has not been allocated yet. Therefore, /dev/vdb has 150 GiB, and /dev/vdb1 has 100 GiB.

  2. Run the following command to view the current disk partition style:

    fdisk -l

    Information similar to the following is displayed:
    [root@ecs-test-0001 ~]# fdisk -l
    
    Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x000bcb4e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    83886079    41942016   83  Linux
    
    Disk /dev/vdb: 161.1 GB, 161061273600 bytes, 314572800 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x38717fc1
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vdb1            2048   209715199   104856576   83  Linux

    The value in the System column indicates the disk partition style. Value Linux indicates the MBR partition style. Value GPT indicates the GPT partition style.

    • If the disk partitions displayed are inconsistent with those obtained in 1, the partition that is not displayed uses the GPT partition style and has unallocated space. In this case, you cannot query all the partition information using the fdisk -l command. Go to Method 2: Check Partition Style and File System Format Using parted.
    • If the disk partitions displayed are consistent with those obtained in 1, continue with the following operations.

  3. Run the following command to view the partition's file system format:

    blkid Disk partition

    In this example, run the following command:

    blkid /dev/vdb1

    In the command output, the TYPE value is ext4, indicating that /dev/vdb1's file system format is ext4.

  4. Run the following command to view the file system status:

    ext*: e2fsck -n Disk partition

    xfs: xfs_repair -n Disk partition

    In this example, the ext4 file system is used. Therefore, run the following command:

    e2fsck -n /dev/vdb1

    Information similar to the following is displayed:
    [root@ecs-test-0001 ~]# e2fsck -n /dev/vdb1
    e2fsck 1.42.9 (28-Dec-2013)
    Warning!  /dev/vdb1 is mounted.
    Warning: skipping journal recovery because doing a read-only filesystem check.
    /dev/vdb1: clean, 11/6553600 files, 459544/26214144 blocks

    If the file system status is clean, the file system status is normal. Otherwise, rectify the faulty and then perform the capacity expansion.

Method 2: Check Partition Style and File System Format Using parted

  1. Run the following command to view all the disks attached to the server:

    lsblk

    Information similar to the following is displayed:
    [root@ecs-test-0001 ~]# lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    vda    253:0    0   40G  0 disk
    └─vda1 253:1    0   40G  0 part /
    vdb    253:16   0  150G  0 disk
    └─vdb1 253:17   0  100G  0 part /mnt/sdc

    In this example, data disk /dev/vdb already has partition /dev/vdb1 before capacity expansion, and the additional 50 GiB added has not been allocated yet. Therefore, /dev/vdb has 150 GiB, and /dev/vdb1 has 100 GiB.

  2. Run the following command and enter p to view the disk partition style:

    parted Disk

    For example, run the following command to view /dev/vdb's partition style:

    parted /dev/vdb

    Information similar to the following is displayed:
    [root@ecs-test-0001 ~]# parted /dev/vdb
    GNU Parted 3.1
    Using /dev/vdb
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) p
    Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the
    disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
    Fix/Ignore/Cancel? Fix
    Warning: Not all of the space available to /dev/vdb appears to be used, you can fix the GPT to use all of the space (an extra 104857600
    blocks) or continue with the current setting?
    Fix/Ignore? Fix
    Model: Virtio Block Device (virtblk)
    Disk /dev/vdb: 161GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:
    
    Number  Start   End    Size   File system  Name  Flags
     1      1049kB  107GB  107GB  ext4         test
    
    (parted) 
    In the command output, parameter Partition Table indicates the disk partition style. Value msdos indicates the MBR partition style, and value gpt indicates the GPT partition style.
    • If the following error information is displayed, enter Fix.
      Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the
      disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?

      The GPT partition table information is stored at the start of the disk. To reduce the risk of damage, a backup of the information is saved at the end of the disk. When you expand the disk capacity, the end of the disk changes accordingly. In this case, enter Fix to move the backup file of the information to new disk end.

    • If the following warning information is displayed, enter Fix.
      Warning: Not all of the space available to /dev/vdb appears to be used, you can fix the GPT to use all of the space (an extra 104857600
      blocks) or continue with the current setting?
      Fix/Ignore? Fix

      Enter Fix as prompted. The system automatically sets the GPT partition style for the additional space.

  3. Enter q and press Enter to exit parted.

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