0

I'm trying to copy the NOOBS Raspbian distribution's 8GB SD card to a new card.

For some reason, the logical partition /dev/sdb6 will not copy correctly.

Accessing fdisk /dev/sdb after the attempted restore gives a couple warnings:

  • "Ignoring extra data in partition table 6"
  • "Partition table entries are not in order."

Here is the output of fdisk /dev/sdb ... p on the source SD card:

Device Boot Start End Sectors Size Id Type /dev/sdb1 8192 3011718 3003527 1.4G e W95 FAT16 (LBA) /dev/sdb2 3014656 15349759 12335104 5.9G 85 Linux extended /dev/sdb3 15349760 15415295 65536 32M 83 Linux /dev/sdb5 3022848 3145727 122880 60M c W95 FAT32 (LBA) /dev/sdb6 3153920 15349759 12195840 5.8G 83 Linux

My current backup steps are as follows...

sudo dd if=/dev/sdb of=mbr.img bs=512 count=1 sudo dd if=/dev/sdb1 bs=4M | sudo pv -tpreb /dev/sdb1 > sdb1.img sudo dd if=/dev/sdb2 bs=4M | sudo pv -tpreb /dev/sdb2 > sdb2.img sudo dd if=/dev/sdb3 bs=4M | sudo pv -tpreb /dev/sdb3 > sdb3.img sudo dd if=/dev/sdb5 bs=4M | sudo pv -tpreb /dev/sdb5 > sdb5.img sudo dd if=/dev/sdb6 bs=4M | sudo pv -tpreb /dev/sdb6 > sdb6.img

And my restore steps:

sudo dd if=mbr.img of=/dev/sdb sudo pv -tpreb sdb1.img | sudo dd bs=4M of=/dev/sdb1 sudo pv -tpreb sdb2.img | sudo dd bs=4M of=/dev/sdb2 sudo pv -tpreb sdb3.img | sudo dd bs=4M of=/dev/sdb3 sudo pv -tpreb sdb5.img | sudo dd bs=4M of=/dev/sdb5 sudo pv -tpreb sdb6.img | sudo dd bs=4M of=/dev/sdb6

Unfortunately, the image for the logical partition does not seem to copy. Does anyone have any ideas? Here is the output of fdisk /dev/sdb ... p in the new/destination SD card:

Device Boot Start End Sectors Size Id Type /dev/sdb1 8192 3011718 3003527 1.4G e W95 FAT16 (LBA) /dev/sdb2 3014656 15349759 12335104 5.9G 85 Linux extended /dev/sdb3 15349760 15415295 65536 32M 83 Linux /dev/sdb5 3022848 3145727 122880 60M c W95 FAT32 (LBA) /dev/sdb6 ? 1221850234 3381616533 2159766300 1T e1 DOS access


sdb1 - recovery OS image, NOOBS boot file and initramfs

sdb2 - any logical partitions

sdb3 - NOOBS settings

sdb5 - Raspbian BOOT files

sdb6 - Raspbian file system

https://github.com/raspberrypi/noobs/wiki/NOOBS-partitioning-explained

migrated from serverfault.com Mar 26 '15 at 0:59

This question came from our site for system and network administrators.

  • Why not just copy the entire block device instead of each partition individually? – Shane Madden Mar 26 '15 at 0:42
0

There are a number of errors in your backup and restore steps.

  1. The command sudo dd if=/dev/sdb1 bs=4M | sudo pv -tpreb /dev/sdb1 > sdb1.img may or may not do the right thing. I don't have pv to test, but according the manual supplying a file will cause it to copy that file to standard output. Piping content in on stdin and supplying a file to pv at the same time isn't specified in the manual.

  2. /dev/sdb2 is an extended partition. It contains the partitions /dev/sdb5 and /dev/sdb6. Your restore steps are copying and restoring the extended partitions twice.

  3. The partition mappings are not updated after sudo dd if=mbr.img of=/dev/sdb, if a different partition map was there before then it has to be re-read in order for the /dev/sdbX block devices to be updated. sfdisk --re-read /dev/sdb will do this.

Additionally it's possible that your new SD card has a slightly different number of blocks if it's branded as 8 GB.

Note that the /dev/sdbX block devices are merely windows into the /dev/sdb block device which represents the whole disk. If you want to copy everything then it would be simpler to copy the block device for the whole SD card instead of each partition individually. E.g sudo pv -tpreb /dev/sdb > sdb.img to backup and then sudo pv -tpreb sdb.img > /dev/sdb to restore.

Your Answer

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