Support > About cloud server > What to do if Hong Kong VPS server has insufficient disk space? Solution
What to do if Hong Kong VPS server has insufficient disk space? Solution
Time : 2025-09-12 10:31:04
Edit : Jtti

With the continuous growth of their businesses, more and more enterprises and individuals are choosing Hong Kong VPS servers to deploy websites, applications, or cross-border e-commerce operations. However, insufficient disk space often arises during use. Once the VPS disk is full, it not only impacts business operations but can also cause database write failures, website errors, or even system crashes.

Ⅰ. Common Causes of Insufficient Disk Space on Hong Kong VPSs

Large Log Files: Linux systems and application services (such as Nginx, Apache, and MySQL) continuously generate logs. Without log rotation or cleanup settings, these logs can occupy several gigabytes or even tens of gigabytes of disk space.

Cache and Temporary File Accumulation: Web caches, system temporary directories (/tmp), and residual packages from software upgrades can all contribute to significant disk space usage.

Database File Expansion: As databases like MySQL and PostgreSQL grow in size, the storage files gradually increase. Without archiving or sharding, these files can easily fill up the entire disk.

Excessive Website Uploads: User-uploaded images, videos, and attachments on e-commerce websites, forums, and video sites often quickly consume disk space.

An unreasonable backup strategy: Many users store backup files directly on the same VPS and fail to clean up old backups, which can easily lead to disk failure.

Residual software packages and update files: The cache generated during APT/YUM installation and updates will gradually occupy space if not regularly cleaned up.

II. Detecting and Troubleshooting Insufficient Disk Space

Before addressing the issue, first confirm disk usage.

1. Checking Disk Usage

df -h

This command clearly displays the disk usage of each mount point. Focus on directories like /, /var, /home, and /data.

2. View Large Files and Directories

du -sh /*
du -sh /var/* | sort -h

Quickly find which directories are taking up the most space.

3. Find large files over 500MB

find / -type f -size +500M -exec ls -lh {} \;

This helps locate unusual files, such as large log files or database dump files.

III. Solutions for insufficient disk space on a Hong Kong VPS

1. Clean up system logs and temporary files

Clean up system logs: Only logs from the last 7 days are retained; all others are automatically deleted.

journalctl --vacuum-time=7d

Clean up the temporary directory

rm -rf /tmp/*

Use logrotate for log rotation: Configure automatic rotation in /etc/logrotate.conf to prevent logs from growing indefinitely.

2. Clear the package cache

Debian/Ubuntu systems

apt-get clean
apt-get autoremove

CentOS/RedHat system

yum clean all

These commands free up cached files during updates and installations.

3. Optimize database space

Clean up unused data: Delete historical tables and archive old data to prevent database files from growing unchecked.

Optimize tablespace

mysqlcheck -o --all-databases -u root -p

Enable sharding and separate hot and cold data: For large-scale businesses, active and historical data can be stored separately to reduce the pressure on a single database.

4. Delete old backups and store them appropriately

Delete expired backups: Automatically purge backups older than 30 days.

find /backup/ -type f -mtime +30 -exec rm -f {} \;

Offsite Backup Storage: Use rsync or rclone to transfer backups to cloud storage, reducing local disk usage.

5. Compression and Archiving Files

Packaging and Compression: Bundle and compress scattered logs to free up space.

tar -czf logs_$(date +%F).tar.gz /var/log/*.log

Enable file system compression: For file systems like ZFS and Btrfs, transparent compression can be enabled to improve disk utilization.

6. Expanding the disk capacity of your Hong Kong VPS

If your business data volume continues to grow and cleanup and optimization efforts are insufficient to keep up, consider expanding the capacity. Most Hong Kong VPSs support online disk capacity upgrades, but this may require an instance restart. If your service provider provides additional hard drives, you can mount them to /data or /mnt specifically for storing large data files.

If your VPS uses LVM, you can expand the capacity using the following command:

lvextend -L +20G /dev/mapper/centos-root
resize2fs /dev/mapper/centos-root

This will expand the root directory by 20GB.

IV. Strategies for Preventing Low Disk Space

Enable disk monitoring and alerting: Use Zabbix, Nagios, or your cloud provider's monitoring platform to set disk usage thresholds and alerts.

Automated cleanup scripts: Create scheduled tasks to regularly clean up logs, caches, and old backups to prevent manual oversight.

Separate storage architecture: Distribute databases, website files, and logs across different partitions or disks to avoid single points of saturation.

A sound backup strategy: Avoid storing backup files permanently on your business VPS; instead, transfer them to remote or cloud storage.

Low disk space on Hong Kong VPSs is a common problem. There are two fundamental solutions: deleting unused files, rotating logs, compressing and archiving files, and clearing caches and old backups. Upgrading disk capacity, properly partitioning, and deploying remote or cloud storage can also help. In daily operations and maintenance, adhere to the principles of "preventive measures, in-progress monitoring, and post-event optimization" to establish a comprehensive disk space management mechanism. Automated scripts and monitoring alerts can effectively reduce the risk of disk fullness and ensure the stable operation of your Hong Kong VPS server.

Relevant contents

Can the Japanese cloud server operate continuously for a long time? Will it experience downtime? Is the Hong Kong cloud server connection timeout necessarily a server problem? Causes and troubleshooting steps for remote cloud server connection timeouts A comprehensive analysis of M.2 and U.2 interfaces: performance, features, and application scenario selection guide Can Japan CN2 GIA VPS really solve international network latency? Does Japan's CN2 server significantly improve access speed? How to buy a cloud server with stable performance? Core indicator requirements How to choose CN2/BGP line type when choosing Japan VPS Does Hong Kong VPS charging by bandwidth mean unlimited traffic? Emergency solution for Google Chrome failing to start due to an error in a VPS environment
Go back

24/7/365 support.We work when you work

Support