oflag option in GNU dd - equivalent in FreeBSD dd ?
Bahman M.
b.movaqar at adempiere.org
Tue Oct 23 09:57:10 PDT 2007
On 2007-10-23 Dan Nelson wrote:
> In the last episode (Oct 23), Oliver Fromme said:
> > Bahman M. <b.movaqar at adempiere.org> wrote:
> > > On 2007-10-22 Juri Mianovich wrote:
> > > > I am used to using this command in Linux, using GNU
> > > > dd:
> > > >
> > > > dd if=/blah of=/bleh oflag=append conv=notrunc
> > > >
> > > > The problem is, FreeBSD 'dd' does not understand the
> > > > "oflag" argument.
> > > >
> > > > Is there some equivalent in the FreeBSD 'dd' syntax
> > > > that I can use, or am I forced to install GNU utils ?
> >
> > Of course, the easiest way is to do this:
> >
> > $ dd if=/blah >> /bleh
> >
> > If you cannot do that, please explain why. If you know
> > your reason, there might be an alternative way to do it.
> >
> > > dd if=/blah of=/bleh conv=notrunc seek=`ls -s /bleh | cut -f1 -d
> > > ' ' -`
> > >
> > > I don't know if any simpler way is possible (anyone?).
> >
> > $ dd if=/blah of=/bleh conv=notrunc seek=$(stat -f%z /bleh)
>
> I don't think that will work, since seek's argument is in blocks.
> Even if you divide by 512 (or whatever you decide to set bs=), if the
> file you're appending do isn't a multiple of the blocksize, you'll
> end up chopping part of the end off.
>
Good point! The following should cover that:
sh$ dd if=/blah of=/bleh conv=notrunc bs=1 seek=$(stat -f%z /bleh)
or
tcsh% dd if=/blah of=/bleh conv=notrunc bs=1 seek=`stat -f%z /bleh`
I wonder if bs=1 can cause any slow down when working with large files?
Bahman
More information about the freebsd-questions
mailing list