Home/Docs/Cloud

Cloud

Free up storage space on a Cloud Server (Linux)

How to Free Up Storage Space on a Cloud Server (Linux) When migrating your Cloud Server to a VPS , you need at least 100 MB of free space in both the root (/) and boot (/boot) directories . Without enough free space,...

Author
adminhowto.com Editorial
Updated
Mar 6, 2025
Estimated time
5 min read
Difficulty
Practical
Applies to
Common server environments
images

How to Free Up Storage Space on a Cloud Server (Linux)

When migrating your Cloud Server to a VPS, you need at least 100 MB of free space in both the root (/) and boot (/boot) directories. Without enough free space, the migration may fail.

This guide will show you how to check available storage, remove unnecessary files, clear old logs, and uninstall unused programs to optimize your Linux Cloud Server.


Step 1: Check Available Storage Space

Before making changes, check how much space is currently available using:

bashdf -h

This command displays storage usage in a human-readable format (MB, GB).

To check how much space individual directories are using, run:

bashdu -sh /

Step 2: Empty Log Files

Log files grow over time and can consume significant storage. You can clear them if they are no longer needed.

View Large Log Files

To list log files by size, run:

bashls -l -S -h /var/log

Clear Unnecessary Log Files

To empty a log file while keeping the file structure intact, use:

bash> /var/log/LOGFILENAME.log

For example:

bash> /var/log/dnf.log.1

⚠️ Warning: Always review log files before clearing them, as they may contain important system data.


Step 3: Remove Old Plesk Backups

If you use Plesk to manage your server, it might have multiple old backups that take up space.

We recommend reviewing and deleting outdated backups to free up additional storage.

Follow Plesk’s backup removal instructions to safely delete unnecessary backups.


Step 4: Find and Delete Large Files

To locate large files, use the following command:

bashdu --block-size=MiB --max-depth=1 | sort -n

Example output:

bash1MiB ./crash
1MiB ./local
3MiB ./backups
120MiB ./www
672MiB ./tmp
4157MiB ./log
7321MiB .

Delete Unnecessary Files

To delete a single file, use:

bashrm FILENAME

To delete multiple files, run:

bashrm FILENAME1 FILENAME2

To delete read-only files, use:

bashrm -i FILENAME

To delete all files within a directory, run:

bashrm -r DIRECTORYNAME/*

Step 5: Uninstall Unused Programs

Unused applications take up space and should be removed.

For CentOS 7

bashsudo yum remove PACKAGENAME

For CentOS Stream 8/9, Rocky Linux 8/9, AlmaLinux 8/9

bashsudo dnf remove PACKAGENAME

For Debian / Ubuntu

bashsudo apt purge PACKAGENAME

Step 6: Delete Old Kernels

Over time, old Linux kernels accumulate, using valuable space. To check your current kernel version, run:

bashuname -r

List All Installed Kernels

For Debian / Ubuntu:

bashdpkg --list 'linux-image-*'

For CentOS, Rocky Linux, AlmaLinux:

bashrpm -qa kernel

⚠️ Make sure at least one stable kernel remains installed to prevent system instability.

Remove Old Kernels

For Debian / Ubuntu:

bashapt-get remove linux-image-x.x.x

For CentOS, Rocky Linux, AlmaLinux:

bashyum remove kernel-x.x.x

Step 7: Verify Available Storage Space

Once cleanup is complete, confirm that enough space has been freed up by running:

bashdf -h

If additional space is needed, repeat the above steps to find and remove more unnecessary files.


Final Thoughts

Regularly cleaning up your Linux Cloud Server improves performance, ensures smooth migrations, and prevents storage-related issues. By following these steps, you can free up space and keep your system running efficiently.

🚀 Try these steps today to optimize your storage!

💬 Have questions? Drop them in the comments below!