Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2007 20:26:07 +0330
From:      "Bahman M." <b.movaqar@adempiere.org>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        juri_mian@yahoo.com, freebsd-questions@freebsd.org
Subject:   Re: oflag option in GNU dd - equivalent in FreeBSD dd ?
Message-ID:  <20071023202607.639f0988@attila>
In-Reply-To: <20071023163135.GA74788@dan.emsphone.com>
References:  <20071023164246.13be9d63@attila> <200710231516.l9NFGSVL038402@lurza.secnetix.de> <20071023163135.GA74788@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2007-10-23 Dan Nelson wrote:
> In the last episode (Oct 23), Oliver Fromme said:
> > Bahman M. <b.movaqar@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071023202607.639f0988>