No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

FusionCloud 6.3.1 Management Plane Hybrid Cloud Guide 05

Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Initializing the Data Disk (in the Linux OS)

Initializing the Data Disk (in the Linux OS)

HUAWEI CLOUD EVS disks must be initialized before being used. The UI for initializing data disks varies according to Linux OS series. This section uses CentOS 7.0 64-bit as an example to describe how to initialize data disks in the Windows OS.

Prerequisites

  • You have logged in to the HUAWEI CLOUD ECS.
  • The data disk has been attached to a HUAWEI CLOUD ECS, and the disk has not been initialized.

Procedure

Creating Partitions and Attaching a Disk

Example scenario: When a new data disk is attached to the HUAWEI CLOUD ECS, the data disk must be set as the primary partition in ext4 format and be automatically attached to the /mnt/sdc directory upon ECS start.

  1. Run the following command to view information about the added data disk:

    fdisk -l

    Information similar to the following is displayed: (In the command output, the server contains two disks. /dev/xvda is the system disk, and /dev/xvdb is the added data disk.)

    [root@ecs-b656 test]# fdisk -l
    
    Disk /dev/xvda: 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: 0x000cc4ad
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvda1   *        2048     2050047     1024000   83  Linux
    /dev/xvda2         2050048    22530047    10240000   83  Linux
    /dev/xvda3        22530048    24578047     1024000   83  Linux
    /dev/xvda4        24578048    83886079    29654016    5  Extended
    /dev/xvda5        24580096    26628095     1024000   82  Linux swap / Solaris
    
    Disk /dev/xvdb: 10.7 GB, 10737418240 bytes, 20971520 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

  2. Run the following command to allocate partitions for the added data disk using fdisk:

    fdisk Newly added data disk

    In this example, /dev/xvdb is the newly added data disk.

    fdisk /dev/xvdb

    Information similar to the following is displayed:

    [root@ecs-b656 test]# fdisk /dev/xvdb
    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.
    Device does not contain a recognized partition table
    Building a new DOS disklabel with disk identifier 0xb00005bd.
    Command (m for help): 

  3. Enter n and press Enter to create a partition.

    Entering n creates a partition.

    There are two types of disk partitions:

    • Selecting p creates a primary partition.
    • Selecting e creates an extended partition.
    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended

  4. A primary partition is used in this example. Enter p and press Enter to create a primary partition.

    Information similar to the following is displayed. Partition number indicates the serial number of the primary partition. The value can be 1 to 4.

    Select (default p): p
    Partition number (1-4, default 1):

  5. Primary partition number 1 is used in this example. Enter 1 and press Enter.

    Information similar to the following is displayed. First sector indicates the start cylinder number. The value can be 2048 to 20971519, and the default value is 2048.

    Partition number (1-4, default 1): 1
    First sector (2048-20971519, default 2048):

  6. The default first sector 2048 is used in this example. Select 2048 and press Enter.

    Information similar to the following is displayed. Last sector indicates the end cylinder number. The value can be 2048 to 20971519, and the default value is 20971519.

    First sector (2048-20971519, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):

  7. The default last sector 20971519 is used in this example. Select 20971519 and press Enter.

    Information similar to the following is displayed. A partition is created for a 10 GB data disk.

    Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
    Using default value 20971519
    Partition 1 of type Linux and of size 10 GiB is set
    Command (m for help):

  8. Enter p and press Enter to view the details about the created partition.

    Information similar to the following is displayed. Details about the /dev/xvdb1 partition are displayed.

    Command (m for help): p
    
    Disk /dev/xvdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0xb00005bd
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvdb1            2048    20971519    10484736   83  Linux
    
    Command (m for help): 

  9. Enter w and press Enter to write the changes into the partition table.

    If information similar to the following is displayed, the partition is successfully created:

    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

  10. Run the following command to synchronize the new partition table to the data disk:

    partprobe

  11. Run the following command to set the format for the file system of the newly created partition:

    mkfs -t File system format /dev/xvdb1

    For example, run the following command to set the ext4 file system for the /dev/xvdb1 partition:

    mkfs -t ext4 /dev/xvdb1

    Information similar to the following is displayed:

    [root@ecs-b656 test]# mkfs -t ext4 /dev/xvdb1
    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
    655360 inodes, 2621184 blocks
    131059 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=2151677952
    80 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
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done

    The formatting takes a period of time. Observe the system running status, and do not exit.

  12. Run the following command to create a mounting directory:

    mkdir Mounting directory

    /mnt/sdc is used in this example.

    mkdir /mnt/sdc

  13. Run the following command to mount the new partition on the created mounting directory:

    mount /dev/xvdb1 Mounting directory

    For example, run the following command to mount the newly created partition on /mnt/sdc:

    mount /dev/xvdb1 /mnt/sdc

  14. Run the following command to view the mount result:

    df -TH

    Information similar to the following is displayed. The newly created /dev/xvdb1 partition has been mounted on /mnt/sdc.

    [root@ecs-b656 test]# df -TH
    Filesystem     Type      Size  Used Avail Use% Mounted on
    /dev/xvda2     xfs        11G  7.4G  3.2G  71% /
    devtmpfs       devtmpfs  4.1G     0  4.1G   0% /dev
    tmpfs          tmpfs     4.1G   82k  4.1G   1% /dev/shm
    tmpfs          tmpfs     4.1G  9.2M  4.1G   1% /run
    tmpfs          tmpfs     4.1G     0  4.1G   0% /sys/fs/cgroup
    /dev/xvda3     xfs       1.1G   39M  1.1G   4% /home
    /dev/xvda1     xfs       1.1G  131M  915M  13% /boot
    /dev/xvdb1     ext4       11G   38M  9.9G   1% /mnt/sdc

Setting Automatic Disk Attaching at System Start

To automatically mount a disk when a HUAWEI CLOUD ECS starts, you should not specify its partition, for example /dev/xvdb1, in /etc/fstab, because the sequence of cloud devices may change during the ECS stop and start. You are advised to use the universally unique identifier (UUID) in /etc/fstab to automatically attach a disk at system start.

NOTE:

The disk UUID is the unique character string for storage devices in a Linux system.

  1. Run the following command to query the partition UUID:

    blkid Disk partition

    For example, run the following command to query the UUID of /dev/xvdb1:

    blkid /dev/xvdb1

    Information similar to the following is displayed: (The UUID of /dev/xvdb1 is displayed.)

    [root@ecs-b656 test]# blkid /dev/xvdb1
    /dev/xvdb1: UUID="1851e23f-1c57-40ab-86bb-5fc5fc606ffa" TYPE="ext4"

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

    vi /etc/fstab

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

    UUID=1851e23f-1c57-40ab-86bb-5fc5fc606ffa /mnt/sdc      ext4 defaults     0   2

  5. Press Esc, enter :wq, and press Enter.

    The system saves the configuration and exits the vi editor.

Translation
Download
Updated: 2019-01-17

Document ID: EDOC1100043116

Views: 32538

Downloads: 20

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next