Safely delete files when disk run out of space in ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure
This article provides a solution for situations where you’ve run out of disk space and need to safely remove files.
Note:  Before proceeding, review the Manage disk space section in our developer documentation. If the steps outlined there don’t apply to your case or fail to resolve the issue, follow the guidance in this article.
Description description
Environment
ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure 2.4.2 - 2.4.7.
This is specific to dedicated Pro clusters. Starter and Integration environments are single node, and do not have the/data/exports
directory.
Signs of low disk space
Signs that you’re running out of disk space include stuck deployments, disk full  warnings, and degraded performance.
To check disk space usage, run the following command in the CLI or terminal:
df -h
Resolution resolution
How to safely delete files to increase disk space
You can delete files from the application’s mount points—either from the /app
path or through /mnt/shared
. These are two different ways to access the same files.
Warning:
- Never modify or delete the contents of
/data/exports
. /data/exports
 is the underlying storage behind the shared filesystem and is managed by GlusterFS.- The filesystem contains not only file contents but also metadata about the state of the filesystem to allow for synchronization between the nodes of your cluster.
Changing or deleting files directly within this filesystem can corrupt the shared filesystem, requiring extensive repairs or data recovery.
To locate the largest files that might be good candidates for clearing, run the following command (on large or busy projects can take up to an hour):
FS='/data/exports';NUMRESULTS=20;resize;clear; echo "Please find below the Largest Directories and Files:";date;df -h $FS; echo "Largest Directories:";nice -n 19 find /app/*/ -type d -ls 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '
{printf "%d MB %s\n", $1/1024,$2}
';echo "Largest Files:"; nice -n 19 find /app/*/ -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '
{printf "%d MB\t%s\n", ($7/1024)/1024,$NF}
'; echo "Please use the above information to clear any unwanted data from the server, it is important this is done as soon as possible to ensure your server stays functional.";
The output of the command will contain a list of the largest files and directories with their sizes specified.