Jump to content

Armbian Debian - create boot image WITHOUT file system


Talkabout

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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. 

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