Deleting a large Linux log does not always release its disk space immediately. If a process still has the file open, the directory entry can disappear while the filesystem continues to retain the file's allocated blocks. The right recovery action is to identify that process and arrange a safe close or reopen, not to keep deleting unrelated files.
This workflow is for an administrator with authorized shell access. It addresses a specific symptom: a deletion completed, but the expected free space did not return. It is separate from running out of inodes while free bytes remain. Neither condition should be diagnosed from a single “disk full” message.
1. Compare the same filesystem and time interval
Record the affected application directory and the deleted file's former location. A log under one mount and an upload directory under another have different capacity accounts. A container may also see a different mount from the host. Run the following read-only checks against the existing parent directory, replacing the example path.
WC_PATH=/var/log/example-app
findmnt --target "$WC_PATH" --output TARGET,SOURCE,FSTYPE,OPTIONS
df -h -- "$WC_PATH"
sudo du -x -h --max-depth=1 -- "$WC_PATH"Keep any permission errors. An incomplete directory scan is not evidence that the filesystem's accounting is wrong. The directory total also cannot explain data elsewhere on the same mount. Record when the commands ran: an active application can write significant new data between two measurements.
If the mount or path is not the one that held the deleted file, correct that mismatch before proceeding. Do not unmount a live filesystem merely to inspect a directory hidden beneath it; plan that investigation separately with the service owner.
2. Look for files with no remaining directory links
sudo lsof -nP +L1The lsof manual describes the link-count selection. Review the command name, PID, descriptor, device and file name together. A deleted entry is a candidate, not automatic proof that it explains the entire shortfall. Match its device to the affected filesystem and assess its size in context.
Do not sum every row indiscriminately. Several descriptors or processes can refer to the same underlying file, and a displayed logical size is not necessarily the number of physical blocks allocated. Some entries may be mapped libraries or temporary files unrelated to the incident. Preserve the useful rows in a protected incident note rather than publishing paths or command arguments externally.
Finding | Next decision |
|---|---|
A large deleted log held by the expected service | Check that application's documented log-reopen mechanism and rotation configuration. |
A database or application data file is held open | Stop treating it as disposable. Escalate to the application owner and preserve recovery options. |
No relevant deleted file appears | Investigate other directories, mount boundaries, snapshots and filesystem accounting. |
Space returns but immediately disappears again | Measure the active writer and growth rate; closing the old file did not fix the producer. |
3. Identify the owner before acting
For a candidate PID, inspect its executable and service relationship. Substitute the PID you actually observed; do not copy an example number into a termination command.
WC_PID=1234
ps -p "$WC_PID" -o pid,ppid,user,comm
sudo readlink "/proc/$WC_PID/exe"
sudo cat "/proc/$WC_PID/cgroup"These checks help connect the file to a managed service, container or standalone process. A process can exit and its PID can later be reused, so recheck the identity immediately before a maintenance action. If a service manager owns it, use that manager's approved procedure rather than targeting a random process directly.
For an illustrative incident, suppose a busy application continues writing to yesterday's deleted log. The corrective question is whether the application can reopen its log without interruption. If it can, follow that documented mechanism. If it cannot, arrange a controlled restart with traffic handling and a rollback plan. The example describes a decision process, not a measured WebCare360 incident.
4. Recover through a documented close or reopen
There is no universal safe signal for reopening logs. Different applications interpret signals differently, and some do not support reopening at all. Confirm the installed application's behavior before using a signal, reload or restart. Check whether an active job, transaction or connection will be interrupted.
Avoid truncating arbitrary files through /proc, killing all processes matching a name, or deleting more data to make the numbers look better. Those actions can destroy evidence or authoritative data while leaving the original retention fault unresolved. If the file may contain audit evidence, establish its preservation requirements first.
After the approved action, repeat the filesystem measurement and the relevant lsof check. Confirm a normal request succeeds and new log entries reach the intended current file. Recovery requires all three observations: released capacity, healthy application behavior and correct ongoing logging.
5. Prevent recurrence and close the incident
Review why the old file was deleted while still open. Common operational causes include manual removal outside the application's controls or a rotation rule missing a reopen step. Record the owner of log rotation, the retention period, the application's supported reopening method and a practical free-space alert.
Keep before-and-after free-space readings, the identified process, the approved action and the request used to verify service health. If capacity still falls, sample growth over a representative period rather than scheduling repeated emergency restarts.
If the measured workload genuinely needs a different capacity or administration arrangement, compare the VPS options against that requirement. Extra storage is a capacity decision; it does not correct an application that indefinitely retains deleted files.
References
Prepared from documentation reviewed on 29 November 2026. Examples are illustrative; confirm the installed tools and application-specific maintenance procedure.

