3

I used this command

sudo dd bs=4M if=/dev/sdb1 | gzip > /home/username/image`date +%d%m%y`.gz

to clone my 32gb sd card (there was linux installed for odroid U3) now I have tried to restore it on same SD card with command

gzip -dc /home/username/image*.gz | sudo dd bs=4M of=/dev/sdb1

but I get error

dd: error writing ‘/dev/sdb1’: No space left on device
0+502552 records in
0+502551 records out
32110542848 bytes (32 GB) copied, 5508,32 s, 5,8 MB/s

I can extract this file it has got 32,1 GB (32 111 591 424 bytes) when extracted.

How can I restore SD card?

3
  • 1
    did you clone the whole card /dev/sdb? /dev/sdb1 is a partition. Sep 9 '15 at 15:12
  • oh noo you are right looks like I need to reinstall it... thank you Sep 9 '15 at 15:16
  • 1
    It looks like there's not enough space at /dev/sdb1 for the partition image. That could be due to you having changed the partition table in the mean time. Or due to bad blocks reducing the available space. You can check that using the badblocks program; your favourite disk partitioning utility may also provide that functionality.
    – PM 2Ring
    Sep 9 '15 at 15:33
1

I was trying to restore it to the same SD card (same physical object)

dd clone was created with command :

sudo dd bs=4M if=/dev/sdb | gzip > /home/username/image`date +%d%m%y`.gz

sdb instead of sdb1 (so I have created copy of whole card not only the sdb1 partition) to restore the sd card I have used :

gzip -dc /home/username/image*.gz | sudo dd bs=4M of=/dev/sdb

again sdb instead of sdb1.

1
  • I was using sdb instead of sdb, and still facing this issue. Dec 1 '16 at 17:35
0

When you say "the same SD card" do you mean the same physical object, or the same brand/capacity?

The real capacity of an SD card is determined at production stage. Each card of the same brand and advertised size has a different number of defect blocks, and will have a slightly different capacity.

In case you have the same physical card, run a partitioning program (gparted or whatever) and make the partition on the SD card matches the size of your backup exactly.

If you have physically different SD cards of 32 GB advertised capacity, you can try to find the largest one and see if you can create a partition large enough to fit your backup. Otherwise, the only sure way to restore your backup is to use a bigger (64 GB) SD card, which will certainly have enough space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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