Hello,
I sometimes face some machine with big log file that take 90% of partition
space.
If those logs are importants I can't just remove it to free space and have to
archive it (gzip usually).
But the log file + it's archive doesn't fit in the partition so I can't just
`gzip my.log`.
On situation like these I usually do :
$ gzip -c my.log | dd of=my.log conv=notrunc
…
X bytes (…) copied, …
$ truncate -s X my.log
But when my.log is opened by another process it's not recommended ;
as I would ending up with my.log containing a zip and new logs (non zipped) at
the end.
I end-up developing: https://github.com/tchernomax/dump-deallocate
A some utility that output and deallocate (fallocate punch-hole) a file at the
same time.
I think it would be interesting to include this feature in dd so it would be
possible to do:
$ dd if=my.log conv=punchhole | gzip > my.log.gzip
--
Regards
Maxime de Roucy