Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 2693|Reply: 1

Clone OrangePi Zero SD Card

[Copy link]

4

Threads

8

Posts

40

Credits

Novice

Rank: 1

Credits
40
Post time 2017-5-18 05:10:03 | Show all posts |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| Post time 2017-5-20 04:58:17 | Show all posts
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 have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2020-8-14 10:49 GMT+8 , Processed in 0.027314 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list