This article provides steps on how to delete files automatically when the vCenter /Storage/archive partition is full.
This issue does not affect any operations of vCenter Server, as the /storage/archive partition can be full by design.
The customer's monitoring application triggers an alert when any partition is above 80%.
1. Take a snapshot of the vCenter Server Appliance
2. SSH into the vCenter Server Appliance
3. Run the following command to enable access to the Bash shell:
shell.set --enabled true
4. Type shell and press Enter
5. In vCenter shell command line, run below command:
# crontab -e
6. Add a line as below:
0 23 * * * find /storage/archive/vpostgres/ -mtime +300 | xargs rm
7. Press Esc button, type :wq to quit
Note:
1. The above command removes old WAL segments files that are older than 300 days, and the job will be executed daily at 23:00. Either the 300-day or the 23:00 execution time can be modified according to the customer's requirements or environments.
2. For vCenter upgrades, if the process does not succeed, this change may need to be reverted or redeployed.
If you do not want to run cron job and run manual cleanup then perform below steps after vCenter VM snapshot is taken
1. SSH into the vCenter Server Appliance
2. Run this command to enable access to the Bash shell:
shell.set –enabled true
3. Type shell and press Enter
Navigate to directory /storage/archive/vpostgres
#cd /storage/archive/vpostgres
4. According to your policy and disk space return, you can search for files older than 60, 40, or 30 days.
#find * -mtime +40
The system will now display files older than 40 days.
5. To remove files older than 40 days, run the following command:
#find *.* -mtime +40 | xargs rm
6. Use the command below to see whether any files older than 40 days are still present:
#find * -mtime +40
7. Use command “df -h” to display the disk space in a human-readable form:
#df -h