View: 8119|Reply: 1

Clone OrangePi Zero SD Card

[Copy link]

4

threads

8

posts

40

credits

Novice

Rank: 1

credits
40
Published in 2017-5-18 05:10:03 | Show all floors |Read mode
I would like to clone the SD Card on the Zero without using Win32DiskImager.   The reason is the saved image will often not fit on the new card due to the bad blocks in most SD Cards.  
There is a script to do tnis on the Raspberry PI, but the script does not work on the OrangePI Zero.    The sequence below works some times, but other times the cloned card will not boot.   When it fails, I get a message about :"Card did not respond to voltage select!"

Can anyone tell me what I am doing wrong?
Thanks.


df -h
umount /media/usb0
fdisk /dev/sda
d   (delete parition)
n
p
1
2048
+20M
n
p
2
<default>

<default>
w

# Check if OS re-mounted any sda partitions

df -h
umount /meda/usb0

# make the FAT file system for the boot partition
mkfs.vfat /dev/sda1

# make the EXT4 file system, if it fails, open fdisk /dev/sda again to refresh the parition table
mkfs.ext4  /dev/sda2

# write zeroes to the first portion of the root parition
dd if=/dev/zero of=/dev/sda bs=1k count=1023 seek=1
# Completely copy an image of the boot partition of the existing card over to the new card
dd if=/dev/mmcblk0 of=/dev/sda bs=1M count=65
# remake the EXT4 file system for the second partition
mkfs.ext4 -F /dev/sda2
# make a temporary folder to use as a mount point
mkdir /tmp/newpi
# Mount the second partition
mount /dev/sda2 /tmp/newpi
# copy all the files from the existing boot image to the second partition
rsync -av --one-file-system / /boot /tmp/newpi/


4

threads

8

posts

40

credits

Novice

Rank: 1

credits
40
 Author| Published in 2017-5-20 04:58:17 | Show all floors
I changed the line for copying the boot image to

dd if=/dev/mmcblk0 of=/dev/sda bs=1024 count=65536

On a sample size of four SD Cards,  all four of them booted after the transfer using the above change.  

You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list