Free up or expand disk space on a Windows instance to restore system performance, and set up routine disk maintenance.
Solution
The following examples use Windows Server 2019. Steps may vary in your environment.
Free up disk space
Delete unnecessary files to reclaim disk space.
-
Find large files on the disk.
-
Remotely connect to the Windows instance.
Connect to a Windows instance using password authentication.
-
On the desktop, double-click This PC.
-
Click the target disk and press Ctrl+E.
-
In the top navigation bar, choose to filter large files by predefined sizes.
NoteYou can also specify a custom size range. For example:
-
Enter Size: >500 MB to find files larger than 500 MB.
-
Enter Size: >100 MB < 500 MB to find files between 100 MB and 500 MB.
-
-
-
Delete unnecessary files.
Use Windows Disk Cleanup to delete files and empty the Recycle Bin.
-
In the search bar, enter Disk Cleanup, select the target disk, and click OK.
The system scans the disk for deletable files. This may take some time.
-
Select the files to delete and click OK.
-
Resize the disk or add a new one
If deleting files does not free enough space, Resize a disk (Windows), Create a data disk (Linux), or Attach a data disk.
Routine disk maintenance
Compress files on a schedule
Use a compression tool such as WinRAR to archive regularly generated files on a schedule, reducing disk consumption.
-
(Conditional) If no compression tool is installed, download and install WinRAR.
This example uses the Chinese version of WinRAR.
-
Right-click the target file and select Add To Archive.
-
Configure the archive path and parameters.
-
In the Archive Name And Parameters dialog box, click the Backup tab and select Generate Archive Name By Mask. Do not click OK yet.
-
Click the General tab, click Browse to set the archive path, then click Specifications > Save Current Settings To A New Profile.
-
In the Profile Parameters dialog box, enter a Profile Name, select Save Archive Name, Save Selected File Names, and Create Shortcut On Desktop, then click OK.
-
In the Archive Name And Parameters dialog box, click OK.
A shortcut for the compression profile is created on the desktop.
-
-
Schedule automatic compression with Task Scheduler.
-
Open Control Panel > System And Security > Administrative Tools > Task Scheduler. In the Task Scheduler dialog box, click Create Basic Task.
-
Follow the wizard to configure the task.
In the Start A Program step, set Program/script to the desktop shortcut created earlier.
-
Uninstall unused applications
In Control Panel > Programs And Features, review and uninstall applications you no longer need.
Clean up disks periodically
Log files from applications on multiple ECS instances can accumulate and exhaust disk space. Use CloudOps Orchestration Service (OOS) to schedule automatic batch cleanup of disk files. See Periodically clean up disk space.
Monitor disk space usage
In the CloudMonitor console, view metrics such as used storage space, disk usage, and inode usage. Create alert rules for disk metrics so you receive notifications when usage reaches the threshold.
Optimize storage to prevent recurring full disks
If disk space is frequently exhausted or data grows rapidly, consider alternative storage solutions.
-
For large volumes of files such as images and videos that do not require high-concurrency I/O, use Object Storage Service (OSS). OSS scales automatically and provides massive, low-cost storage. Mount an OSS bucket to an ECS instance with ossfs to access files as if they were local.
-
For high-concurrency reads, writes, and file sharing, use File Storage NAS. NAS provides scalable, high-performance shared storage that auto-scales with data growth. See Quick Start (Windows).
-
For large-scale log collection and analysis, you can store logs in Simple Log Service (SLS). This simplifies log queries and reduces storage consumption.