Difference between revisions of "Failsafe"

From ArmadeusWiki
Jump to: navigation, search
(Backup eMMC rootfs)
(Backup rootfs partition only)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Intro==
 
==Intro==
Failsafe is the short name for the RAM bootable rescue image for APF boards ([[APF6]] only for the moment). It is a Linux kernel + minimal initrd image all packed together in a standard ''apf6-linux.bin''.
+
Failsafe is the short name for the RAM bootable rescue image for APF boards ([[APF6]] & [[OPOS6UL]] only for the moment). It is a Linux kernel + minimal initrd image all packed together in a standard kernel image (''apf6-linux.bin'' or ''opos6ul-linux.bin'').
  
 
==Installation==
 
==Installation==
Line 6: Line 6:
 
===Generate it===
 
===Generate it===
 
<pre class="host">
 
<pre class="host">
$ make apf6failsafe_defconfig
+
$ make apf6failsafe_defconfig     or    $ make opos6ulfailsafe_defconfig
 
$ make
 
$ make
$ cp buildroot/output/images/apf6-linux.bin /tftpboot/
+
$ cp buildroot/output/images/*-linux.bin /tftpboot/
 
</pre>
 
</pre>
  
Line 31: Line 31:
 
* wait some minutes until backup is done ;-)
 
* wait some minutes until backup is done ;-)
  
===Restore eMMC rootfs from backup===
+
===Restore eMMC from backup===
 
* same principle:
 
* same principle:
 
<pre class="apf">
 
<pre class="apf">
# gunzip -c /mnt/nfs/root.bak.gz | pv | dd of=/dev/mmcblk2 conv=sync,noerror bs=128K
+
# gunzip -c /mnt/nfs/emmc.bak.gz | pv | dd of=/dev/mmcblk2 conv=sync,noerror bs=512 count=7733248
 +
</pre>
 +
 
 +
===Backup rootfs partition only===
 +
* Check that you are using the right partition ;-) and be sure that it has no errors (here example for OPOS6UL(NANO)):
 +
<pre class="apf">
 +
# dumpe2fs -h /dev/mmcblk0p2 | grep name
 +
# e2fsck /dev/mmcblk0p2
 +
</pre>
 +
* Mount rootfs in a temporary mount point:
 +
<pre class="apf">
 +
# mkdir -p /tmp/mnt/rootfs
 +
# mount /dev/mmcblk0p2 /tmp/mnt/rootfs/
 +
</pre>
 +
* eventually get current date:
 +
<pre class="apf">
 +
# udhcpc -i eth0
 +
# ntpd -nqp 217.147.208.1
 +
# DATE=`date +%Y.%m.%H-%M`
 +
</pre>
 +
* backup will be put on HOME partition so check there is enough space:
 +
<pre class="apf">
 +
# df -h
 +
</pre>
 +
* and launch backup:
 +
<pre class="apf">
 +
# cd /tmp/mnt/rootfs/; tar cvzf /home/rootfs_$DATE.backup.tar.gz *
 +
</pre>
 +
 
 +
===Restore rootfs partition only===
 +
* erase current content of rootfs, '''you will loose all data !!''':
 +
<pre class="apf">
 +
# mkfs.ext4 /dev/mmcblk0p2
 +
</pre>
 +
* mount rootfs in a temporary mount point:
 +
<pre class="apf">
 +
# mkdir -p /tmp/mnt/rootfs
 +
# mount /dev/mmcblk0p2 /tmp/mnt/rootfs/
 +
</pre>
 +
* launch restore:
 +
<pre class="apf">
 +
# tar zxvf /home/rootfs_xxx.backup.tar.gz -C /tmp/mnt/rootfs/
 +
# sync
 +
# umount /tmp/mnt/rootfs/
 +
* that's it !
 
</pre>
 
</pre>
  
 
==Links==
 
==Links==
 
*
 
*

Latest revision as of 16:46, 25 July 2018

Intro

Failsafe is the short name for the RAM bootable rescue image for APF boards (APF6 & OPOS6UL only for the moment). It is a Linux kernel + minimal initrd image all packed together in a standard kernel image (apf6-linux.bin or opos6ul-linux.bin).

Installation

Generate it

$ make apf6failsafe_defconfig      or     $ make opos6ulfailsafe_defconfig
$ make
$ cp buildroot/output/images/*-linux.bin /tftpboot/

Launch it

BIOS> run ramboot

Cool stuff that can be done with it

apf-config

# apf-config
  • check eMMC filesystem

Backup eMMC

  • you need a network connection with a server that can receive the backup (for example with NFS, here mounted on /mnt/nfs/):
# dd if=/dev/mmcblk2 bs=512 count=7733248 conv=noerror,sync | pv | gzip -c -9 > /mnt/nfs/emmc.bak.gz
  • wait some minutes until backup is done ;-)

Restore eMMC from backup

  • same principle:
# gunzip -c /mnt/nfs/emmc.bak.gz | pv | dd of=/dev/mmcblk2 conv=sync,noerror bs=512 count=7733248

Backup rootfs partition only

  • Check that you are using the right partition ;-) and be sure that it has no errors (here example for OPOS6UL(NANO)):
# dumpe2fs -h /dev/mmcblk0p2 | grep name
# e2fsck /dev/mmcblk0p2 
  • Mount rootfs in a temporary mount point:
# mkdir -p /tmp/mnt/rootfs
# mount /dev/mmcblk0p2 /tmp/mnt/rootfs/
  • eventually get current date:
# udhcpc -i eth0
# ntpd -nqp 217.147.208.1
# DATE=`date +%Y.%m.%H-%M`
  • backup will be put on HOME partition so check there is enough space:
# df -h
  • and launch backup:
# cd /tmp/mnt/rootfs/; tar cvzf /home/rootfs_$DATE.backup.tar.gz *

Restore rootfs partition only

  • erase current content of rootfs, you will loose all data !!:
# mkfs.ext4 /dev/mmcblk0p2 
  • mount rootfs in a temporary mount point:
# mkdir -p /tmp/mnt/rootfs
# mount /dev/mmcblk0p2 /tmp/mnt/rootfs/
  • launch restore:
# tar zxvf /home/rootfs_xxx.backup.tar.gz -C /tmp/mnt/rootfs/
# sync
# umount /tmp/mnt/rootfs/
* that's it !

Links