After you create a simple application server with an attached data disk, the data disk must be partitioned and formatted before it can be used. This topic describes how to view the information of a data disk and how to partition and format the data disk.

Prerequisites

A data disk is attached to a simple application server when the server is created. For more information, see Create a server.

Background information

After a server is created, you can view details of its data disk in the Simple Application Server console, such as the disk size, mount path, and status. For more information, see View the information of a data disk.

Data disks attached to simple application servers must be partitioned and formatted before the disks can be used. Procedures to partition and format data disks vary based on operating systems.
Note Disk partitioning and formatting are high-risk operations and may result in data loss on data disks. Data disks attached when simple application servers are created are new empty disks. You can partition and format these disks without data loss risks.

View the information of a data disk

  1. Log on to the Simple Application Server console.
  2. In the left-side navigation pane, click Servers.
  3. Click the card of the server whose data disk you want to view.
  4. In the left-side navigation pane, choose Server Maintenance > Disk to view the information of the data disk.
    23
    Alternatively, you can click Disk List in the left-side navigation pane of the Simple Application Server console and view the information of all disks attached to your servers.

Partition and format a data disk on a Linux server

The following example demonstrates how to use the Parted and e2fsprogs utilities to partition and format a data disk on a Linux server. CentOS 7.6 64-bit is used in the example.

To partition and format a data disk on a Linux server, we recommend that you use the GUID Partition Table (GPT) partition format and the XFS or EXT4 file system.

  1. Connect to the Linux server and install Parted and e2fsprogs.
    1. Connect to the Linux server.
    2. Run the following commands to switch to the root user and go back to the root directory:
      sudo su root
      cd
    3. Run the following commands in sequence to install Parted and e2fsprogs.
      • Run the following command to install Parted:
        yum install -y parted
      • Run the following command to install e2fsprogs:
        yum install -y e2fsprogs
  2. Run the following command to view the information of the data disk on the Linux server:
    fdisk -l
    The information of the data disk is returned, as shown in the following figure.
    Note Each simple application server can have one data disk attached. The device name of the data disk is /dev/vdb.
    fdisk
  3. Use Parted to partition the data disk.
    1. Run the following command to start partitioning the data disk:
      parted /dev/vdb
    2. Run the following command to set the partition format to GPT:
      mklabel gpt
      You are prompted that the partition format change will result in data loss on the disk. The data disk described in this topic is a new empty disk. Enter Yes at the prompt.
      Notice If your data disk contains data, you must create a snapshot of the disk before you proceed to prevent data loss.
    3. Run the following command to create a primary partition and specify the start and end sectors for the partition:
      mkpart primary 1 100%
    4. Run the following command to check whether the partition is aligned:
      align-check optimal 1
      The command output similar to the following one indicates that the partition is aligned. Check the partition
    5. Run the following command to view the partition table:
      print
      The information of the partition is returned, as shown in the following figure. Disk information
    6. Run the following command to exit the Parted utility:
      quit
  4. Run the following command to re-read the partition table:
    partprobe
  5. Create a file system for the /dev/vdb1 partition.
    Run one of the following commands to create a file system.
    • Run the following command to create an EXT4 file system:
      mkfs -t ext4 /dev/vdb1
    • Run the following command to create an XFS file system:
      mkfs -t xfs /dev/vdb1
    In this example, an EXT4 file system is created.
  6. Write the information of the new partition to /etc/fstab to enable the partition to be automatically mounted on server startup.
    1. Run the following command to create a mount point named /test:
      mkdir /test
    2. Run the following command to back up etc/fstab:
      cp /etc/fstab /etc/fstab.bak
    3. Run the following command to write the information of the new partition to /etc/fstab:
      echo `blkid /dev/vdb1 | awk '{print $2}' | sed 's/\"//g'` /test ext4 defaults 0 0 >> /etc/fstab
      Note In this example, the /dev/vdb1 partition device name, the /test mount point, and the ext4 file system are used. You can change these settings based on actual conditions.
    4. Run the following command to check the information of /etc/fstab:
      cat /etc/fstab
      If the command output shows the information of the new partition, the information is written to /etc/fstab. fstab
    5. Run the following command to make the data disk mount entries in etc/fstab take effect:
      mount -a
  7. Run the following command to view the current disk space and usage:
    df -h
    If the command output shows the information of the new file system, the partition is mounted. You can use the new file system. df

Partition and format a data disk on a Windows server

The following example demonstrates how to partition and format a data disk on a Windows server. The Windows Server 2012 R2 64-bit operating system is used in the example.

  1. Connect to the Windows server.
    For more information, see Connect to a Windows server.
  2. In the lower part of the desktop, right-click the Start icon and then select Disk Management.
    Disk Management
  3. In the Disk Management window, find the data disk that you want to partition and format. In this example, Disk 1 is to be partitioned and formatted. The disk is in the Not Initialized state.
  4. Right-click the blank area next to Disk 1 and select Initialize Disk.
  5. In the Initialize Disk dialog box, select Disk 1, select GPT (GUID Partition Table), and then click OK.
    GPT and Master Boot Record (MBR) are two different partition formats.
    • GPT is a new partition format that cannot be recognized by early Windows versions. The data disk size that GPT supports is determined based on the operating systems and the file systems. In Windows, GPT supports up to 128 primary partitions.
    • MBR is the most frequently used partition format. MBR supports data disks up to 2 TiB in size and a maximum of four primary partitions per disk. If you want to divide a disk into more than four partitions, you must use a primary partition as an extended partition and create logical partitions in the partition.
    3325
  6. In the Disk Management window, right-click the Unallocated space of Disk 1, and then select New Simple Volume.
    New Simple Volume
  7. In the New Simple Volume wizard, perform the following operations:
    1. Click Next.
    2. Specify the size of the simple volume.
      If you want to create only one primary partition, use the default value. Then, click Next. You can also divide Disk 1 into multiple partitions.
    3. Assign a driver letter and path.
      Select a driver letter. G is used in this example. Then, click Next.
    4. Format the partitions.
      Configure formatting settings such as the file system, allocation unit size, and volume label, and then optionally select Perform a quick format and Enable file and folder compression. In this example, the default settings are used. Then, click Next.
    5. When the dialog box indicates that the new simple volume is created, click Finish.
    Wait for the partitions to be formatted. When Disk 1 is in the Online state in the Disk Management window as shown in the following figure, the partitions are formatted. w12