Scale up a data disk

更新时间:
复制 MD 格式

As your business and application data grow, your data disk may run out of space. You can scale up the disk to increase its storage capacity.

Procedure

Step 1: Create a snapshot

Warning

Scaling up a data disk can cause data loss. Create a snapshot to back up your data before you proceed.

  1. Go to the Servers page in the Simple Application Server console.

  2. On the Servers page, find the server you want to back up and click its server ID on the server card.

  3. Click the Disks tab.

  4. In the Actions column for the data disk, click Create Snapshot.

  5. In the Create Snapshot dialog box, confirm the disk information, name the snapshot, and then click OK.

Step 2: Scale up the data disk

  1. Go to the Servers page in the Simple Application Server console.

  2. Find the server you want to update, and click its server ID.

  3. Click the Disks tab.

  4. In the upper-left corner of the page, click Scale up a data disk.

  5. In the Precautions dialog box, read the notes, and then click Data Disk Operation.

  6. Confirm the current configuration and its expiration date. Then, next to Data Disk, select a new size for the data disk.

    You can scale up a data disk to a maximum size of 16,380 GB.

    Important

    Data disks can only be scaled up, not scaled down.

  7. Review and accept the terms of service, and then click Buy Now.

    Follow the on-screen instructions to complete the payment.

  8. Remotely connect to the Simple Application Server to extend the partition and file system within the server's operating system.

    The steps vary depending on the server's operating system.

    Linux

    In this example, a data disk is scaled up from 40 GB to 60 GB.

    Note

    The default device name for a data disk on a Simple Application Server is /dev/vdb.

    1. Connect to your Linux server.

      For more information, see Connect to a Linux server.

    2. Run the following command to switch to the root user:

      sudo su root
    3. Check the disk and partition information on the server.

      1. Run the following command to view the disks on the server:

        fdisk -lu

        Scaling up a data disk does not affect the system disk. Therefore, this example shows information only for the data disk (/dev/vdb).

        [root@i2bp1h6se7u0xxx 3 admin]# fdisk -lu
        
        Disk /dev/vda: 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: 0x0008de3e
        
           Device Boot      Start         End      Blocks   Id  System
        /dev/vda1            2048    83884031    41940992   83  Linux
        
        Disk /dev/vdb: 64.4 GB, 64424509440 bytes, 125829120 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: 0x00000000
        
           Device Boot      Start         End      Blocks   Id  System
        /dev/vdb1               1    83886079    41943039+  ee  GPT
        [root@i2bp1h6se7xxx 3 admin]#
      2. Run the following command to view the partition information:

        df -Th

        The default file system type for the data disk partition (/dev/vdb1) on a Simple Application Server is ext4. The command output shows that the file system is still 40 GB (the pre-scale-up size), which means you must extend both the partition and the file system.

        The command output shows that /dev/vdb1 is mounted to the /test directory with the ext4 file system type and a total size of 40 GB.

        [root@iZbp1h6se7u09oqdn xxx admin]# df -Th
        Filesystem      Type      Size  Used Avail Use% Mounted on
        /dev/vda1       ext4       40G  2.1G   36G   6% /
        devtmpfs        devtmpfs  457M     0  457M   0% /dev
        tmpfs           tmpfs     466M     0  466M   0% /dev/shm
        tmpfs           tmpfs     466M  328K  466M   1% /run
        tmpfs           tmpfs     466M     0  466M   0% /sys/fs/cgroup
        tmpfs           tmpfs      94M     0   94M   0% /run/user/0
        /dev/vdb1       ext4       40G   49M   38G   1% /test
        tmpfs           tmpfs      94M     0   94M   0% /run/user/1000
    4. Extend the partition.

      1. Run the following command to install the gdisk utility.

        You must perform this step if your partition uses the GPT format. If your partition uses the Master Boot Record (MBR) format, skip this step.

        yum install gdisk -y
      2. Run the following command to install the growpart utility.

        The command varies depending on the operating system version:

        • For CentOS 7 and later, run the following command:

          yum install -y cloud-utils-growpart
        • For Debian 9 and later or Ubuntu 14 and later, run the following commands in sequence:

          Update the software sources.

          apt-get update

          Install cloud-guest-utils.

          apt-get install -y cloud-guest-utils
      3. Run the following command to extend the partition:

        Note

        Make sure to include a space between /dev/vdb and 1 in the command.

        growpart /dev/vdb 1

        The output is as follows:

        [root@iZbp1h6se7u09oqdmea**** admin]# growpart /dev/vdb 1
        CHANGED: partition=1 start=2048 old: size=83881984 end=83884032 new: size=125827038 end=125829086

        If this command fails, troubleshoot the issue manually. For more information, see Step 1: Scale up the disk capacity.

    5. Extend the file system.

      The default file system of the data disk partition (/dev/vdb1) on a Simple Application Server is ext4.

      1. Run the following command to extend the file system:

        resize2fs /dev/vdb1
      2. Run the following command to check the result:

        df -Th

        The command output shows that the file system size is now 60 GB, which indicates that the scale-up was successful.

        The command output shows that /dev/vdb1 is mounted to /test with a capacity of 59 GB, which indicates that the scale-up was successful.

        [root@iZbp1h6se7u09oxxxx admin]# df -Th
        Filesystem      Type      Size  Used Avail Use% Mounted on
        /dev/vda1       ext4       40G  2.1G   36G   6% /
        devtmpfs        devtmpfs  457M     0  457M   0% /dev
        tmpfs           tmpfs     466M     0  466M   0% /dev/shm
        tmpfs           tmpfs     466M  332K  466M   1% /run
        tmpfs           tmpfs     466M     0  466M   0% /sys/fs/cgroup
        tmpfs           tmpfs      94M     0   94M   0% /run/user/0
        /dev/vdb1       ext4       59G   52M   57G   1% /test
        tmpfs           tmpfs      94M     0   94M   0% /run/user/1000

        After the scale-up is complete, verify that your data is intact and that your applications are running correctly.

        • If the scale-up is successful and your applications are running as expected, no further action is required.

        • If the scale-up fails, use the snapshot you created to roll back the disk. For more information, see Roll back a disk by using a snapshot.

    Windows

    In this example, the server is running Windows Server 2012 R2 64-bit. The Simple Application Server's data disk (D:) is scaled up from 40 GB to 60 GB.

    1. Connect to the Windows server.

      For more information, see Connect to a Windows server.

    2. In the lower-left corner of the Windows desktop, right-click the Start icon 开始 and then click Disk Management.

    3. In the Disk Management window, click Action > Rescan Disks to detect the unallocated capacity.

      In this example, Disk 1 is the data disk.

    4. Right-click the primary partition of Disk 1 and select Extend Volume.

    5. In the Extend Volume Wizard, accept the default settings to complete the volume extension.

      After the volume extension is complete, you can see in Disk Management that the D: partition on Disk 1 has been expanded to 60.00 GB NTFS with a Healthy (Primary Partition) status, which indicates that the data disk scale-up was successful.

      After the scale-up, verify that your data is intact and that your applications are running correctly.

      • If the scale-up is successful and your applications are running as expected, no further action is required.

      • If the scale-up fails, use the snapshot you created to roll back the disk. For more information, see Roll back a disk by using a snapshot.