[SOLVED] Cloning the image of an UP board
I've recently purchased a bunch of UP-Boards and I want to deploy a custom linux installation to all of these.
Here's my current situation:
I have four up-boards laying around here of which I have one of them completely configured with UBILINUX (Let's name this one COMPLETE). Now what I want to do is either clone the complete system from COMPLETE or make a custom image which I can deploy on the other three up-boards. I just don't seem to be able to figure out how to make this happen.
Things I've tried already:
Re-Do Backup & Recovery Tool - Didn't work because I can't seem to make a normal bootable USB that is recognized by the UP-Board in the boot-menu.
Clonezilla - I've tried this option right here MANY times. In the beginning I kept getting the error that it couldn't read/write a certain part of the system ( I didn't document it, pretty silly but I can't give you guys any error messages right now ) and as of now it's completely buggy when I'm trying to make an image of the system. I've already tried making a new Clonezilla bootable USB-drive thinking it might be a problem with the software after so many attempts but this didn't work either. When this didn't work I completely reset the UP-Board and made the same configuration base as I had before thinking it might be a problem with the configured up-board, however, this also doesn't fix the errors I'm getting in Clonezilla
DD full system copy to USB - This option I'm actually trying right now, which is basically using the command sudo dd if=/dev/mmcblk0 of=/dev/sda which according to online tutorials should copy the entire disk 1:1. Only after doing this and putting into the INCOMPLETE up-board I can't seem to find a way to copy the entire USB to the harddisk of the UP-board because I can't seem to figure out how to do this in an EFI shell.
If anyone of you have any experience considering cloning or making an image of an UP-board please give me some guidance in a solution for this issue.
I thank you all in advance!
Hisoka-
Comments
-
I don't use it that often so I can't give you details from memory, but you'll need to boot into a rescue shell, by interrupting the boot process and editing the boot file. This will boot into a very limited environment that runs off a ram disk and will allow you to mount the root filesystem to the ramfs filesystem you boot into. At that level you should be able to dd the root filesystem to a USB thumb drive as an exact copy. You would still probably need to do a base install on your other boards so that you have this capability on your targets. I will be doing this soon probably in order to move /var and /home over to an M.2 SSD, and effectively make the onboard DoC a mostly readonly device, since these type devices tend to be fairly write lifetime limited, and SSDs are write managed.
-
This seems like one topic truly deserving of a tutorial. Like Kamarasu I have tried a few things and frankly I’m rather terrified of this stuff. I learned the hard way using dd when I overwrote the data I was trying to save once (i’m a better programmer than an IT guy). I have several months of development on my first Up-Board and yes I have backed up my code but I made lots of alterations to the system and just want to copy what I know works.
-
Hello everyone,
I have found a way to clone the image of an UP board using CloneZilla, turned out that there were just a few extra tweaks that were necessary after putting back the image.
I have made a guide on how to clone the image, but as of now it is in Dutch.
If you have any interest in the file please let me know and I will translate it to English and share it here.
Kind Regards,
Kamarasu -
Hello Kamarasu !
HELP.
My usb3 connector of my firt upboard is dead and I need urgently to clone it to a second one... same hardware. ( 64Gb memory, 8Gb ram)
Please if you have any solution or tutorial to share with me/us about cloning it would help me.
Even if it is in Dutch, you can explain me in private and I will translate for everybody thanks to google translate ;-)
thanks a lot in advance
RAPHAËL -
Hi.
Raphael, are you sure you have an Up Board with 8GB RAM / 64GB Flash?
It sounds to me like either you have an Up Board with 4GB RAM / 64GB Flash or an Up Squared with 8GB RAM / 64GB Flash.
Either way, these instructions are almost identical and I have tested them both myself just now on both an Up Board 4GB/32GB and an Up Squared n4200/8GB/64GB.
Here's the full guide with extra everything. The guide assumes you have a Windows machine handy:
1) Creating a Linux USB Stick.
Take 1 trustworthy USB stick that you have nothing on (or nothing you can't lose).
Download your favorite Linux distributions. I used Kubuntu 17.04beta2. Make sure it's the 64bit one and that it's the desktop (not server in case you're using normal Ubuntu).
Go to https://rufus.akeo.ie/
Download "Rufus", latest version (2.12 latest right now).
Insert USB stick into your computer.
Start Rufus and accept any security prompts (UAC).
Under "Device", make sure that it displays the correct USB Stick and if not, change it to it.
Under "Partition scheme and target system type", pick "GPT partition scheme for UEFI".
Under "File system", pick "FAT32 (Default)" or "Large FAT32 (Default)" if the USB memory stick is larger than 32GB.
Uncheck "Check device for bacd blocks" unless you have spare time and want to make sure it's ok (not a bad idea really).
Make sure "Quick format" is checked.
Make sure "Create a bootable disk using..." is checked.
Click on the Disc icon to the right of where it normally says "FreeDOS".
Select your Linux .iso image.
Verify all settings are correct.
Click Start.
Wait for a bit.
You now have a Linux USB installer that works. Congratulations.
2) Preparing for boot.
Connect the USB Stick, keyboard, mouse and display to your Up Board / Up Squared Board.
Connect the power and if your board is set to boot from flash (and not USB), keep pressing DEL over and over until the BIOS screen appears. Go into BIOS, set it to boot from the USB stick instead of the built in flash (eMMC).
Save settings and tell it to reboot.
3) Preparing for extracting image.
Make it boot into some kind of Live image. Although maybe not strictly necessary it's easier.
When you have the UI up, fire up a command prompt using your favorite method. If in Kubuntu, simply wait a few seconds and type "konsole" (yes, with a k) and press enter.
4) Becoming root.kubuntu@kubuntu:~$ sudo su - root@kubuntu:~#
You are now root.
5) Making sure the USB stick you want to write to is read/write and not read only.
In your fancy console write:root@kubuntu:~# mount | grep cdrom /dev/sda1 on /cdrom type vfat (ro,,...loadsofoptions)
If it says "ro" after the "(", it's read only, if it's "rw" then you don't have to change it, you're already read write.root@kubuntu:~# mount /cdrom -o remount,rw
No space around the comma between remount and rw.
Now your USB stick in in read/write mode.
6) Extracting the image.
First of all you have to decide if you want to compress it at once or not. The command line is slightly different.
Second you need to figure out if you have an Up Board (credit card size) or Up Squared (which would then be... square..).
The ONLY difference is the device:Up Board: Device = /dev/mmcblk0 Up Squared: Device = /dev/mmcblk1
So - the instructions below are written for an Up Squared, i.e. I use /dev/mmcblk1. use "0" instead of "1" for an Up Board.
a) To extract it without compression:root@kubuntu:~# dd if=/dev/mmcblk1 of=/cdrom/name_of_image_file.img bs=512 status=progress
It will now show you a progress display of how fast it's extracting and writing it. I hope you have space on the USB stick or some other media you're writing to...
b) To extract it with compression:
use gzip, bzip2 or xz as per your own choice, gzip is worst and fastest, xz is best and slowest. My example uses "gzip":root@kubuntu:~# dd if=/dev/mmcblk1 bs=512 status=progress | gzip > /cdrom/name_of_image_file.img.gz
This will extract it and instead of writing it to a file (which will obviously be as big as your flash), it compresses it using gzip which then writes it to the file.
If you want to you can check that the file is OK by just runninggzip -t /cdrom/name_of_image_file.img.gz
(or bzip2/xz if you used one of them).
Ok, so now you have the whole image on the USB stick (compressed or not).
6) Gracefully shut down the system.
Start by remounting the usb stick into read only mode if it was.root@kubuntu:~# mount /cdrom -o remount,ro
Shut down the OS as normal.
7) Prepare target system.
Remove all cables from the old board and basically do points 2), 3) and 4) on the new board.
So, I am now assuming you're up and running in your spiffy root shell on the new board.
8) Write the image to the flash.
Remember to use mmcblk0 for Up Board and mmcblk1 for Up Squared.
a) If your image is uncompressed:root@kubuntu:~# dd if=/cdrom/name_of_image_file.img of=/dev/mmcblk1 bs=512 status=progress
b) If your image is compressed (substitute gzip with bzip2/xz if you used any of those):root@kubuntu:~# gzip -cd /cdrom/name_of_image_file.img.gz | dd of=/dev/mmcblk1 bs=512 status=progress
Wait until it completes and you are done.
Yes, it's long and this is clearly just one way to do it but this is how I do it.
Good luck and keep us posted if you do it this way so that others can know, etc.
// Stefan -
Hello everyone,
I've tried to quickly translate both of my manuals ( Creating an image / Restoring an image ) and uploaded them on this website:
How to create an image for an up-board:
https://www.scribd.com/document/343499153/Creating-an-Image-Up-Board
How to restore an image for an up-board:
https://www.scribd.com/document/343499210/Restoring-Image-Up-Board
I believe you can read the documents while you're on the website, so no need to download anything.
If it's against the rules to post links to files I apologize, I simply don't have the time to type all of this in a neat way on the forum, unfortunately I also have to work!
I hope these manuals can help you all, please let me know if it did!
Kind Regards,
Kamarasu -
Yes I was able to clone my Up-Board with Clonezilla using a combination of two tutorials, but Thank you Kamarasu for creating the guide and spreading the knowledge !
-
It seems to work except that on my UP2 the flash appears as /dev/mmcblk0!
-
If I restore that image to a usb flash can I boot it to an pc like live image?iv tried but even the uefi can detect the usb flash I can see the ubilinux or BOOT folder in the EFI folder of the image I created and when I hit to boot BOOTX64.EFI
the output is :
error:no such partition
Entering rescue mode
Grub rescue
I recently got a damaged emmc in my upboard 2 and I was wondering if I could boot the cloned image from external disk -
try to use Clonezilla?
-
@Nonobaku Hisoka said:
Hello everyone,
I've tried to quickly translate both of my manuals ( Creating an image / Restoring an image ) and uploaded them on this website:
How to create an image for an up-board:
https://www.scribd.com/document/343499153/Creating-an-Image-Up-Board
How to restore an image for an up-board:
https://www.scribd.com/document/343499210/Restoring-Image-Up-Board
I believe you can read the documents while you're on the website, so no need to download anything.
If it's against the rules to post links to files I apologize, I simply don't have the time to type all of this in a neat way on the forum, unfortunately I also have to work!
I hope these manuals can help you all, please let me know if it did!
Kind Regards,
KamarasuHi Kamarasu
Thanks for sharing these, could you kindly upload these to Google drive or somewhere free, Scribd seems to be the worst place to read this since they dont let you view files for long nor download these without paying them
Please email the documents to inbox at zubairahmed dot net -
Hello everybody.
Please, could you share the guide in another place more readable? Scribd is limited...
Anoter question, I have only one user set to my board, let's call it myuser.
When I login I use:- user: myuser
- password: mypassword
And of course when I use su or sudo, I must type the password mypassword.
Why must I remove it before cloning? I am a little worried about that because I tried to modify the sudoers file using visudo but I closed myself out of the system all the times...
Thanks.
Silvano
Eng. Silvano Bertoldo, PhD
-
Actually nothing special is required.
If you properly use clonezilla, everything works without any problems!No problem with password, root permissions etc.
_Clonezilla _makes just an image of your system and you can restore it in another system with the same characteristics and hardware.I used it and succesfully make a clone and a restore of my system.
Silvano
Eng. Silvano Bertoldo, PhD
-
Hi,guys,
I would like to thank you all. Specially to Nonobaku Hisoka, your tutorial helped me alot.
I would like you to add one thing that, in the section for creating Clonezilla bootable USB, it is for windows. If any body is using GNU/Linux then follow this link:
https://clonezilla.org/liveusb.php#linux-setupI myself used Method B from the link. Other seems to be having some error with me. But you can give a try.
Kind regards,
Munawar Ali