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 true4. Type shell and press Enter
5. In vCenter shell command line, run below command:
# crontab -e6. Add a line as below:
0 23 * * * find /storage/archive/vpostgres/ -mtime +300 | xargs rm7. Press Esc button, type :wq to quit
Note:
1. The command deletes WAL segments older than 300 days and executes daily at 23:00. Both the 300-day retention threshold and the 23:00 schedule are fully customizable based on customer needs.
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 true3. Type shell and press Enter, navigate to directory /storage/archive/vpostgres
# cd /storage/archive/vpostgres4. According to your policy and disk space return, you can search for files older than 60, 40, or 30 days using command below (for 40 days)
# find * -mtime +405. To remove files older than 40 days, run the following command:
# find *.* -mtime +40 | xargs rm6. Use the command below to see whether any files older than 40 days are still present:
# find * -mtime +407. Use command “df -h” to display the disk space in a human-readable form:
# df -h