Segui

Recover settings from a corrupted SD card

Applies to Platform: Mini ARM All
Last Updated: 6th September 2012

Note

With the latest updates of Endian UTM 2.4 and 2.5 released on 4th September 2012, Endian introduced a script to store a copy of configuration files on the internal NAND and automatically restore it in case of SD card replacement.

Automatic Recover after failure of a SD card

With the updates released on 4th September 2012, Endian introduced a script that stores a copy of configuration files on the internal NAND to avoid loosing configuration files in case of Micro SD failure.

How it works

Every 6 hours a cronjob launches the script, which copies all the configuration files in /var/efw/ (stored on the Micro SD) into the internal NAND and keeps them synchronized. The  copies of those files are stored in the /usr/lib/efw_backup/ directory.

What happens to the configuration files after Micro SD replacement?

During the first boot after the replacement of a broken Micro SD, its partition table is recreated. Next,  the system checks if under /usr/lib/efw_backup/ there is a backup. If one is found, it is automatically restored to /var/efw/. Otherwise, if there is nothing into /usr/lib/efw_backup/, the Endian UTM Appliance starts with the default config files.

Manual Recover after failure of a SD card (deprecated)

This article shows how to backup and restore the configuration files of an Endian Mini ARM from a partially corrupted micro SD card.

To perform the backup and the restore of settings we need to connect via console cable by following this how-to.

Warning

This procedure does not ensure that all your data and configuration will be safely copied and should be considered as a last resort. It does not replace the normal backup function from the GUI, which is always the preferred way to save your data.

Backup settings from Endian Console

Connect to the Endian Mini ARM through console. You see a screen like the one below: Type your root password and then press Enter. Right after, login to the bash console by typing the login command and providing again the root password.

VAR: recovering journal
Superblock needs_recovery flag is clear, but journal has data.
Recovery flag not set in backup superblock, so running journal anyway.
e2fsck: unable to set superblock flags on VAR
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Give root password for maintenance
(or type Control-D to continue): (Repair filesystem) 1 # login login: root Password:

Now you need to mount the root partition in read-write mode, because in "Recovery Mode" it is mounted read-only and to store the backup of configuration files in an archive in the root partition (internal NAND) it is necessary to have write access. Later, it will be possible to restore directly the settings on a new SD card. Also mount the /var/efw/ directory which stores most of the settings to backup. If the SD card is only partially corrupted, there's a good chance to copy a great part of the settings and avoid the necessity of reconfiguring from zero the Endian Mini ARM. The command to use are:

root@endian:~# mount -o rw,remount /
root@endian:~# mount /dev/mmcblk0p2 /var/efw/
root@endian:~# tar czvf /root/backup.tar.gz /var/efw/

Note

It may seldom happen that the internal NAND has not enough space to store the settings. In this case it is necessary to use an external USB drive.

Restore settings from Endian Console

When inserting into the Endian Mini ARM a new, formatted micro SD, we found a vanilla installation, on which we want to restore the backup previously archived in the root partition (internal NAND). 

Connect to the Endian Mini ARM via console, you will be presented a menu similar to this one:

Release: Endian Firewall Appliance release 2.4-0 (Deployset #0)
Product: Appliance Mini

Management URL: https://192.168.0.15:10443
Green IP: 192.168.0.15/24
-----------------

0) Shell
1) Reboot
2) Change Root Password
3) Change Admin Password
4) Restore Factory

Choice: 0

From the menu, select option 0, then type in sequence login, your root password, and bash.

Now we are ready to restore the backup. Type in the bash console tar -C /var/efw/ -xzvf backup.tar.gz: This command extract all configuration file from the backup archive in the /var/efw directory. When the extraction has terminated, fix the file permissions with the efw-fixperms script and finally reboot your Endian Mini ARM. After the boot has finished, you can check if your configuration was restored.

[endian]: login
root's password:
[endian]root: bash
bash-3.00#
bash-3.00# tar -C /var/efw/ -xzvf /root/backup.tar.gz
bash-3.00# efw-fixperms
bash-3.00# reboot
Questo articolo ti è stato utile?
Utenti che ritengono sia utile: 0 su 0
Altre domande? Invia una richiesta

Commenti