Configuration Autobackup

Bryan Mayland edited this page Oct 12, 2017 · 5 revisions

This information is obsoleted by Release v14, which no longer does the configuration autobackup. The only way to retain your configuration between firmware updates is to use the System -> Backup / Flash Firmware webui and leave the "Keep settings" box checked.

From LinkMeter v7 to v13, your OpenWrt configuration is automatically backed up on every successful boot. When a fresh default image is flashed to the SD card, using Win32DiskImager or dd, configuration is restored from this area to return your configuration.

Where is it stored?

The /etc/init.d/config_restore script creates a new 64MB partition (partition 4) at the end of your SD card. This partition is mounted and the system is backed up to /mnt/mmcblk0p4/backup.tar.gz.

How often is it stored?

The backup is created near the end of every boot. If you make any configuration changes, be sure to boot OpenWrt with these changes at least once before reimaging (i.e. don't change configuration and the image in a single boot)

How do I prevent config restoration?

If you've messed up your configuration so badly that your device become inaccessible, you probably don't want that configuration restored when you reflash the SD card. To prevent the restore operation, add the flag norestore to the kernel command line (Requires LinkMeter v8 or above). This can be done after flashing the SD card, eject the card, then reinsert it and you should see a small FAT filesystem which contains a cmdline.txt file. Open this in any text editor and append norestore to the existing line:

dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait norestore

Configuration backup will still occur when the norestore option is specified on the command line.

How do reset my configuration to default?

If the HeaterMeter is communicating with the LinkMeter service, use the buttons on the device to navigate to the "Reset Config?" item and select "Yes". The HeaterMeter will reset its configuration immediately, and the display will indicate that the LinkMeter side is resetting its configuration as well. This will wipe both configurations to their default.

If you have access to the webui and want to just reset the LinkMeter/OpenWrt side (network configuration and such), navigate in the webui to System -> Backup/Flash Firmware. Flash the firmware image again with the "Keep settings" box unchecked.

How does my configuration survive getting wiped by the disk imager?

When a default image is flashed, the partition table (the first 512 bytes of the device) is reset to the original state. However, the data is still there because the disk imaging utility only writes to the first ~40MB. On any boot where there isn't a partition 4 defined, the config_restore script will create one exactly 64MB from the end of the device and attempt to check the filesystem located there. If the check succeeds, and there's a backup.tar.gz there, then this configuration will be restored and OpenWrt will reboot.

What if my SD card is from the 1970s and isn't large enough to hold an additional 64MB?

The partition will only be created if there is at least 64MB of sectors on the device

I've extended my ext4 partition to the end of the device already, will it be overwritten?

The partition creation script will only create a partition if there's not already a partition which extends to the end of the device.

I've booted a fresh flash and it doesn't look to be doing anything

There's nothing output to the screen between the ethernet initialization and the configuration backup/restore, which is about a minute long on a first boot. If you've waited 2 minutes and nothing has happened, odds are nothing will. (shrug)

What files are backed up?

The same files you get when you do a backup from the web interface. This includes network and mail server configuration, ssh keys, user password, and linkmeter alarm scripts.


What about my LinkMeter database stash!

The stash data files are not included in the backup. It is safe for you to move your stashpath to the safe partition by moving your rrd files to a directory under /mnt/mmcblk0p4/ for example /mnt/mmcblk0p4/stash. Then set the linkmeter stashpath to that directory. This is the default under LinkMeter v8 and above.

uci set lucid.linkmeter.stashpath=/mnt/mmcblk0p4/stash
uci commit lucid
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.