coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dd: add punchhole feature


From: maxime . deroucy
Subject: [PATCH] dd: add punchhole feature
Date: Fri, 3 Feb 2017 13:58:36 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]