|
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/
|
|