dd pandian: seemingly exact SD-card copy but copy is not recognized|solved


b_o_b

Advanced Member
Joined
Sep 7, 2010
Messages
1,493
I have been struggling creating bit perfect copies from my Pandian SD card. I am very interested in a solution and I am sure I am not the only one based on some comments from other folks with the same issue.

Method I am using:

Copy the original SD card to hd:

sudo dcfldd bs=4M if=/dev/sdx hash=sha1 hashlog=./image.img.sha1sum | gzip > /x/image.img.gz

unzip the gz file:

gunzip /x/image.img.gz

Copy the hd image to new SD card:

sudo dcfldd bs=4M if=/x/image.img of=/dev/sdx hash=sha1 hashlog=./hash.log

x=location - directory - where image is - something like /home/bob/ in my case

sdx=e.g. sdb - easy to check with a tool like gparted

After the copy:

diff -sq image.img.sha1sum hash.log

result

Files image.img.sha1sum and hash.log are identical
 

I spend a lot of time optimizing my setup in Pandian so I really need a good back-up method and having a full Debian install on an SD card is awesome but also tricky.

The SD card that isn't recognized by the Pandora is a Sandisk MicroSDHC Ultra 16 GB and also tried a 8 GB version. Sandisk is my favorite SD card brand and are usually very reliable and compatible. 

Could this be a firmware / kernel issue ?

---------------------------------------------------------------------------------------------------------------------

SOLVED! (kinda) I was able to make a copy that now works. Not with DD but with clonezilla live

http://clonezilla.org/clonezilla-live.php

---------------------------------------------------------------------------------------------------------------------

I tried to clone the sd card to the 8 Gb card - the source card is also 8 Gb - but it is not accepted

by Clonezilla and reports the destination card is too small.

Resized the source card with gparted, but that didn't solve the issue. Apparently the non-formated

area on the card is still taken into account and there is a size difference between the two cards.

No problem to copy the image to another 16 GB card, so I can consistently produce new clones.

That is great and it is a big relieve knowing there is a back up image if I screw something up with

the original :)

3 of my Pandora's are now running the same Pandian/Debian image. Hiyaaa :) !

Clonezilla is pretty straightforward, but if anyone has a problem or needs some assistance

let me know.

---------------------------------------------------------------------------------------------------------------------
 
Last edited by a moderator:
I think dd is not a good method to ship/backup rootfs, because of the different free space size that must be left at the beginning of <=32 or >= 64G cards.

Also, that create bigger images due to erased blocks still being filled with data.

Better use this:

http://pandorawiki.org/Backup
 
That is an explanation how to copy the rootfs, but it skips the bootloader so you will end up with a tarball that is unusable unless you extract it and make the SD card bootable - probably with u-boot or something similar. Haven't tried that before, at least not manually. It seems to be a bit of a hassle to make it work and bootable but please correct me if I am wrong. It could very well be easy and convenient if you know all the details like you do.

The copy process on the Pandora takes at least 45 minutes, I copied an image on my desktop PC with Clonezilla in less than 10 minutes and after that created a new SD card in +/- 6 minutes. I like to have copies around that I can immediately use if a card fails so there is still a good reason for using Clonezilla/DD imo.  

Choice is good :)
 
There's no "bootloader" on the SD. It's just the autoboot.txt which is a setup for the uboot residing on the NAND.

Well, same speed if you untar from the PC.

I think there's more than one partition for PD. In this case, two archives are needed. Not a big deal.
 
Interesting. Pandian has one small FAT partition - 52 MB - incl. the autoboot.txt + kernel and one EXT-4 partition with the rootfs - PDBOOT and PDROOT.

So in that case I could just copy - paste the files in an SD card with correct partitions. Nice. Maybe I will try it out with the 8Gb card that failed.
 
Last edited by a moderator:
I use this instead of "simple" copy (use as root):

cd /directory/source/
find . -print -depth | cpio -pdmu /directory/target/
 
I use this instead of "simple" copy (use as root):

cd /directory/source/


find . -print -depth | cpio -pdmu /directory/target/

What is the advantage compared to the copy backup method? Tried it out but got a lot of "Cannot stat: Permission denied" and "Cannot open: Permission denied" errors.
 
Last edited by a moderator:
I was able to create a back up on my 8 GB card with the "tar -cpjvf" method as described on the wiki. Created 2 tar balls, a tar ball for PDBOOT and PDROOT. Backup for PDBOOT is not really necessary or only once - the kernel and txt file are pretty small and shouldn't change over time. Formatted the 8GB card with a PDBOOT fat32 partition (+/-130 MB) and a PBROOT ext4 partition.

Extracted the tar balls to the SD card and after that it was accepted by the Pandora without a problem.

I also tried the cpio method again - with sudo but as mentioned yesterday the permission issues are not fixed by that (see below)

So from the PDROOT partition I did

find . -print -depth | cpio -pdmu /directory/target/ 

I also tried

find . -depth -print | cpio -pdmu /directory/target/ no warning this time but the permission errors were still there. In the destination directory there are copy files written. 

find: warning: you have specified the -depth option after a non-option argument -print, but options are not positional (-depth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

cpio: ./etc/security/opasswd: Cannot open: Permission denied
cpio: ./etc/passwd-: Cannot open: Permission denied
cpio: ./etc/sudoers: Cannot open: Permission denied
cpio: ./etc/shadow-: Cannot open: Permission denied
cpio: ./etc/shadow: Cannot open: Permission denied
cpio: ./etc/.pwd.lock: Cannot open: Permission denied
cpio: ./etc/default/cacerts: Cannot open: Permission denied
cpio: ./etc/mpd.conf: Cannot open: Permission denied
cpio: ./etc/apt/trusted.gpg.d/secring.gpg: Cannot open: Permission denied
cpio: ./etc/apt/trusted.gpg.d/trustdb.gpg: Cannot open: Permission denied
cpio: ./etc/apt/trusted.gpg.d/multistrap.gpg: Cannot open: Permission denied
cpio: ./etc/apt/trusted.gpg.d/multistrap.gpg~: Cannot open: Permission denied
cpio: ./etc/gshadow: Cannot open: Permission denied
cpio: ./etc/NetworkManager/system-connections/Ethernet connection 1: Cannot open: Permission denied
cpio: ./etc/NetworkManager/system-connections/Router1: Cannot open: Permission denied
cpio: ./etc/ssh/ssh_host_rsa_key: Cannot open: Permission denied
cpio: ./etc/ssh/ssh_host_dsa_key: Cannot open: Permission denied
cpio: ./etc/ssh/ssh_host_ecdsa_key: Cannot open: Permission denied
cpio: ./etc/ppp/chap-secrets: Cannot open: Permission denied
cpio: ./etc/ppp/pap-secrets: Cannot open: Permission denied
cpio: ./etc/group-: Cannot open: Permission denied
cpio: ./etc/sudoers.d/pdSetup: Cannot open: Permission denied
cpio: ./etc/sudoers.d/README: Cannot open: Permission denied
cpio: ./etc/sudoers.d/shutdown: Cannot open: Permission denied
cpio: ./etc/gshadow-: Cannot open: Permission denied
cpio: ./etc/fuse.conf: Cannot open: Permission denied

etc... etc...
 
Last edited by a moderator:
Can't really tell about the error. I use this on my PC and it works.

Maybe use

sudo su -

then the command.
 
Back
Top