Talkabout Posted January 27, 2020 Posted January 27, 2020 Hi guys, I am currently working on backing up my armbian installation. Following situation: boot: sd card file system: nfs root backing up the file system is not an issue, there I am using a rsync logic that transfers only changed files, which works great. The problem is with the boot files. In case of sd card failure I need an image that I can quickly restore to a new sd card, without the whole file system, as it is on nfs root and backed up differently. Now my question is: what is the best way to create an image file with only the boot logic? On Raspbian this is simple, as the boot device is a fat32 partition, but on Armbian there is no separate partition I can use for that. Help is much appreciated! Thanks! Bye
umiddelb Posted January 28, 2020 Posted January 28, 2020 Where do you load the kernel image, dtb and initrd from, from sd card or from a network device as well?
Talkabout Posted January 28, 2020 Author Posted January 28, 2020 these files are loaded from sd card, this is why I would like to backup them as an image file to be able to quickly restore them.
Igor Posted January 28, 2020 Posted January 28, 2020 9 hours ago, Talkabout said: On Raspbian this is simple Raspbian is an OS and RPi is a (proprietary boot) hardware that must have FAT partition. It can't boot without ... The main problem we have with Armbian is that every hardware (family) has different method of booting. Only from the user perspective it looks (almost) the same. Because we cover more than one (simple) device, things are not simple. In general you have boot loader(s) outside, below filesystem and stuff in the /boot + (optional) /lib/modules. Which device you are actually talking about?
Talkabout Posted January 28, 2020 Author Posted January 28, 2020 I am using RockPI. While rsyncing the file system all the folder (including /boot) are backed up, but to restore a damaged sd card currently I would need to install stock armbian and modify the boot files in order to boot from nfs root. I would like to simplify this process by creating a small "img" file that I can restore easily on sd card failure. Is there any way to do that? Thanks!
Heisath Posted January 28, 2020 Posted January 28, 2020 Well if you are booting from sd now, you could use dd, etcher, win32diskimager or another tool to create a full image of the sd card. Then just write that to a backup sd. Or copy /boot to new sd with rsync and write bootloader manually.
Talkabout Posted January 28, 2020 Author Posted January 28, 2020 My requirement is a little bit different: I would like to include this "boot image creation" into my backup process as an automatic action. Maybe the solution is to - create temporary partition - copy /boot to that partition - install boot loader on this partition => this is something I do not know how to do it - create img out of this partition The problem is I am not really into the whole "boot thing" that is why I am asking for help (or maybe some howtos). is the above process the best option? Thanks!
Heisath Posted January 28, 2020 Posted January 28, 2020 You could just use dd to backup your sd into some image automatically? Might be big depending on the size of the sd card. Or just dd it to the image once, and for automatic backups mount the image as loop, and rsync /boot. No need to backup bootloader each time
Talkabout Posted January 28, 2020 Author Posted January 28, 2020 hm..., possible but not very nice Thanks for the hint! So with Armbian the boot partition and ext4 root partition are basically the same? And the bootloader simply points to the /boot folder? Bye
Heisath Posted January 28, 2020 Posted January 28, 2020 That depends on the board. But mostly u-boot sits directly on the device (before the partition) and then loads the kernel etc. from /boot. Same as on x86 grub gets also installed to mbr...
Talkabout Posted January 28, 2020 Author Posted January 28, 2020 Device is RockPI as mentioned above. Your statement means that if I create a small partition, put only the /boot folder there and then export it via "dd" to an image file, restoring that to an SD should give me the ability to boot correctly?
umiddelb Posted January 28, 2020 Posted January 28, 2020 You may test the following approach: - have a look with `fdisk -l /dev/<sd card>` and find out where the first (and only) partition starts - copy with `dd bs=512 if=/dev/<sd card> of=<imagefile> count=<start sector of first partition> - copy the contents of /boot to a different location - look which file system features have been enabled for / (`tune2fs -l /dev/<sd card>`) - write the image file to a different sd card - delete and recreate on the different sd card the first partition according to the space requirements of /boot, make sure that your starting sector count stays the same - create a filesystem for the newly created partition and make sure that the features match the information you have gathered before, some bootloaders cannot deal with journaling nor with 64bit filesystems which are switched on by default - copy the contents of /boot back to your different sd card
Igor Posted January 28, 2020 Posted January 28, 2020 As far as for the boot loader. We pack it with a process to burn it into the SD/eMMC. For examle, this board, is within repository:https://apt.armbian.com/pool/main/l/linux-u-boot-rockpi-4b-legacy/linux-u-boot-legacy-rockpi-4b_19.11.3_arm64.deb boot loader in binary form script for flashing to correct location You can extract the content of DEB package and DIY.
Talkabout Posted January 29, 2020 Author Posted January 29, 2020 Thanks guys, will try the suggested solutions! Bye
Recommended Posts