Jump to content

Is this route correct to backup/restore an armbian sdcard


kimidare

Recommended Posts

I've read this 

and it surprised me noone mentioned e2image.

 

I'm using armbian orange pi pc build.

The fs is stock ext4 hence why I stick to e2image below.

It is not about cloning a live system, hence the sdcard is plugged into my PC.

 

Fdisk shows a single partition at 4M offset.

 

First I backup the partition table and bootloader

dd if=/dev/sdX of=offset0.img bs=4M count=1

 

Next I backup the single partition with e2image into a qcow2 image

e2image -Qa /dev/sdX1 part0.qcow2

qcow2 only keeps used blocks. My partition size is 14.7G, space taken is 12%. part0.qcow2 file is 1.7G.

 

Done with backup.

 

Now recover onto an sdcard of the same size (I know armbian keeps some % free when expanding the partition, so there is no problem with Xgb cards having different space up to some bytes, Kbs or even Mbs).

 

First recover the partition table and bootloader

dd if=offset0.img of=/dev/sdX bs=4M

Make the kernel aware about the partitions on /dev/sdX

partprobe /dev/sdX

Recover the partition

e2image -rc part0.qcow2 /dev/sdX1

 

That's all, just 2 lines to backup (while only keeping used blocks) and 3 lines to restore.

 

As simple as it is, is it correct overall or mby I've missed something?

 

Update: changed the recover partition command from qemu-img to e2image to utilize the latter's "-c" option targeted for flash drives.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines