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

Initializing a Linux Data Disk (Greater Than 2 TiB)

Updated on 2024-12-26 GMT+08:00

Scenarios

When the size of a disk is greater than 2 TiB, you can only use parted to create GPT partitions. The initialization operations may vary depending on the server OS.

Partition Style

OS

File System Format

Partitioning Tool

Example Configuration

GPT

Not limited

ext* (such as ext2, ext3, and ext4), xfs, and btrfs

parted

  • Device name: /dev/vdb
  • File system format: ext4
  • Mount point: /mnt/sdc
  • Partition name: /dev/vdb1
  • Partition style: GPT
  • Size: 3 TiB

Prerequisites

You have attached the disk to a server.

Notes and Constraints

  • A disk created from a data source does not need to be initialized. Such a disk contains the source data in the beginning. Initializing the disk may clear the initial data on it. If you need to re-initialize the disk, you are advised to back up the disk data first. To back up data using CBR, see Backing Up EVS Disks. To back up data using snapshots, see Managing EVS Snapshots.
  • Initializing a disk does not delete the snapshots created for the disk, so you can still use snapshots to roll back data to the source disk after the disk is initialized.

Initializing a Data Disk Greater Than 2 TiB

The following example shows you how to use parted to create a GPT partition on the /dev/vdb data disk.

  1. Log in to the server.

    For how to log in to an ECS, see Logging In to an ECS.

    For how to log in to a BMS, see Logging In to a BMS.

  2. Create the /dev/vdb1 partition on data disk /dev/vdb.

    1. Check that the capacity of the /dev/vdb data disk is 3 TiB.
      lsblk
      [root@ecs-centos76 ~]# 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   3T  0 disk
    1. Create the /dev/vdb1 partition.

      parted /dev/vdb

      p
      [root@ecs-centos74 ~]# 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: /dev/vdb: unrecognised disk label
      Model: Virtio Block Device (virtblk)
      Disk /dev/vdb: 3299GB
      Sector size (logical/physical): 512B/512B
      Partition Table: unknown
      Disk Flags:
      (parted)

      Partition Table: unknown means that no partition style is set for the new disk.

      NOTE:

      If error message -bash: parted: command not found is returned, the system cannot identify the command. In this case, run yum install -y parted to install the command. Then run the command again.

    1. Set the partition style of the /dev/vdb1 partition to GPT.

      mklabel gpt

      unit s

      p

      (parted) mklabel gpt
      (parted) unit s
      (parted) p
      Model: Virtio Block Device (virtblk)
      Disk /dev/vdb: 6442450944s
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:
       
      Number  Start  End  Size  File system  Name  Flags
       
      (parted)
      NOTE:
      • If your disk size is smaller than 2 TiB and you want to use parted to create an MBR partition, run mklabel msdos.
      • If you change the partition style of a disk, data on the disk will be erased. Select an appropriate partition style when initializing disks.
      • The partition style (MBR or GPT) set here will apply to all subsequent partitions created on this EVS disk. When you create partitions on this disk later, you do not need to perform this step again.
    1. Set the name and size of the /dev/vdb1 partition.

      mkpart /dev/vdb1 2048s 100%

      p

      NOTE:
      • Partition /dev/vdb1 is created, starting on 2048 and using 100% of the rest of the disk.
      • If you want to create two or more partitions, calculate the first and last sectors of the partitions based on the method provided in 2.
      (parted) mkpart /dev/vdb1 2048s 100%
      (parted) p
      Model: Virtio Block Device (virtblk)
      Disk /dev/vdb: 6442450944s
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:
       
      Number  Start        End          Size         File system  Name          Flags
       1      2048s        6442448895s  6442446848s               /dev/vdb1

      Enter q and press Enter. Then run lsblk to view the new partition /dev/vdb1.

      [root@ecs-centos74 ~]# 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     3T  0 disk
      └─vdb1 253:17   0     3T  0 part

  3. Create an ext4 file system on the /dev/vdb1 partition.

    mkfs -t ext4 /dev/vdb1

    NOTE:

    It takes some time to create a file system. Observe the system running status and do not exit.

    [root@ecs-test-0001 ~]# mkfs -t ext4 /dev/vdb1
    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
    201326592 inodes, 805305856 blocks
    40265292 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=2952790016
    24576 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000, 214990848, 512000000, 550731776, 644972544
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    [root@ecs-test-0001 ~]#

    Run parted /dev/vdb and enter p to check the file system format.

    [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
    Model: Virtio Block Device (virtblk)
    Disk /dev/vdb: 3299GB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:
    
    Number  Start   End      Size     File system  Name        Flags
     1      1049kB  3299GB   3299GB   ext4         /dev/vdb1           
    
    (parted) q
    [root@ecs-test-0001 ~]#

    Enter q and press Enter to exit parted.

  4. Create a directory (mount point) and mount the new partition on the created mount point.

    mkdir -p /mnt/sdc

    mount /dev/vdb1 /mnt/sdc

    lsblk

    [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   3T 0 disk
    ├vdb1 253:17   0   3T 0 part /mnt/sdc

    You should now see that partition /dev/vdb1 is mounted on /mnt/sdc.

  5. Use the partition UUID to configure auto mount at startup.

    NOTE:
    • Mounts become invalid after a system reboot. You can configure auto mount at startup by adding information of the new partition into the /etc/fstab file.
    • You are advised not to use device names to identify disks in the /etc/fstab file because device names are assigned dynamically and may change (for example, from /dev/vdb1 to /dev/vdb2) after a stop or start. This can even prevent your server from booting up.
    • UUIDs are the unique character strings for identifying partitions in Linux.
    • This operation will not affect the existing data on the ECS.
    1. Query the partition UUID.

      blkid /dev/vdb1

      [root@ecs-test-0001 ~]# blkid /dev/vdb1
      /dev/vdb1: UUID="0b3040e2-1367-4abb-841d-ddb0b92693df" TYPE="ext4"

      The UUID of the /dev/vdb1 partition is 0b3040e2-1367-4abb-841d-ddb0b92693df.

    1. Configure auto mount at startup.

      vi /etc/fstab

      Press i to enter the editing mode, move the cursor to the end of the file, press Enter, and add the following content:

      UUID=0b3040e2-1367-4abb-841d-ddb0b92693df    /mnt/sdc     ext4    defaults     0    2

      Press Esc, enter :wq, and press Enter to save the settings and exit the vi editor.

      Table 1 Parameter description

      Example Value

      Description

      UUID=0b3040e2-1367-4abb-841d-ddb0b92693df

      The UUID of the partition.

      /mnt/sdc

      The mount point of the partition.

      ext4

      The file system format of the partition.

      defaults

      The partition mount option. Normally, this parameter is set to defaults.

      0

      • The Linux dump backup option.
        • 0: Linux dump backup is not used. Usually, dump backup is not used, and you can set this parameter to 0.
        • 1: Linux dump backup is used.

      2

      • The fsck option, which means whether to use fsck to check the disk during startup.
        • 2: The check starts from the partitions whose mount points are non-root directories. / is the root directory.
        • 1: The check starts from the partitions whose mount points are root directories.
        • 0: The fsck option is not used.

  6. Verify that auto mount takes effect.

    umount /dev/vdb1

    mount -a

    The system reloads all the content in the /etc/fstab file.

    Query file system mounting information.

    mount | grep /mnt/sdc

    If information similar to the following is displayed, auto mount has taken effect:

    root@ecs-test-0001 ~]# mount | grep /mnt/sdc
    /dev/vdb1 on /mnt/sdc type ext4 (rw,relatime,data=ordered)

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback