Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-07-01 14:37:26
This topic describes how to format a data disk whose capacity is greater than or equal to 2 TB. If you want to partition a data disk whose capacity is greater than 2 TB, you must use the GPT partition format.
Operating environment
A data disk with a capacity of 2,400 GB is attached to a KEC instance that runs 64-bit Windows Server 2016 R2. The following procedure shows you how to initialize the data disk in the GPT partition format, format the data disk, and then create an NTFS file system for the data disk.
Procedure
Note: If the data disk that you want to initialize is in the Offline state, as shown in the preceding figure, you must perform Step 4 to bring it online before you perform Step 5 to initialize it. If the data disk is in the Online state, you can directly perform Step 5 to initialize it.
Operating environment
A data disk with a capacity of 2,400 GB is attached to a KEC instance that runs 64-bit CentOS 7.6. The following procedure shows you how to create a primary partition for the /dev/vdb data disk by using the parted partition utility, initialize the partition in the GPT format, and then create an ext4 or XFS file system for the partition. After you configure the file system, you can mount the file system to the /mnt/data_disk01 directory and configure the file system to be automatically mounted upon operating system startup.
Note: By default, the device names of data disks are assigned by the system, which ascend from /dev/vdb to /dev/vdz. If you do not need to create logical partitions such as /dev/vdb1 or /dev/vdb2 on your data disk, you can directly create a file system on the raw data disk. For more information, see Create a file system on a raw data disk.
Procedure
Run the following command to view the information about the EBS volumes on the KEC instance:
fdisk -l
The following figure shows the output. The following table describes the information extracted from the figure. | EBS volume | Partition | Partition description |
---|---|---|---|
/dev/vda is the system disk with a capacity of 50 GB. | /dev/vda1 | MBR partition, with a capacity of 50 GB | |
/dev/vdb is a data disk with a capacity of 2,400 GB. | /dev/vdb | No partition |
Note: If the /dev/vd* data disk that you purchase is not displayed in the command output, check whether the data disk is attached to the instance. In this example, the data disk is /dev/vdb. For more information about how to attach a data disk to a KEC instance in the EBS console, see Attach an EBS volume.
parted <Data disk name>
command to partition the data disk by using the parted partition utility. In this example, the /dev/vdb
data disk is partitioned.
parted /dev/vdb
Perform the following steps:
a. Enter print and press the Enter key to view the current partition information about the data disk. Partition Table: unknown indicates that the partition format is unknown.
b. Run the mklabel <Partition format>
command to set the partition format of the data disk. In this example, the capacity of the data disk is 2,400 GB. Therefore, you must set the partition format to GPT.
mklabel gpt
c. Enter print and press the Enter key to check whether the partition format is set. Partition Table: gpt indicates that the partition format is GPT.
d. Run the mkpart <Partition name> <Start sector> 100%
command to create a primary partition and specify the start sector and end sector for the partition.
In this example, run the following command to create a primary partition named primary
, set the start sector to 2048s
and the end sector to 100%
, and allocate the full capacity (2,400 GB) of the data disk to the partition:
mkpart primary 2048s 100%
e. Enter print and press the Enter key to check whether the primary partition is created. In this example, the primary partition is /dev/vdb1.
f. Run the quit
command to exit the parted utility.
The following figure shows the output.
Run the following command to view the information about the new partition:
lsblk
The following figure shows the output.
Run the mkfs.<fstype> <Partition name>
command to format the new partition and create a file system. In this example, create an ext4 file system.
To create an ext* file system, for example, ext4, run the following command:
Create a file system for the /dev/vdb1 partition
mkfs.ext4 /dev/vdb1
The following figure shows the output.
Note: In the preceding command,
/dev/vdb1
is the partition name. You must change it based on your business requirements.
To create an XFS file system, run the following command:
Create a file system for the /dev/vdb1 partition
mkfs.xfs -f /dev/vdb1
The following figure shows the output.
Note: In the preceding command,
/dev/vdb1
is the partition name. You must change it based on your business requirements. If the message-bash: mkfs.xfs: command not found
appears, run theyum -y install xfsprogs
command to install the RPM package of xfsprogs.
mkdir <Mount point>
command to create a mount point for the new partition. In this example, create a mount point named /mnt/data_disk01
.
mkdir /mnt/data_disk01
mount <Partition name> <Mount point>
command to mount the new partition. In this example, mount the /dev/vdb1
partition to the /mnt/data_disk01
mount point.
mount /dev/vdb1 /mnt/data_disk01
df -Th
The following figure shows the output.
Description of optional actions If you want the new partition of the data disk to be automatically mounted to the KEC instance when the KEC instance starts or restarts, perform the following steps to add the information about the new partition to the /etc/fstab file.
Confirm the mount method and obtain the required information. A partition can be automatically mounted by using the UUID or name of the partition. Perform the corresponding operation to obtain the UUID or name.
To obtain the UUID of the /dev/vdb1 partition, run the following command:
blkid /dev/vdb1
To obtain the partition information about the data disk, run the following command:
lsblk
The following figure shows the output. Note: If you detach or delete an EBS volume from a running KEC instance, the names of other EBS volumes attached to the KEC instance may change. We recommend that you reference a partition by adding the UUID of the partition to the /etc/fstab file.
Run the following command to back up the etc/fstab file:
cp /etc/fstab /etc/fstab.bak
/dev/vdb1
partition to the /mnt/data_disk01
mount point.
echo 'UUID=88b09a56-96fa-4158-8264-a4642bbd1814 /mnt/data_disk01 ext4 defaults 0 0' >> /etc/fstab
echo '/dev/vdb1 /mnt/data_disk03 ext4 defaults 0 0' >> /etc/fstab
cat /etc/fstab
command to view the auto-mount configuration.
cat /etc/fstab
The following figure shows the output.
mount -a
If the command is successfully run, the /etc/fstab file is successfully configured, and the file system created for the partition will be automatically mounted when the operating system starts.
Pure Mode