Larry Ploetz wrote:
On 1/7/09 1:44 PM, John Summerfield wrote:
I see no reason logrotate should not handle sparse files well when
copying them.
Yeah, there's no reason why it shouldn't, but it doesn't (see my empiric
test in previous post).
06:42 [sum...@numbat ~]$ cp --help | grep sparse
--sparse=WHEN control creation of sparse files
This is probably the best way of cleaning the NULs people are concerned
about.
I've always interpreted "crude heuristic" to mean that cp reads all the
virtual \x00's, but writes sparsely. Since what I want with sparse log
files, where the sparse-ness is always at the beginning (corresponding
to the previously archived portions of the log file), this didn't seem
as efficient as skipping over the beginning blocks that were only sparse:
Probably. How do you know how many blocks to skip?
$ man cp | grep -iwC1 sparse
--sparse=WHEN
control creation of sparse files
--
By default, sparse SOURCE files are detected by a crude
heuristic and
the corresponding DEST file is made sparse as well. That
is the
behavior selected by --sparse=auto. Specify --sparse=always to
create
a sparse DEST file whenever the SOURCE file contains a long
enough
sequence of zero bytes. Use --sparse=never to inhibit
creation of
sparse files.
And since it's so easy to determine which block first contains real
data, I figured, "why not start copying there?"
It is easy? I'm missing something.
Again, this is only for log files -- only appended to, for when they get
sparse because of logrotate copytruncate or "> filename" or similar
truncation, sparse-ness at the beginning of the file.
--
Cheers
John
-- spambait
[email protected] [email protected]
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375
You cannot reply off-list:-)
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390