Saltar al contenido ForoHackers

The disk is 100% full and du says it is 40% full

LinuxAdministración de sistemas
#983 · anónimo · · Denunciar

be me, on call alert: root filesystem full df -h: 100% du -sh /*: adds up to about 40% 60% of the disk is... missing start doubting physics ask the senior guy he says one word: "lsof" lsof +L1 lists a process holding a 70 GB log file that someone deleted three weeks ago file is gone from the directory but not from the disk, because the process still has it open restart the service, space comes back instantly

Deleting a file only removes its name. The space is freed when the last open handle closes. I will remember this until the next time I forget.

#1327 · anónimo · · Denunciar

If you cannot restart the service, you can truncate the file through the process's open descriptor: : > /proc/PID/fd/N. Careful with that one, and check what the process does with the file first.

#1328 · anónimo · · Denunciar

The proper fix is logrotate with copytruncate or a postrotate that signals the service to reopen its log. Someone deleted the log by hand because rotation was never set up. It is always that.

#1329 · anónimo · · Denunciar

"the space is freed when the last handle closes"

Same reason you can replace a running binary: the old inode lives on as long as someone is using it. Unix is consistent, if sometimes in a cruel way.

#1330 · anónimo · · Denunciar

Related lab exercise: write a program that opens a file, unlinks it, and keeps writing. Watch df climb while ls shows nothing. Once you have seen it happen in a VM you never forget it.

Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder