Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to use the option oflag=append for a dd operation to append content to a file. This is to increase the size of the underlying file for a loop device in a case where creating a new larger file is too resource intensive.

It's possible dd is not the best option for this anyway but is the best I am aware of. Better suggestions welcome!

My CentOS 4.8 X86_64 server is running coreutils 5.2.1. The version of dd supplied with this version of coreutils doesn't support the oflag option. No newer version appears present in the official repo.

I notice the latest version of coreutils is 8.5 and assume that somewhere between 5.2.1 and 8.5 the oflag option was added.

Assuming I need to upgrade coreutils to a version newer than that currently supplied with CentOS 4.8 x86_64:

  • Is it safe to upgrade coreutils?
  • Which is the minimum version required for dd to support the oflag option?
  • From where can I get an RPM? I'd prefer not to compile from source.
share|improve this question
add comment

2 Answers

I don't know of any alternative methods to do what you want, offhand.

Upgrading seems dangerous; the odds are pretty much in favour of a backwards incompatible change, somewhere in the long list of binaries in coreutils. Pretty much every script on your system uses binaries from coreutils, so a backwards incompatible change in the wrong spot can wreak havoc on your box.

Next option: getting a binary RPM for this. I consider this not very likely, unless you build it yourself.

What you could safely do though, is build the coreutils source (never done that, but it probably is just a configure, make, make install) up to and including the 'make' part. Do not do 'make install'. Then, pick the new dd from the newly generated binaries, drop it in /bin as dd_new and you're good to go. Safe and sound.

That is, provided the new coreutils build on your old glibc :)

share|improve this answer
    
Brilliant - an excellent option for getting the newer dd without disturbing the current coreutils binaries. I agree that playing with coreutils is a risky process! –  Jon Cram Aug 1 '10 at 19:07
    
Playing with coreutils sounds like turning them into coredumputils. But yes, I was going to tell you about the "use the Source, Luke"-option, but wzzrd was faster than me. +1 for that. –  Janne Pikkarainen Aug 1 '10 at 19:19
add comment

I think you can accomplish the dd task you want with "seek" without having to build a new coreutils.

ls -l loopfile

Get the size, divide by 1024, then:

dd if=/dev/zero of=loopfile bs=1M seek=1024 count=2048

(that's writing in 1M blocks, so skips 1G of the output, then adds 2G to the file. Make sure the block size divides evenly into the filesize. It's likely you'll need a 1k block size and a much bigger seek and count number)

I'd do some small-scale experimentation. You might also need "conv=notrunc".

share|improve this answer
    
Thanks - I'll give this a go before long. –  Jon Cram Aug 1 '10 at 19:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.