PINE64
eMMC backup - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook (https://forum.pine64.org/forumdisplay.php?fid=76)
+--- Forum: General Discussion on Pinebook (https://forum.pine64.org/forumdisplay.php?fid=77)
+--- Thread: eMMC backup (/showthread.php?tid=4658)

Pages: 1 2


eMMC backup - amilino - 06-30-2017

Simple question, how to backup OS installed on eMMC?


RE: eMMC backup - zer0sig - 06-30-2017

Where are you looking to back it up? on an SD drive? a USB drive? Another local host? cloud or similar?


RE: eMMC backup - amilino - 06-30-2017

(06-30-2017, 12:26 PM)zer0sig Wrote: Where are you looking to back it up? on an SD drive? a USB drive? Another local host? cloud or similar?

USB drive.


RE: eMMC backup - amilino - 07-01-2017

Any feedback?


RE: eMMC backup - MarkHaysHarris777 - 07-01-2017

(07-01-2017, 03:52 PM)amilino Wrote: Any feedback?

hi,  you use a dangerous tool called  dd  to write an 'image' file to another device, like usb, and then you compress it with gzip.

dd stands for 'humorously'   Disk Destroyer

kidding;

... be careful ;  it will destroy your drives if you're not careful or don't know what you're doing.

read the man page:   man dd

Join us on chat (see below for irc address) and we'll help you with it.


RE: eMMC backup - pfeerick - 07-02-2017

The basic idea is to use dd to read the eMMC, and save it to a file. To image the eMMC, it's best to boot from a SD image, so you don't have to deal with issues from backup up a "live" system. When you boot from the microSD, the eMMC is visible as /dev/mmcblk1. You'll want some progress whilst copying, and you'll probably want to compress the file so you don't have a 16GB file which really only has around 3GB of stuff in it. Hence the use of gzip, as it'll compress stuff a bit, and also ignore all the empty space.

So you could do something like this (where /media/pine64/64GB_USB3 was the mount folder for my usb drive, and eMMC_backup.img.gz was the name I chose to save the file as):


Code:
dd status=progress bs=512 if=/dev/mmcblk1 | gzip > /media/pine64/64GB_USB3/eMMC_backup.img.gz

But we can do better than that. gzip is a bit slow still, it only uses one of the four pinebook cpu cores, which seems a bit of waste, as that wil make it so the copy will take a quite a long time. pigz, on the other hand, is a gzip compatiable compressor with a difference... it will use all the cpu cores available. Consequently a 2516 second transfer instead took 970 seconds, just by switching to pigz. And is even faster if the  --fast parameter is used, still with light compression and no storage of empty space benefits. So my prefered option, after doing a sudo apt install pigz to install it, is the following:


Code:
dd status=progress bs=512 if=/dev/mmcblk1 | pigz --fast > /media/pine64/64GB_USB3/eMMC_backup.img.gz


And to restore the backup? The traditional:

Code:
gunzip -c /media/pine64/64GB_USB3/eMMC_backup.img.gz | dd of=/dev/mmblk1 bs=512 status=progress 

or the much faster:

Code:
pigz -d -c /media/pine64/64GB_USB3/eMMC_backup.img.gz | dd of=/dev/mmblk1 bs=512 status=progress

should do the trick. However, since the of parameter of good 'ol disk destroyer is being used here... make sure you don't type this one wrong.... as you might find yourself writing the image to the wrong drive with disasterous consequences!
And as a side note, as the OP found out, if you are using NTFS formatted drives, ntfs-3g isn't installed by default, so a quick sudo apt install ntfs-3g is needed to enable NTFS write support.


RE: eMMC backup - xalius - 07-02-2017

For backup purposes maybe also look into dcfldd , which is a fork of dd that also supports hashing and verification on the fly...


RE: eMMC backup - amilino - 07-02-2017

Thank you, it is working. Created backup successfully.


RE: eMMC backup - zer0sig - 07-03-2017

pfeerick's suggestion is probably what I would do. It is clear, works on almost any unix-type OS build from the past 30-35 years (though I doubt you'll find pigz easily available for early 90s SCO boxen, heh), and it's good to know what these userland utils do.


RE: eMMC backup - MarkHaysHarris777 - 07-03-2017

(07-03-2017, 10:49 AM)zer0sig Wrote: pfeerick's suggestion is probably what I would do. It is clear, works on almost any unix-tpe OS build fro the past 30-35 years (though I doubt you'll find pigz easily available for early 90s SCO boxen, heh), and it's good to know what these userland utils do.


Indeed !   ... and pfeerick was actually brave enough to explain it on-line , in front of God and everyone , without qualification and with poise !   (and the OP actually used it without destroying anything!)    (impressive)

Tongue