Disk resizing and shrinking FAQ
Resolve insufficient disk space
-
How do I view the usage and free space of an Elastic Block Storage disk?
-
Resolving an insufficient disk space issue for a Linux instance
-
Troubleshooting guide for decreasing free space on the C drive of a Windows instance
Disk resizing FAQ
-
What do I do if I cannot extend a GPT partition using growpart after I resizing a disk?
-
Do both subscription and pay-as-you-go ECS instances support system disk resizing?
-
How do I use a snapshot to create a disk and losslessly resize a data disk?
-
What do I do if I have performed an offline resizing but do not want to restart the instance?
Disk shrinking FAQ
Appendix
How do I view the usage and free space of an Elastic Block Storage disk?
Log on to the ECS instance to view disk usage and free space. This information is not available in the ECS console or through API calls.
How do I resize a system disk?
Resize a system disk in the console or call the ResizeDisk.
Do all Elastic Block Storage disks support system disk resizing? Are there any region-specific limits?
ESSD AutoPL disks, ESSD PL-X disks, ultra disks, standard SSDs, and ESSDs support system disk resizing in all regions.
Do both subscription and pay-as-you-go ECS instances support system disk resizing?
Yes. Both subscription and pay-as-you-go instances support system disk resizing.
What is the capacity range of a system disk? What is the maximum capacity to which it can be resized?
The capacity range varies by image. See Limits of Elastic Block Storage.
Is specifying the system disk capacity not supported when changing the system disk after an ECS renewal with specification change?
After you renew a subscription instance with a specification downgrade, you can resize the system disk only after the new billing cycle starts.
How do I use a snapshot to create a disk and lossless resizing a data disk?
If lossless resizing fails for a data disk, create a temporary pay-as-you-go disk to store the data, then format the original disk:
-
Create a snapshot for the source data disk.
-
On the disk purchase page, set the region and zone to match the ECS instance. Select Create from Snapshot and choose the snapshot from the previous step.
-
In the ECS console, attach the new disk to the same instance.
-
Log on to the instance and run mount to mount the new disk. See Create a data disk from a snapshot.
-
Verify that files on the new disk match the source data disk.
-
After confirming data consistency, use fdisk to delete the original partition table, then re-partition and format the disk with fdisk and mkfs.ext3. See Offline extend partitions and file systems (Linux data disk).
-
Copy all data from the new disk back to the source disk with
cp -R.Add --preserve=all to retain file properties.
-
Unmount the new disk with umount.
-
In the ECS console, detach and release the new disk.
Why do I receive the "Bad magic number in super-block while trying to open /dev/vdb1" error when resizing a disk for a Linux ECS instance?
-
Symptom: Running
e2fsck -f /dev/vdbafter resizing returns:Bad magic number in super-block while trying to open /dev/vdb1 -
Cause: The starting sector changed. For example,
fdisk -lushows the original starting sector was 63, but the default is 2048 when re-creating the partition. -
Solution:
-
View and record the starting sector with
fdisk -lu /dev/vdb. -
Create a new partition and modify its starting sector with
fdisk /dev/vdb. Enterrto return to the main menu, then enterwqto save and exit. -
Extend the file system with
e2fsck -f /dev/vdbandresize2fs /dev/vdb. extend -
Remount the disk with mount.
-
What do I do if I have performed an offline resizing but do not want to restart the instance?
If you performed an offline resizing but do not want to restart the instance, perform another online resizing to apply the changes while the instance runs. The second resizing incurs additional fees.
For example, you resized a disk offline to 60 GiB but did not restart the instance. The change has not taken effect. Perform an online resizing to 61 GiB. After completion, the disk capacity in the operating system is 61 GiB.
Can I reduce the capacity of a disk?
Alibaba Cloud does not support reducing disk capacity directly. Two solutions are available:
Solution 1: Use Server Migration Center (SMC)
-
Use SMC to shrink a disk.
-
To ensure data security, create a snapshot before shrinking the disk.
Solution 2: Replace the data disk and migrate data
-
Create a data disk with a suitable capacity and attach it to the instance.
-
Migrate the data from the original data disk to the new data disk.
-
Convert the original disk billing to pay-as-you-go, then detach and release the disk.
ImportantA released disk cannot be recovered. Back up important data before releasing the disk.
-
After converting a subscription disk to pay-as-you-go, Alibaba Cloud refunds the remaining fees. See Elastic Block Storage billing.
Choose a solution based on your needs.
Can I shrink a disk after it has been resized?
No. Disk capacity cannot be reduced after resizing. Plan storage carefully. Use SMC to shrink a disk.