Expand Disk
After expanding a disk using the ECS console or OpenAPI, you must restart the instance via the ECS console or OpenAPI for the changes to take effect.
After the expansion is effective, users still need to manually format the extended storage space.
Linux System Disk Expansion
1. Log in to the ECS instance.
2. If your disk was previously mounted on the server, unmount it first.
umount /mnt/dev1
3. Delete the original partition and create a new one.
Use the fdisk command. Enter d to delete the original partition, then enter n, p, 1 sequentially to create a new partition. When selecting the sector, press Enter here to select the default value; you can also choose according to your needs. To ensure data consistency, it is recommended that the First sector be consistent with the previous partition.
root@iZ94lw423m7Z:~# fdisk /dev/xvdb
Command (m for help): d
Selected partition 1
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-146800639, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-146800639, default 146800639):
Using default value 146800639
Command (m for help): wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
4. Format the disk.
Use the resize2fs command to expand the file system size. Original data will not be lost.
e2fsck -f /dev/xvdb1
resize2fs /dev/xvdb1
5. Mount the disk.
Finally, mount the expanded disk back to its original mount point.
mount /dev/xvdb1 /mnt/dev1
6. Use the df -TH command to view disk information.
df -TH
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 22G 1.4G 19G 7% /
none tmpfs 4.1k 0 4.1k 0% /sys/fs/cgroup
udev devtmpfs 510M 4.1k 510M 1% /dev
tmpfs tmpfs 105M 381k 104M 1% /run
none tmpfs 5.3M 0 5.3M 0% /run/lock
none tmpfs 521M 0 521M 0% /run/shm
none tmpfs 105M 0 105M 0% /run/user
/dev/xvdb1 ext4 74G 55M 71G 1% /mnt/dev1
Windows System Disk Expansion
We use Windows Server 2008 as an example here; other Windows versions are similar.
1. We set the initial disk size to 63 GB, and we expand the disk to 70 GB via API.
ResizeDisk --DiskId=d-94psj4qii --NewSize=70
2. Then restart the server.
RebootInstance --InstanceId=i-94nzmvvhc
3. Log in to the ECS instance.
4. Click Start, find Computer, right-click, and select Manage. As shown in the figure below:

5. After opening the management interface, select Storage –> Disk Management from the left navigation bar.

6. Right-click the D drive, then select Extend Volume. (Data will not be lost)

7. Just keep clicking Next.
8. Expansion complete
