Hands-on task
Free up space by truncating a log
Logs have filled up the disk: /var/log/nginx/access.log has ballooned to 20 MiB, and nginx keeps writing to it — the server hosts a site on port 80. You can't delete the file — nginx holds it open and would keep writing into the "deleted" inode, so the space wouldn't be freed. Truncate the file in place, keeping the file itself: the site must keep working, and nginx must keep writing to the same log.
- truncate
- in-place truncation
- open descriptor
- freeing space
- inode