Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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

Creating a Logical Volume Using LVM

Updated on 2024-05-30 GMT+08:00

Scenarios

This section shows how to create a 15 GB logical volume based on two 10 GB EVS disks.

NOTE:

Logical volumes can be created based on EVS disks with different specifications.

The process includes creating physical volumes, create a volume group, and create a logical volume.
Figure 1 Process of creating an LVM logical volume

Prerequisites

Two EVS disks have been attached to the ECS where LVM is installed.

Procedure

  1. Log in to the ECS as user root.
  2. Run the following command to view and take note of the device names:

    fdisk -l | grep /dev/vd | grep -v vda

    Information similar to the following is displayed:

    [root@ecs-lvmtest ~]# fdisk -l | grep /dev/vd | grep -v vda
    Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
    Disk /dev/vdc: 10.7 GB, 10737418240 bytes, 20971520 sectors

    In the command output, two EVS disks are attached to the ECS, and the device names are /dev/vdb and /dev/vdc.

  3. Create physical volumes using EVS disks.

    1. Run the following command to create physical volumes using EVS disks:

      pvcreate Device name 1 Device name 2 Device name 3...

      Parameter description:

      Device name: indicates the disk device name. If multiple physical volumes need to be created in a batch, specify multiple device names and separate them with spaces.

      In this example, run the following command:

      pvcreate /dev/vdb /dev/vdc

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]#  pvcreate /dev/vdb /dev/vdc
        Physical volume "/dev/vdb" successfully created.
        Physical volume "/dev/vdc" successfully created.
    2. Run the following command to query details of the physical volumes:

      pvdisplay

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# pvdisplay
        "/dev/vdc" is a new physical volume of "10.00 GiB"
        --- NEW Physical volume ---
        PV Name               /dev/vdc
        VG Name
        PV Size               10.00 GiB
        Allocatable           NO
        PE Size               0
        Total PE              0
        Free PE               0
        Allocated PE          0
        PV UUID               dypyLh-xjIj-PvG3-jD0j-yup5-O7SI-462R7C
      
        "/dev/vdb" is a new physical volume of "10.00 GiB"
        --- NEW Physical volume ---
        PV Name               /dev/vdb
        VG Name
        PV Size               10.00 GiB
        Allocatable           NO
        PE Size               0
        Total PE              0
        Free PE               0
        Allocated PE          0
        PV UUID               srv5H1-tgLu-GRTl-Vns8-GfNK-jtHk-Ag4HHB

      In the command output, the system has two new physical volumes named /dev/vdc and /dev/vdb.

  4. Create a volume group for the physical volumes.

    1. Run the following command to create a volume group:

      vgcreate Volume group name Physical volume name 1 Physical volume name 2 Physical volume name 3...

      Parameter description:

      • Volume group name: Specify a volume group name, for example, vgdata.
      • Physical volume name: Specify the name of a physical volume to be added to the volume group. Multiple names are separated with spaces.

      In this example, run the following command:

      vgcreate vgdata /dev/vdb /dev/vdc

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# vgcreate vgdata /dev/vdb /dev/vdc
        Volume group "vgdata" successfully created
    2. Run the following command to query details of the volume group:

      vgdisplay

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# vgdisplay
        --- Volume group ---
        VG Name               vgdata
        System ID
        Format                lvm2
        Metadata Areas        2
        Metadata Sequence No  1
        VG Access             read/write
        VG Status             resizable
        MAX LV                0
        Cur LV                0
        Open LV               0
        Max PV                0
        Cur PV                2
        Act PV                2
        VG Size               19.99 GiB
        PE Size               4.00 MiB
        Total PE              5118
        Alloc PE / Size       0 / 0
        Free  PE / Size       5118 / 19.99 GiB
        VG UUID               NLkZV7-hYYE-0w66-tnlt-Y6jL-Ik7S-76w4P6

  5. Create a logical volume in the volume group.

    1. Run the following command to create a logical volume:

      lvcreate -L Logical volume size -n Logical volume name Volume group name

      Parameter description:

      • Logical volume size: Specify a value smaller than the volume group's available space, either in MB or GB.
      • Logical volume name: Specify a volume name, for example, lvdata1.
      • Volume group name: Specify the name of the volume group where the logical volume belongs.

      In this example, run the following command:

      lvcreate -L 15GB -n lvdata1 vgdata

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# lvcreate -L 15GB -n lvdata1 vgdata
        Logical volume "lvdata1" created.
    2. Run the following command to query details of the logical volume:

      lvdisplay

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# lvdisplay
        --- Logical volume ---
        LV Path                /dev/vgdata/lvdata1
        LV Name                lvdata1
        VG Name                vgdata
        LV UUID                c7mNcF-CdPW-5PLD-1gVj-QZpB-nHfy-PHXchV
        LV Write Access        read/write
        LV Creation host, time ecs-lvmtest.novalocal, 2018-11-29 11:28:18 +0800
        LV Status              available
        # open                 0
        LV Size                15.00 GiB
        Current LE             3840
        Segments               2
        Allocation             inherit
        Read ahead sectors     auto
        - currently set to     8192
        Block device           252:0

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback