Elastic Volume Service

Initialising Linux-based Data Disks (parted)

2024-11-01 09:21:32

Scenario

This topic uses CentOS 7.6 64-bit as an example to describe how to use the parted partitioning tool to set partitions for a data disk. The information returned is for reference only.

Before You Begin

A data disk is attached to a cloud server or dedicated physical server and this data disk is not initialised.

Operation Steps

If the capacity of the new EVS is less than 2 TB, use the parted tool to initialise the Linux-based data disk in the following five steps:

Ÿ   Log in to the ECS

Ÿ   View the newly added data disk: Check whether the newly added data disk has been successfully attached to the cloud server and check its capacity.

Ÿ   Create an GPT partition: Create an independent logical partition for the newly added data disk to better organize and manage data.

Ÿ   Create and mount a file system: Create a file system for the new partition and use an independent file system to store data.

Ÿ   Set automatic disk mounting upon startup: The disk can be automatically mounted when the cloud server system starts.

Log in to the ECS

1.       Log in to the console.

2.       Click   in the upper left corner of the console and select a Region. In this topic, China (Hong Kong 2) is selected.

3.       Select Compute and click ECS to go to the ECS list page.

4.       Locate the row that contains the cloud server for which the data disk is to be initialised, and in the Operation column, click Remote Login to log in to the cloud server. For more information, see Overview of Linux ECS Login.

Viewing the Newly Added Data Disk

Ÿ   Run the fdisk -l command to view the newly added data disk. The following information is returned:

The current cloud server has two disks, of which /dev/vda is the default system disk and /dev/vdb is the newly added data disk with a capacity of 30 GB to be initialised.

Creating an GPT Partition

This following section describes how to use the parted tool to create an GPT partition for the newly added data disk /dev/vdb.

1.       Run the parted /dev/vdb command to enter the parted partitioning tool. The following information is returned:

2.       Type "p" and press Enter to view the partition form of the current disk. The following information is returned:

3.       If Partition Table is unknown, the partition form is unknown.

4.       Type the mklabel gpt command to set the partition form to gpt.

5.       Type "p" and press Enter to view again the partition form of the disk after setting the partition form. The following information is returned:

It can be seen that Partition Table is gpt, indicating that the partition form is set to GPT.

6.       Type "unit s" and press Enter to set the metering unit of the disk to cylinder.

7.       Type "mkpart opt 2048s 100%" and press Enter. 2048s indicates the start disk capacity and 100% indicates the end disk capacity. The parameters are for reference only. In this example, a partition is created for the entire disk. You can plan the number and capacity of disk partitions based on your business needs. The following information is returned:

Caution: A warning message may display:

Warning: The resulting partition is not properly aligned for   best performance.

Ignore/Cancel? Ignore

If such a performance optimization reminder is displayed, type   "Ignore" to ignore this reminder.

8.       Type "p" and press Enter. You can view the detailed information of the newly created partition. The following information is returned:

9.       Type "q" and press Enter to exit the parted partitioning tool. The partition is created. The operations and returned are shown in the following figure:

10.  Run the lsblk command to check that the partition is created. The following information is returned:


EgIQ7GNWjH17