A desktop template contains a custom image. If the data disk capacity specified in the desktop template is larger than that of the custom image, the extra capacity is unallocated. You cannot directly use the extra capacity. To use the extra capacity, you must manually resize your data disk. This topic describes how to resize the partitions of a data disk.

Background information

A desktop template contains a custom image. The data disk capacity specified in the desktop template is larger than that of the image. Then, the initial data disk capacity of the cloud desktop created from the template is the same as the data disk capacity of the image. The extra capacity is in unallocated. You cannot use the extra capacity. To use the extra capacity, you must manually resize your data disk.

Example:
  • Desktop Template A contains a 150 GiB system disk, a 150 GiB data disk, and Custom Image B.
  • Custom Image B is created based on a cloud desktop that contains an 80 GiB system disk and a 70 GiB data disk.
The cloud desktop that is created based on Desktop Template A contains a 150 GiB system disk and a 70 GiB data disk. The extra 80 GiB is unallocated.

You can allocate the unallocated capacity to existing or newly created partitions of the data disk. In this topic, the existing partitions of a data disk are used.

Resize the partitions of a data disk in a Windows cloud desktop

  1. Log on to the cloud desktop. For more information, see Use a cloud desktop.
  2. In the cloud desktop, right-click Start and select Disk Management.
  3. In the Disk Management dialog box, right-click the data disk that you want to resize and select Extend Volume.
    Disk 1 indicates the data disk, which contains Partition D and the unallocated capacity. The capacity of Partition D is the same as that of the data disk contained in the custom image. The unallocated capacity is the difference between the data disk capacity of Desktop Template A and the data disk capacity of Custom Image B. Resize the data disk
  4. Extend the volume as prompted by the wizard.
    After the volume is extended, the new capacity is automatically added to the existing partition. Extend data disk 2

Resize the partitions of a data disk in a Linux cloud desktop

  1. Log on to the cloud desktop. For more information, see Use a cloud desktop.
  2. Click Start and then click the Terminal icon.
  3. Run the following command to switch to the root user:
    sudo su
  4. View the status of the disk.
    1. Run the following command to view the disk and partition information:
      fdisk -lu
      The following example command output shows that the vdb data disk is 150 GiB in size and has a 70 GiB partition named /dev/vdb1. The Type value is Linux, which indicates that the type of the partition is MBR. linux1
    2. Run the following command to check the file system type of the existing partition:
      df -Th
      The following command output shows that the file system type of the /dev/vdb1 partition is ext4. linux2
  5. Resize the partition of the data disk.
    1. Run the following command to install the growpart tool:
      1. Update the software repository.
        apt-get update
      2. Install cloud-guest-utils.
        apt-get install -y cloud-guest-utils
    2. Run the following command to resize the partition:
      growpart /dev/vdb 1
      Notice A space must exist between /dev/vdb and 1.
      The following figure shows the command output. linux3
  6. Resize the file system of the data disk partition.
    resize2fs /dev/vdb1          
  7. Check the resizing results.
    fdisk -lu
    The following command output shows that the /dev/vdb1 partition is resized to 150 GiB. linux4