coreutils
[Top][All Lists]
Advanced

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

Re: unexpected error w/ dd


From: Billy Crook
Subject: Re: unexpected error w/ dd
Date: Tue, 22 Nov 2016 18:29:47 -0600

On Tue, Nov 22, 2016 at 11:03 AM, Pádraig Brady <address@hidden> wrote:

> On 22/11/16 16:45, Billy Crook wrote:
> > Pardon my html email, but the inline attached images are relevant.
> >
> > I am trying to use dd to zero the (first and) last 512MB of a range of
> > partitions on a range of disks.  The blocksizes vary, and I put together
> a
> > one-liner which I thought should do the trick, but it doesn't.
> >
> > i specify a bs to match the partition's block size as reported by
> blockdev
> > --getbsz.  I specify a seek= that is less than the number of blocks that
> > blockdev --getsz reports.  I should think this would begin writing before
> > the end of the partition and continue until the end.  But instead, I
> > receive "cannot seek: invalid argument" (0b copied)
> >
> > What am I doing wrong?
>
> It's best to just copy & paste text, rather than sending large screenshots.
>

I would agree on avoiding images.  I find it disgusting to waste multiple
megabytes of data to convey only a hand-full of lines of text.

This system is not networked however, except for kvmoip via ipmi, so there
was no "text" to copy.  Just a vga buffer image, which I cropped where
possible.  I have taken the effort this time to further crop, reduce the
color space, and highly compress.


> It's probably best to use `blockdev --getsize64` to get the size in bytes
> and divide that by whatever you're specifying to the `dd bs=` parameter.
> That will avoid any mismatch between block sizes.
> Also I notice negative values passed in some of the commands,
> which may be related to this mismatch.
>

Thank you for that tip!

I rewrote my one-liner to ignore block sizes.  I used getsize64 to get the
partition's size in bytes and use bs=512 to instruct dd to work in 512 byte
blocks which should work albeit less performant than matching the block
device' native block size.  Here is the revision, which worked as expected:



I hope that helps the next person in my footsteps.

-- 
Billy Crook • Network and Security Administrator • RiskAnalytics, LLC

PNG image


reply via email to

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