How to copy SD card OS to eMMC ?

Post Reply
Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Mon Feb 03, 2020 7:38 pm

Hi,

I have the couldshell2 with OMV on the sd card and I would like to copy the OS and boot from the eMMC module to limit SD card corruption that happened one time and killed my card...

The problem is I tried to flash OMV on sd card with adapter but did not work. I tried install OMV on a fresh debian but same problem.

What can I do ?

thanks in advance

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Mon Feb 03, 2020 7:53 pm

Try odroid-backup (https://github.com/mad-ady/odroid-backup), or to do it offline you can use dd if the sd card is slightly smaller than thd emmc.

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Wed Feb 05, 2020 5:00 am

Hi ,

thanks for answer but my sd card IS bigger than emmc...

Can I put in my computer, shrink partitions with gparted and then use odroid backup ?

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Wed Feb 05, 2020 5:58 am

No need to shrink partitions with odroid backup. It backs up the used space and grows the last partition to fill the disk on restore.
You need to use gparted to shrink/expand when using dd.

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Wed Feb 05, 2020 10:04 pm

Hi, I tried the program but it not worked...

At first I thought it must be used locall until I see the linux mint windows :)

I had to run with -a argument, then i could successfully backup the SD and also my recalbox eMMC. But when I attepted to recover to my eMMC the program stops... what happened ? note : I work in ubuntu eon ermine

And there is also 2 more partition of my emmc : mmcblkboot1 and boot2 . Do I have to put the bootloader here ?

thanks for the help

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Wed Feb 05, 2020 10:14 pm

If the emmc was used with a xu4 before it already has the bootloader in those hidden blocks. Otherwise you need to follow the emmc recovery procedure on the wiki.
Regarding restore errors - what was the command line used and what was the output?

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Thu Feb 06, 2020 2:41 am

Hi, after spend 2 hours I am fed up ...

I used the graphical interface with the -a argument. The program did well the backup but when I want to recover, it ask me the directory path and all other info but when I click to the final button there is nothing... And i had back the user@host line in terminal.

I tried directly on the Xu4 via ssh but the backup file was too big to store on it via ftp. And he ask me to add --directory after the command.

Now I am trying manually back up every patition after shrinking to the emmc.

I think the problem maybe comes from the part number 3 which is unknown by linux and skipped by the program. Probably used for a such of OMV backup... This third partition makes me really anxious. This is maybe the reason why the OMV eMMC flashing with Etcher did not work ... maybe the bootloader cannot reconised it...

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Thu Feb 06, 2020 2:49 am

The program looks like he did the job in 1ms but nothing has been done ...

Code: Select all

Starting backup process
*** Starting to backup /dev/mmcblk0p2 ***
Using partclone binary: partclone.btrfs
Partclone v0.3.11 http://partclone.org
Starting to clone device (/dev/mmcblk0p2) to image (/home/seb/Documents/nasodroid-2nd-partition/partition_2.img)
Reading Super Block
Calculating bitmap... Please wait... 
done!
File system:  BTRFS
Device size:    7.9 GB = 480023 Blocks
Space in use:   3.8 GB = 231614 Blocks
Free Space:     4.1 GB = 248409 Blocks
Block size:   16384 Byte

                                                                                
Elapsed: 00:00:01, Remaining: 00:01:39, Completed:   1.00%,   0.00byte/min,

                                                                                
current block:          0, total block:     480023, Complete:   0.00%[A

                                                                                
Elapsed: 00:00:02, Remaining: 00:01:00, Completed:   3.22%,   3.66GB/min,

                                                                                
current block:       9418, total block:     480023, Complete:   1.96%[A

                                                                                
Elapsed: 00:00:04, Remaining: 00:00:57, Completed:   6.53%,   3.72GB/min,

                                                                                
current block:      17098, total block:     480023, Complete:   3.56%[A

                                                                                
Elapsed: 00:00:06, Remaining: 00:00:57, Completed:   9.52%,   3.61GB/min,

                                                                                
current block:      24010, total block:     480023, Complete:   5.00%[A

                                                                                
Elapsed: 00:00:08, Remaining: 00:00:54, Completed:  12.83%,   3.65GB/min,

                                                                                
current block:      31690, total block:     480023, Complete:   6.60%[A

                                                                                
Elapsed: 00:00:10, Remaining: 00:00:53, Completed:  15.79%,   3.59GB/min,

                                                                                
current block:      38538, total block:     480023, Complete:   8.03%[A

                                                                                
Elapsed: 00:00:12, Remaining: 00:00:49, Completed:  19.41%,   3.68GB/min,

                                                                                
current block:      46922, total block:     480023, Complete:   9.77%[A

                                                                                
Elapsed: 00:00:14, Remaining: 00:00:47, Completed:  22.81%,   3.71GB/min,

                                                                                
current block:      54794, total block:     480023, Complete:  11.41%[A

                                                                                
Elapsed: 00:00:16, Remaining: 00:00:45, Completed:  26.10%,   3.71GB/min,

                                                                                
current block:      62410, total block:     480023, Complete:  13.00%[A

                                                                                
Elapsed: 00:00:18, Remaining: 00:00:43, Completed:  29.16%,   3.69GB/min,

                                                                                
current block:      69514, total block:     480023, Complete:  14.48%[A

                                                                                
Elapsed: 00:00:20, Remaining: 00:00:42, Completed:  32.26%,   3.67GB/min,

                                                                                
current block:      76682, total block:     480023, Complete:  15.97%[A

                                                                                
Elapsed: 00:00:22, Remaining: 00:00:40, Completed:  35.46%,   3.67GB/min,

                                                                                
current block:      84106, total block:     480023, Complete:  17.52%[A

                                                                                
Elapsed: 00:00:24, Remaining: 00:00:38, Completed:  38.47%,   3.65GB/min,

                                                                                
current block:      91082, total block:     480023, Complete:  18.97%[A

                                                                                
Elapsed: 00:00:26, Remaining: 00:00:38, Completed:  40.08%,   3.51GB/min,

                                                                                
current block:      94794, total block:     480023, Complete:  19.75%[A

                                                                                
Elapsed: 00:00:28, Remaining: 00:00:38, Completed:  42.34%,   3.44GB/min,

                                                                                
current block:     100042, total block:     480023, Complete:  20.84%[A

                                                                                
Elapsed: 00:00:30, Remaining: 00:00:36, Completed:  45.36%,   3.44GB/min,

                                                                                
current block:     107018, total block:     480023, Complete:  22.29%[A

                                                                                
Elapsed: 00:00:32, Remaining: 00:00:36, Completed:  46.65%,   3.32GB/min,

                                                                                
current block:     110026, total block:     480023, Complete:  22.92%[A

                                                                                
Elapsed: 00:00:35, Remaining: 00:00:35, Completed:  49.31%,   3.21GB/min,

                                                                                
current block:     116170, total block:     480023, Complete:  24.20%[A

                                                                                
Elapsed: 00:00:37, Remaining: 00:00:33, Completed:  52.29%,   3.22GB/min,

                                                                                
current block:     123082, total block:     480023, Complete:  25.64%[A

                                                                                
Elapsed: 00:00:39, Remaining: 00:00:30, Completed:  55.91%,   3.26GB/min,

                                                                                
current block:     131466, total block:     480023, Complete:  27.39%[A

                                                                                
Elapsed: 00:00:41, Remaining: 00:00:28, Completed:  59.36%,   3.30GB/min,

                                                                                
current block:     139466, total block:     480023, Complete:  29.05%[A

                                                                                
Elapsed: 00:00:43, Remaining: 00:00:23, Completed:  64.24%,   3.40GB/min,

                                                                                
current block:     151065, total block:     480023, Complete:  31.47%[A

                                                                                
Elapsed: 00:00:45, Remaining: 00:00:20, Completed:  68.85%,   3.48GB/min,

                                                                                
current block:     162572, total block:     480023, Complete:  33.87%[A

                                                                                
Elapsed: 00:00:47, Remaining: 00:00:18, Completed:  71.31%,   3.45GB/min,

                                                                                
current block:     168268, total block:     480023, Complete:  35.05%[A

                                                                                
Elapsed: 00:00:49, Remaining: 00:00:16, Completed:  74.32%,   3.45GB/min,

                                                                                
current block:     175244, total block:     480023, Complete:  36.51%[A

                                                                                
Elapsed: 00:00:51, Remaining: 00:00:15, Completed:  77.15%,   3.44GB/min,

                                                                                
current block:     181798, total block:     480023, Complete:  37.87%[A

                                                                                
Elapsed: 00:00:53, Remaining: 00:00:15, Completed:  77.31%,   3.32GB/min,

                                                                                
current block:     182182, total block:     480023, Complete:  37.95%[A

                                                                                
Elapsed: 00:00:55, Remaining: 00:00:13, Completed:  80.71%,   3.34GB/min,

                                                                                
current block:     190054, total block:     480023, Complete:  39.59%[A

                                                                                
Elapsed: 00:00:57, Remaining: 00:00:10, Completed:  84.22%,   3.36GB/min,

                                                                                
current block:     198182, total block:     480023, Complete:  41.29%[A

                                                                                
Elapsed: 00:00:59, Remaining: 00:00:08, Completed:  87.68%,   3.38GB/min,

                                                                                
current block:     206182, total block:     480023, Complete:  42.95%[A

                                                                                
Elapsed: 00:01:01, Remaining: 00:00:06, Completed:  90.69%,   3.38GB/min,

                                                                                
current block:     213158, total block:     480023, Complete:  44.41%[A

                                                                                
Elapsed: 00:01:03, Remaining: 00:00:04, Completed:  93.15%,   3.37GB/min,

                                                                                
current block:     218853, total block:     480023, Complete:  45.59%[A

                                                                                
Elapsed: 00:01:05, Remaining: 00:00:02, Completed:  95.99%,   3.36GB/min,

                                                                                
current block:     225445, total block:     480023, Complete:  46.97%[A

                                                                                
Elapsed: 00:01:07, Remaining: 00:00:02, Completed:  97.10%,   3.30GB/min,

                                                                                
current block:     228005, total block:     480023, Complete:  47.50%[A

                                                                                
Elapsed: 00:01:10, Remaining: 00:00:00, Completed:  99.99%,   3.26GB/min,

                                                                                
current block:     235478, total block:     480023, Complete:  49.06%[A

                                                                                
Elapsed: 00:01:12, Remaining: 00:00:00, Completed:  99.99%,   3.26GB/min,

                                                                                
current block:     242134, total block:     480023, Complete:  50.44%[A

                                                                                
Elapsed: 00:01:14, Remaining: 00:00:00, Completed:  99.99%,   3.21GB/min,

                                                                                
current block:     244999, total block:     480023, Complete:  51.04%[A

                                                                                
Elapsed: 00:01:16, Remaining: 00:00:00, Completed:  99.99%,   3.22GB/min,

                                                                                
current block:     251938, total block:     480023, Complete:  52.48%[A

                                                                                
Elapsed: 00:01:18, Remaining: 00:00:00, Completed:  99.99%,   3.18GB/min,

                                                                                
current block:     255423, total block:     480023, Complete:  53.21%[A

                                                                                
Elapsed: 00:01:20, Remaining: 00:00:00, Completed:  99.99%,   3.17GB/min,

                                                                                
current block:     262313, total block:     480023, Complete:  54.65%[A

                                                                                
Elapsed: 00:01:22, Remaining: 00:00:00, Completed:  99.99%,   3.17GB/min,

                                                                                
current block:     283260, total block:     480023, Complete:  59.01%[A

                                                                                
Elapsed: 00:01:24, Remaining: 00:00:00, Completed: 100.00%, Rate:   3.10GB/min,

                                                                                
current block:     292356, total block:     480023, Complete: 100.00%
Total Time: 00:01:24, Ave. Rate:    3.1GB/min, 100.00% completed!
Syncing... OK!
Partclone successfully cloned the device (/dev/mmcblk0p2) to the image (/home/seb/Documents/nasodroid-2nd-partition/partition_2.img)
Cloned successfully.
Error code: 0
Partclone v0.3.11 http://partclone.org
Showing info of image (/home/seb/Documents/nasodroid-2nd-partition/partition_2.img)
File system:  BTRFS
Device size:    7.9 GB = 480023 Blocks
Space in use:   3.8 GB = 231614 Blocks
Free Space:     4.1 GB = 248409 Blocks
Block size:   16384 Byte

image format:    0002
created on a:    64 bits platform
with partclone:  v0.3.11
bitmap mode:     BIT
checksum algo:   CRC32
checksum size:   4
blocks/checksum: 64
reseed checksum: yes

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Thu Feb 06, 2020 4:05 am

Ok, you're using btrfs (which should work). But I'm seeing just the backup log, not the restore log. Check also /var/log/odroid-backup.log, see if there is anything inside.
Now, I'm not familiar with OMV partitioning scheme, but if it uses lvm, it won't work.
Most likely the restore doesn't work because of a bug in zenity which can't render some dialog types. In this case, to restore you'll need to add all parameters to the command line. See the example on github. The output should suggest sensible values for your system.
If you're still stuck, show me

Code: Select all

fdisk -l /dev/mmcblk1 #or whatever your sd card is called
lsblk
ls -l /path/to/backup/folder

elatllat
Posts: 1689
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 31 times
Been thanked: 96 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by elatllat » Thu Feb 06, 2020 4:11 am

1) simple and slow:
eMMCs have protected volumes such as

Code: Select all

/dev/mmcblk0boot0
used by the XU4.
Otherwise you could just

Code: Select all

cat /path/to/sdcard > /path/to/emmc
and maybe edit boot.ini to use the UUID or the correct device number, and maybe resize the source to be smaller than the destination.


2) complicated but faster
If you want to copy/rsync just files to a fresh partition table it's more complicated;
There is also a bootloader before the first partition, written like so;

Code: Select all

dd if=$UBOOT of=$1 conv=fsync,notrunc bs=512 seek=1
and you may need to setup lvm, or btrfs, etc.

(this may be a mix of XU4 and N2 memories; I forget)
Last edited by elatllat on Sat Feb 08, 2020 8:29 am, edited 1 time in total.

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Sat Feb 08, 2020 12:50 am

Hi everybody !

Here is the log

Code: Select all

Starting backup process
*** Starting to backup /dev/mmcblk1p2 ***
Using partclone binary: partclone.btrfs
Unmounting /var/folder2ram/var/cache/samba...
Partclone v0.2.89 http://partclone.org
Starting to clone device (/dev/mmcblk1p2) to image (/tmp/o-backup/partition_2.img)
device (/dev/mmcblk1p2) is mounted at /var/folder2ram/var/lib/netatalk/CNID
error exit
Partclone fail, please check /var/log/partclone.log !
Error code: 1
Mounting back /var/folder2ram/var/cache/samba (if it's in fstab)...
mount: can't find /var/folder2ram/var/cache/samba in /etc/fstab
Partclone v0.2.89 http://partclone.org
Display image information
info: Can't open file(/tmp/o-backup/partition_2.img)
Partclone fail, please check /var/log/partclone.log !


Partclone v0.2.89 http://partclone.org
Display image information
info: Can't open file(/tmp/o-backup/partition_2.img)


Finally I've just made an image with gnome disk, then use truncate command and flashed to eMMC. and... It worked !!

I also used another eMMC with a working recalbox on it. It can be strange that hardkernel send me 2 different eMMC but I knew this one works for sure.

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Sat Feb 08, 2020 3:14 am

It looks like omv partitions don't like being backed up while running... Must be because it's btrfs

User avatar
rooted
Posts: 7339
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 495 times
Been thanked: 138 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by rooted » Sat Feb 08, 2020 3:24 am

mad_ady wrote:It looks like omv partitions don't like being backed up while running... Must be because it's btrfs
BTRFS can take live snapshots which is the way to backup.

This tool is fairly comprehensive for BTRFS backup management:

https://github.com/digint/btrbk
These users thanked the author rooted for the post:
mad_ady (Sat Feb 08, 2020 3:27 am)

User avatar
mad_ady
Posts: 7561
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 394 times
Been thanked: 296 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by mad_ady » Sat Feb 08, 2020 3:26 am

It's probably because I'm using partimage instead, and it operates on block devices...

Dr.Methyl
Posts: 20
Joined: Fri Jul 12, 2019 12:35 am
languages_spoken: english, french
ODROIDs: odroid Xu4, odroid C1+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by Dr.Methyl » Sat Feb 08, 2020 4:42 am

mad_ady wrote:
Sat Feb 08, 2020 3:14 am
It looks like omv partitions don't like being backed up while running... Must be because it's btrfs
The logs I posted are these from my ubuntu 19.10 computer...

User avatar
rooted
Posts: 7339
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 495 times
Been thanked: 138 times
Contact:

Re: How to copy SD card OS to eMMC ?

Unread post by rooted » Sat Feb 08, 2020 6:45 am

Dr.Methyl wrote:
mad_ady wrote:
Sat Feb 08, 2020 3:14 am
It looks like omv partitions don't like being backed up while running... Must be because it's btrfs
The logs I posted are these from my ubuntu 19.10 computer...
Why is your filesystem BTRFS?

Post Reply

Return to “CloudShell”

Who is online

Users browsing this forum: No registered users and 0 guests