Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #10320 > unrolled thread

Failure to clone SD card with compression

Started byRussell Gadd <russ.mail.lists@gmail.com>
First post2016-01-07 20:09 +0000
Last post2016-01-17 15:44 +0000
Articles 20 on this page of 54 — 16 participants

Back to article view | Back to comp.sys.raspberry-pi


Contents

  Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-07 20:09 +0000
    Re: Failure to clone SD card with compression Roger Bell_West <roger+csrp201601@nospam.firedrake.org> - 2016-01-08 00:05 +0000
      Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-08 00:49 +0000
        Re: Failure to clone SD card with compression Adam Funk <a24061@ducksburg.com> - 2016-01-08 11:17 +0000
          Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-08 12:58 +0000
            Re: Failure to clone SD card with compression Adam Funk <a24061@ducksburg.com> - 2016-01-11 14:14 +0000
          Re: Failure to clone SD card with compression ray carter <ray@zianet.com> - 2016-01-08 17:19 +0000
            Re: Failure to clone SD card with compression Rob Morley <nospam@ntlworld.com> - 2016-01-08 17:30 +0000
    Re: Failure to clone SD card with compression ray carter <ray@zianet.com> - 2016-01-08 01:31 +0000
    Re: Failure to clone SD card with compression "A. Dumas" <alexandre@dumas.fr.invalid> - 2016-01-08 03:00 +0100
    Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-09 10:17 +0000
      Re: Failure to clone SD card with compression Dom <domafp@blueyonder.co.uk> - 2016-01-09 11:31 +0000
        Re: Failure to clone SD card with compression "A. Dumas" <alexandre@dumas.fr.invalid> - 2016-01-09 14:02 +0100
      Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-09 12:07 +0000
        Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-09 20:10 +0000
          Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-09 20:34 +0000
            Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-10 18:52 +0000
              Re: Failure to clone SD card with compression Dom <domafp@blueyonder.co.uk> - 2016-01-10 21:25 +0000
    Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-09 20:09 +0000
      Re: Failure to clone SD card with compression Dom <domafp@blueyonder.co.uk> - 2016-01-09 20:27 +0000
        Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-10 01:40 -0800
          Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-10 15:37 +0000
          Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-10 15:41 +0000
            Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-10 09:18 -0800
      Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-10 18:51 +0000
    Re: Failure to clone SD card with compression Anssi Saari <as@sci.fi> - 2016-01-12 11:46 +0200
      Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-13 12:18 +0000
        Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-13 13:31 +0000
        Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-13 11:19 -0800
          Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-13 19:33 +0000
          Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-13 20:55 +0000
            Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-13 21:48 -0800
              Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-13 21:58 -0800
                Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-14 06:44 +0000
                Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-14 09:24 +0000
                  Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-14 09:40 +0000
                  Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-14 10:35 +0000
      Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-14 21:58 +0000
        Re: Failure to clone SD card with compression Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-15 00:29 +0000
          Re: Failure to clone SD card with compression fruit <fruit@invalid.org.uk> - 2016-01-15 06:25 +0000
          Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-15 07:46 +0000
          Re: Failure to clone SD card with compression Rob Morley <nospam@ntlworld.com> - 2016-01-15 08:34 +0000
        Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-15 09:47 +0000
          Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-15 16:53 +0000
        Re: Failure to clone SD card with compression CPMDude <nospam@somewhere.net> - 2016-01-16 01:03 -0800
          Re: Failure to clone SD card with compression Rob <nomail@example.com> - 2016-01-16 10:00 +0000
            Re: Failure to clone SD card with compression Russell Gadd <russ.mail.lists@gmail.com> - 2016-01-16 20:10 +0000
            Re: Failure to clone SD card with compression druck <news@druck.org.uk> - 2016-01-17 11:52 +0000
              Re: Failure to clone SD card with compression Ahem A Rivet's Shot <steveo@eircom.net> - 2016-01-17 12:16 +0000
                Re: Failure to clone SD card with compression Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-17 13:49 +0000
                  Re: Failure to clone SD card with compression The Natural Philosopher <tnp@invalid.invalid> - 2016-01-17 14:22 +0000
                    Re: Failure to clone SD card with compression Alan Adams <alan@adamshome.org.uk> - 2016-01-17 15:00 +0000
                      Re: Failure to clone SD card with compression Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-17 16:00 +0000
                  Re: Failure to clone SD card with compression Ahem A Rivet's Shot <steveo@eircom.net> - 2016-01-17 15:44 +0000

Page 1 of 3  [1] 2 3  Next page →


#10320 — Failure to clone SD card with compression

FromRussell Gadd <russ.mail.lists@gmail.com>
Date2016-01-07 20:09 +0000
SubjectFailure to clone SD card with compression
Message-ID<n6mgh4$3r6$2@dont-email.me>
I am having difficulty using gzip for compressing images of SD cards. If 
I use command lines such as
   # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
   # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
for making the image and restoring it to another card, it works ok.

However if I use compression like this:
   # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror | gzip -c 
 >/backfile.img.gz
   # gunzip -c /backfile.img.gz | dd bs=1M count=3752 of=/dev/sdc 
conv=sync,noerror
it fails to restore the image correctly. The MBR and the partitions 
cloned are not the same as the original.

What error(s) am I making?

[toc] | [next] | [standalone]


#10321

FromRoger Bell_West <roger+csrp201601@nospam.firedrake.org>
Date2016-01-08 00:05 +0000
Message-ID<20160108000430.357277464428083@firedrake.org>
In reply to#10320
On 2016-01-07, Russell Gadd wrote:
>I am having difficulty using gzip for compressing images of SD cards. If 
>I use command lines such as
>   # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>   # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
>for making the image and restoring it to another card, it works ok.
>
>However if I use compression like this:
>   # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror | gzip -c 
>>/backfile.img.gz
>   # gunzip -c /backfile.img.gz | dd bs=1M count=3752 of=/dev/sdc 
>conv=sync,noerror
>it fails to restore the image correctly. The MBR and the partitions 
>cloned are not the same as the original.
>
>What error(s) am I making?

Why not use gzip on its own rather than as part of a pipeline? I.e. do
the dd to a file as you have been, then separately gzip that file. (Or
better bzip2 or xz it, these days.) To use it, gunzip it then dd the
uncompressed image.

[toc] | [prev] | [next] | [standalone]


#10322

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2016-01-08 00:49 +0000
Message-ID<n6n13h$j34$1@news.albasani.net>
In reply to#10321
On 08/01/16 00:05, Roger Bell_West wrote:
> On 2016-01-07, Russell Gadd wrote:
>> I am having difficulty using gzip for compressing images of SD cards. If
>> I use command lines such as
>>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>>    # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
>> for making the image and restoring it to another card, it works ok.
>>
>> However if I use compression like this:
>>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror | gzip -c
>>> /backfile.img.gz
>>    # gunzip -c /backfile.img.gz | dd bs=1M count=3752 of=/dev/sdc
>> conv=sync,noerror
>> it fails to restore the image correctly. The MBR and the partitions
>> cloned are not the same as the original.
>>
>> What error(s) am I making?
>
> Why not use gzip on its own rather than as part of a pipeline? I.e. do
> the dd to a file as you have been, then separately gzip that file. (Or
> better bzip2 or xz it, these days.) To use it, gunzip it then dd the
> uncompressed image.
>


It still should work though, but that's a good first test.

Why are you using count and conv with dd?


-- 
Karl Marx said religion is the opium of the people.
But Marxism is the crack cocaine.

[toc] | [prev] | [next] | [standalone]


#10326

FromAdam Funk <a24061@ducksburg.com>
Date2016-01-08 11:17 +0000
Message-ID<8fi4mcxru7.ln2@news.ducksburg.com>
In reply to#10322
On 2016-01-08, The Natural Philosopher wrote:

> On 08/01/16 00:05, Roger Bell_West wrote:
>> On 2016-01-07, Russell Gadd wrote:
>>> I am having difficulty using gzip for compressing images of SD cards. If
>>> I use command lines such as
>>>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>>>    # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
>>> for making the image and restoring it to another card, it works ok.
...
> It still should work though, but that's a good first test.
>
> Why are you using count and conv with dd?

I'm not entirely sure why it's necessary, but I've seen a lot of
instructions for this sort of thing that have "conv=sync,noerror" in
them.


-- 
Apparently I lack some particular perversion which today's
employer is seeking.                 --- Ignatius J Reilly

[toc] | [prev] | [next] | [standalone]


#10327

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2016-01-08 12:58 +0000
Message-ID<n6obqh$v9q$5@news.albasani.net>
In reply to#10326
On 08/01/16 11:17, Adam Funk wrote:
> On 2016-01-08, The Natural Philosopher wrote:
>
>> On 08/01/16 00:05, Roger Bell_West wrote:
>>> On 2016-01-07, Russell Gadd wrote:
>>>> I am having difficulty using gzip for compressing images of SD cards. If
>>>> I use command lines such as
>>>>     # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>>>>     # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
>>>> for making the image and restoring it to another card, it works ok.
> ...
>> It still should work though, but that's a good first test.
>>
>> Why are you using count and conv with dd?
>
> I'm not entirely sure why it's necessary, but I've seen a lot of
> instructions for this sort of thing that have "conv=sync,noerror" in
> them.
>
>
See A Dumas reply which echoes my own misgivings.

Also, Chinese whispers.. The number of times I research a topic and find 
the same instruction on ten different websites that is actually 
obsoleted by the version of code I am running...in reality probably 
someone once, got it to work using that, and everyone else has just 
copied it blindly. You have stumbled on a case where it doesn't seem to 
work, and you will write the next definitive guide, to be plagiarised a 
hundred times..



-- 
The biggest threat to humanity comes from socialism, which has utterly 
diverted our attention away from what really matters to our existential 
survival, to indulging in navel gazing and faux moral investigations 
into what the world ought to be, whilst we fail utterly to deal with 
what it actually is.

[toc] | [prev] | [next] | [standalone]


#10354

FromAdam Funk <a24061@ducksburg.com>
Date2016-01-11 14:14 +0000
Message-ID<00qcmcxqt6.ln2@news.ducksburg.com>
In reply to#10327
On 2016-01-08, The Natural Philosopher wrote:

> On 08/01/16 11:17, Adam Funk wrote:
>> On 2016-01-08, The Natural Philosopher wrote:
>>
>>> On 08/01/16 00:05, Roger Bell_West wrote:
>>>> On 2016-01-07, Russell Gadd wrote:
>>>>> I am having difficulty using gzip for compressing images of SD cards. If
>>>>> I use command lines such as
>>>>>     # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>>>>>     # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
>>>>> for making the image and restoring it to another card, it works ok.
>> ...
>>> It still should work though, but that's a good first test.
>>>
>>> Why are you using count and conv with dd?
>>
>> I'm not entirely sure why it's necessary, but I've seen a lot of
>> instructions for this sort of thing that have "conv=sync,noerror" in
>> them.
>>
>>
> See A Dumas reply which echoes my own misgivings.
>
> Also, Chinese whispers.. The number of times I research a topic and find 
> the same instruction on ten different websites that is actually 
> obsoleted by the version of code I am running...in reality probably 
> someone once, got it to work using that, and everyone else has just 
> copied it blindly. You have stumbled on a case where it doesn't seem to 
> work, and you will write the next definitive guide, to be plagiarised a 
> hundred times..

Yes, I'm not saying "conv=sync,noerror" is right....


-- 
Everybody says sex is obscene. The only true obscenity 
is war.                               --- Henry Miller

[toc] | [prev] | [next] | [standalone]


#10329

Fromray carter <ray@zianet.com>
Date2016-01-08 17:19 +0000
Message-ID<dfa9coFr278U4@mid.individual.net>
In reply to#10326
On Fri, 08 Jan 2016 11:17:28 +0000, Adam Funk wrote:

> On 2016-01-08, The Natural Philosopher wrote:
> 
>> On 08/01/16 00:05, Roger Bell_West wrote:
>>> On 2016-01-07, Russell Gadd wrote:
>>>> I am having difficulty using gzip for compressing images of SD cards.
>>>> If I use command lines such as
>>>>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror
>>>>    of=/backfile.img # dd bs=1M count=3752 if=/backfile.img
>>>>    of=/dev/sdc conv=sync,noerror
>>>> for making the image and restoring it to another card, it works ok.
> ...
>> It still should work though, but that's a good first test.
>>
>> Why are you using count and conv with dd?
> 
> I'm not entirely sure why it's necessary, but I've seen a lot of
> instructions for this sort of thing that have "conv=sync,noerror" in
> them.

The main advantage of using sync,noerror is to replace bad blocks and 
keep going.

[toc] | [prev] | [next] | [standalone]


#10330

FromRob Morley <nospam@ntlworld.com>
Date2016-01-08 17:30 +0000
Message-ID<20160108173006.640818ec@ntlworld.com>
In reply to#10329
On 8 Jan 2016 17:19:20 GMT
ray carter <ray@zianet.com> wrote:

> The main advantage of using sync,noerror is to replace bad blocks and 
> keep going.

Is that likely to cause problems with slower storage media, when a slow
read may be interpreted as a failure but a different application might
be less fussy and wait for it to complete?  I'm guessing it would be
the same bits of file-system/kernel code running in both cases so no
different, but maybe not.

[toc] | [prev] | [next] | [standalone]


#10323

Fromray carter <ray@zianet.com>
Date2016-01-08 01:31 +0000
Message-ID<df8hrdFr278U3@mid.individual.net>
In reply to#10320
On Thu, 07 Jan 2016 20:09:40 +0000, Russell Gadd wrote:

> I am having difficulty using gzip for compressing images of SD cards. If
> I use command lines such as
>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror of=/backfile.img
>    # dd bs=1M count=3752 if=/backfile.img of=/dev/sdc conv=sync,noerror
> for making the image and restoring it to another card, it works ok.
> 
> However if I use compression like this:
>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror | gzip -c
>  >/backfile.img.gz
>    # gunzip -c /backfile.img.gz | dd bs=1M count=3752 of=/dev/sdc
> conv=sync,noerror it fails to restore the image correctly. The MBR and
> the partitions cloned are not the same as the original.
> 
> What error(s) am I making?

I'd suggest 'partimage' instead.

[toc] | [prev] | [next] | [standalone]


#10324

From"A. Dumas" <alexandre@dumas.fr.invalid>
Date2016-01-08 03:00 +0100
Message-ID<568f1838$0$23830$e4fe514c@news.xs4all.nl>
In reply to#10320
On 07/01/2016 21:09, Russell Gadd wrote:
>    # dd bs=1M count=3752 if=/dev/sdc conv=sync,noerror | gzip -c
>  >/backfile.img.gz
>    # gunzip -c /backfile.img.gz | dd bs=1M count=3752 of=/dev/sdc
> conv=sync,noerror
> it fails to restore the image correctly. The MBR and the partitions
> cloned are not the same as the original.

/dev/sdc and / are on different filesystems, yes? Just checking. Use 
gzip with piped input without -c. Maybe try without noerror to see if an 
error occurs. I'm not exactly sure which buffers get padded with the 
sync option, but that sounds like maybe the output is not identical to 
the input, which would definitely be wrong.

[toc] | [prev] | [next] | [standalone]


#10331

FromRussell Gadd <russ.mail.lists@gmail.com>
Date2016-01-09 10:17 +0000
Message-ID<n6qmj6$d1q$1@dont-email.me>
In reply to#10320
I should have tried to run without suppressing errors. I think The 
Natural Philosopher is right about Chinese whispers, I used these 
options without looking into dd options carefully. Actually it's odd I 
used conv=noerror as I usually like to check for errors.

The conv=sync was also a bad idea as it fills out short inputs with 
zeroes. When I ran the restore without conv=noerror it gave me this warning:
dd: warning: partial read (32768 bytes); suggest iflag=fullblock

So I think what it was doing was filling the rest of the block with 
zeroes on each partial read then writing the output. I also think the 
operation completed more quickly without this argument which would have 
been because it would have been reading only 32k then writing a whole 
1M. However this is just an impression, I didn't time it.

The number of whispers saying the same thing misled me into assuming it 
was gold information. Damn Chinese! (joke - nothing against the 
Chinese). I was obviously a bit lazy.

So I tried the following lines which worked:
# dd bs=1M count=3752 if=/dev/sdc | gzip -c >/backfile.img.gz
# gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock 
of=/dev/sdc

Actually it now strikes me that I should also use iflag=fullblock on the 
intial SD card read. Thinking about it, whenever you use a count it 
would seem that iflag=fullblock should always be used, otherwise the 
count is a count of read operations.

The reason for the block count is that the SD card I used was 16GB but 
the partitions were much smaller - about 3.8GB - so there was no point 
writing beyond this. Also if you read the whole SD card you'd get a much 
larger file unless you first filled the empty space with zeroes. I used 
a spreadsheet to check the figures reported by fdisk. There were 2 
partitions but the first started 4MB into the card.

So problem solved, thanks for all the replies.

Final solution:
# dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip -c 
 >/backfile.img.gz
# gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock 
of=/dev/sdc

[toc] | [prev] | [next] | [standalone]


#10332

FromDom <domafp@blueyonder.co.uk>
Date2016-01-09 11:31 +0000
Message-ID<wc6ky.846024$EE2.192319@fx33.am4>
In reply to#10331
On 09/01/16 10:17, Russell Gadd wrote:
> I should have tried to run without suppressing errors. I think The
> Natural Philosopher is right about Chinese whispers, I used these
> options without looking into dd options carefully. Actually it's odd I
> used conv=noerror as I usually like to check for errors.
>
> The conv=sync was also a bad idea as it fills out short inputs with
> zeroes. When I ran the restore without conv=noerror it gave me this
> warning:
> dd: warning: partial read (32768 bytes); suggest iflag=fullblock
>
> So I think what it was doing was filling the rest of the block with
> zeroes on each partial read then writing the output. I also think the
> operation completed more quickly without this argument which would have
> been because it would have been reading only 32k then writing a whole
> 1M. However this is just an impression, I didn't time it.
>
> The number of whispers saying the same thing misled me into assuming it
> was gold information. Damn Chinese! (joke - nothing against the
> Chinese). I was obviously a bit lazy.
>
> So I tried the following lines which worked:
> # dd bs=1M count=3752 if=/dev/sdc | gzip -c >/backfile.img.gz
> # gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock
> of=/dev/sdc
>
> Actually it now strikes me that I should also use iflag=fullblock on the
> intial SD card read. Thinking about it, whenever you use a count it
> would seem that iflag=fullblock should always be used, otherwise the
> count is a count of read operations.
>
> The reason for the block count is that the SD card I used was 16GB but
> the partitions were much smaller - about 3.8GB - so there was no point
> writing beyond this. Also if you read the whole SD card you'd get a much
> larger file unless you first filled the empty space with zeroes. I used
> a spreadsheet to check the figures reported by fdisk. There were 2
> partitions but the first started 4MB into the card.
>
> So problem solved, thanks for all the replies.
>
> Final solution:
> # dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip -c
>  >/backfile.img.gz
> # gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock
> of=/dev/sdc
>
Also, you don't need the count on the last dd that is doing the writing. 
It will just write the contents of the file, which is the correct length.

[toc] | [prev] | [next] | [standalone]


#10334

From"A. Dumas" <alexandre@dumas.fr.invalid>
Date2016-01-09 14:02 +0100
Message-ID<569104d4$0$23815$e4fe514c@news.xs4all.nl>
In reply to#10332
On 09/01/2016 12:31, Dom wrote:
> On 09/01/16 10:17, Russell Gadd wrote:
>> # dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip -c
>>  >/backfile.img.gz
>> # gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock
>> of=/dev/sdc
>>
> Also, you don't need the count on the last dd that is doing the writing.
> It will just write the contents of the file, which is the correct length.

Also, you don't need -c on gzip because if there's no input file, output 
will go to stdout automatically. So you do need it on gunzip, yeah.

[toc] | [prev] | [next] | [standalone]


#10333

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2016-01-09 12:07 +0000
Message-ID<n6qt6v$o43$2@news.albasani.net>
In reply to#10331
On 09/01/16 10:17, Russell Gadd wrote:
> I should have tried to run without suppressing errors. I think The
> Natural Philosopher is right about Chinese whispers, I used these
> options without looking into dd options carefully. Actually it's odd I
> used conv=noerror as I usually like to check for errors.
>
> The conv=sync was also a bad idea as it fills out short inputs with
> zeroes. When I ran the restore without conv=noerror it gave me this
> warning:
> dd: warning: partial read (32768 bytes); suggest iflag=fullblock
>
> So I think what it was doing was filling the rest of the block with
> zeroes on each partial read then writing the output. I also think the
> operation completed more quickly without this argument which would have
> been because it would have been reading only 32k then writing a whole
> 1M. However this is just an impression, I didn't time it.
>
> The number of whispers saying the same thing misled me into assuming it
> was gold information. Damn Chinese! (joke - nothing against the
> Chinese). I was obviously a bit lazy.
>
> So I tried the following lines which worked:
> # dd bs=1M count=3752 if=/dev/sdc | gzip -c >/backfile.img.gz
> # gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock
> of=/dev/sdc
>
> Actually it now strikes me that I should also use iflag=fullblock on the
> intial SD card read. Thinking about it, whenever you use a count it
> would seem that iflag=fullblock should always be used, otherwise the
> count is a count of read operations.
>
> The reason for the block count is that the SD card I used was 16GB but
> the partitions were much smaller - about 3.8GB - so there was no point
> writing beyond this. Also if you read the whole SD card you'd get a much
> larger file unless you first filled the empty space with zeroes. I used
> a spreadsheet to check the figures reported by fdisk. There were 2
> partitions but the first started 4MB into the card.
>
> So problem solved, thanks for all the replies.
>
> Final solution:
> # dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip -c
>  >/backfile.img.gz
> # gunzip -c /backfile.img.gz | dd bs=1M count=3752 iflag=fullblock
> of=/dev/sdc
>
If at all possible post this up on a website where the next poor sucker 
will find the better 'magic spell'


-- 
The biggest threat to humanity comes from socialism, which has utterly 
diverted our attention away from what really matters to our existential 
survival, to indulging in navel gazing and faux moral investigations 
into what the world ought to be, whilst we fail utterly to deal with 
what it actually is.

[toc] | [prev] | [next] | [standalone]


#10337

FromRussell Gadd <russ.mail.lists@gmail.com>
Date2016-01-09 20:10 +0000
Message-ID<n6rpas$2t0$2@dont-email.me>
In reply to#10333
On 09/01/16 12:07, The Natural Philosopher wrote:
> ...
> If at all possible post this up on a website where the next poor sucker
> will find the better 'magic spell'
>
>
I would, but don't have my own. Please suggest best place - a forum?

[toc] | [prev] | [next] | [standalone]


#10339

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2016-01-09 20:34 +0000
Message-ID<n6rqth$hqp$2@news.albasani.net>
In reply to#10337
On 09/01/16 20:10, Russell Gadd wrote:
> On 09/01/16 12:07, The Natural Philosopher wrote:
>> ...
>> If at all possible post this up on a website where the next poor sucker
>> will find the better 'magic spell'
>>
>>
> I would, but don't have my own. Please suggest best place - a forum?

https://www.raspberrypi.org/forums/viewforum.php?f=28&sid=66184035e51d831949952bcc3933ba3e

-- 
How fortunate for governments that the people they administer don't think.

Adolf Hitler

[toc] | [prev] | [next] | [standalone]


#10349

FromRussell Gadd <russ.mail.lists@gmail.com>
Date2016-01-10 18:52 +0000
Message-ID<n6u93u$fng$2@dont-email.me>
In reply to#10339
On 09/01/16 20:34, The Natural Philosopher wrote:
> On 09/01/16 20:10, Russell Gadd wrote:
>> On 09/01/16 12:07, The Natural Philosopher wrote:
>>> ...
>>> If at all possible post this up on a website where the next poor sucker
>>> will find the better 'magic spell'
>>>
>>>
>> I would, but don't have my own. Please suggest best place - a forum?
>
> https://www.raspberrypi.org/forums/viewforum.php?f=28&sid=66184035e51d831949952bcc3933ba3e
>
>
Done - may take a few hours for it to be moderated.

[toc] | [prev] | [next] | [standalone]


#10350

FromDom <domafp@blueyonder.co.uk>
Date2016-01-10 21:25 +0000
Message-ID<E%zky.737931$dK6.60699@fx42.am4>
In reply to#10349
On 10/01/16 18:52, Russell Gadd wrote:
> On 09/01/16 20:34, The Natural Philosopher wrote:
>> On 09/01/16 20:10, Russell Gadd wrote:
>>> On 09/01/16 12:07, The Natural Philosopher wrote:
>>>> ...
>>>> If at all possible post this up on a website where the next poor sucker
>>>> will find the better 'magic spell'
>>>>
>>>>
>>> I would, but don't have my own. Please suggest best place - a forum?
>>
>> https://www.raspberrypi.org/forums/viewforum.php?f=28&sid=66184035e51d831949952bcc3933ba3e
>>
>>
>>
> Done - may take a few hours for it to be moderated.
They're usually pretty quick of the mark. I see it has gone up already.

[toc] | [prev] | [next] | [standalone]


#10336

FromRussell Gadd <russ.mail.lists@gmail.com>
Date2016-01-09 20:09 +0000
Message-ID<n6rp8l$2t0$1@dont-email.me>
In reply to#10320
Ok my writeup of the command lines is:

To create a compressed image file:
(make sure the count is correct or omit it for safety
count can be found from fdisk
use End block address of last partition +1,
x 1024 for bytes, divide by your bs (here=1M))

# dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip >/backfile.img.gz

To restore the SD card:
# gunzip -c /backfile.img.gz | dd bs=1M iflag=fullblock of=/dev/sdc

[toc] | [prev] | [next] | [standalone]


#10338

FromDom <domafp@blueyonder.co.uk>
Date2016-01-09 20:27 +0000
Message-ID<A2eky.575389$J75.27218@fx36.am4>
In reply to#10336
On 09/01/16 20:09, Russell Gadd wrote:
> Ok my writeup of the command lines is:
>
> To create a compressed image file:
> (make sure the count is correct or omit it for safety
> count can be found from fdisk
> use End block address of last partition +1,
> x 1024 for bytes, divide by your bs (here=1M))
>
> # dd bs=1M count=3752 iflag=fullblock if=/dev/sdc | gzip >/backfile.img.gz
>
> To restore the SD card:
> # gunzip -c /backfile.img.gz | dd bs=1M iflag=fullblock of=/dev/sdc
>
You can even use
# zcat /backfile.img.gz | dd bs=1M of=/dev/sdc

"zcat filename" is the equivalent of "gunzip -c filename", but slightly 
easier to type.

I don't know exactly what the iflag=fullblock does. Does it improve 
performance?

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.sys.raspberry-pi


csiph-web