OpenWrt 自定义备份文件

1、openwrt的生成备份会自动下载一个文件:backup-hostname-date.tar.gz

其中压缩文件.tar.gz中包含的内容有:  lib/upgrade/keep.d/ 目录下文件中所有的内容以及  etc/sysupgrade.conf中包含的内容

主要有:

root@hbg:/# cd lib/upgrade/keep.d/
root@hbg:/lib/upgrade/keep.d# ls
base-files            uboot-envtools
base-files-essential  uhttpd
root@hbg:/lib/upgrade/keep.d# cat base-files
/etc/config/            --config目录下所有文件
/etc/dropbear/       --dropbear目录下所有文件
/etc/crontabs/        --crontabs目录下所有文件
root@hbg:/lib/upgrade/keep.d# cat base-files-essential   
# Essential files that will be always kept
/etc/hosts              --etc目录下的这些文件
/etc/inittab
/etc/group
/etc/passwd
/etc/profile
/etc/shadow
/etc/shells
/etc/sysctl.conf
/etc/rc.local
root@hbg:/lib/upgrade/keep.d# cat uboot-envtools
/etc/config/ubootenv    --uboot相关文件
/etc/fw_env.config
root@hbg:/lib/upgrade/keep.d# cat uhttpd
/etc/uhttpd.crt                  --uhttpd相关文件
/etc/uhttpd.key

2、将备份的压缩文件解压后可以看到

hbg@root:~/test1214/A3$ tar zxvf backup-openwrt-2016-01-19.tar.gz
etc/config/account
etc/config/checkrssi
etc/config/dropbear
etc/config/firewall
etc/config/link.log
etc/config/lldpd
etc/config/luci
etc/config/mcs
etc/config/network
etc/config/snmpd
etc/config/snmpdata
etc/config/system
etc/config/ubootenv
etc/config/ucitrack
etc/config/uhttpd
etc/config/wireless
etc/config/wonoff
etc/crontabs/cron.update
etc/crontabs/root
etc/dropbear/dropbear_dss_host_key
etc/dropbear/dropbear_rsa_host_key
etc/fw_env.config
etc/group
etc/hosts
etc/inittab
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
etc/sysupgrade.conf
etc/uhttpd.crt
etc/uhttpd.key

3、如果还想备份其他文件,可以在/etc目录下的sysupgrade.conf中添加相应目录或文件。

如果在sysupgrade.conf中添加 /overlay目录则:

root@hbg:/etc# cat sysupgrade.conf
## This file contains files and directories that should
## be preserved during an upgrade.

# /etc/example.conf
# /etc/openvpn/
/overlay     --将overlay目录下的文件压缩到备份中

解压备份文件可得

hbg@root:~/test1214/A3$ tar zxvf backup-openwrt-2016-01-19.tar.gz
etc/config/account
etc/config/checkrssi
etc/config/dropbear
etc/config/firewall
etc/config/link.log
etc/config/lldpd
etc/config/luci
etc/config/mcs
etc/config/network
etc/config/snmpd
etc/config/snmpdata
etc/config/system
etc/config/ubootenv
etc/config/ucitrack
etc/config/uhttpd
etc/config/wireless
etc/config/wonoff
etc/crontabs/cron.update
etc/crontabs/root
etc/dropbear/dropbear_dss_host_key
etc/dropbear/dropbear_rsa_host_key
etc/fw_env.config
etc/group
etc/hosts
etc/inittab
etc/passwd
etc/profile
etc/rc.local
etc/shadow
etc/shells
etc/sysctl.conf
etc/sysupgrade.conf
etc/uhttpd.crt
etc/uhttpd.key
overlay/etc/config/account
overlay/etc/config/checkrssi
overlay/etc/config/dropbear
overlay/etc/config/firewall
overlay/etc/config/link.log
overlay/etc/config/lldpd
overlay/etc/config/luci
overlay/etc/config/mcs
overlay/etc/config/network
overlay/etc/config/snmpd
overlay/etc/config/snmpdata
overlay/etc/config/system
overlay/etc/config/ubootenv
overlay/etc/config/ucitrack
overlay/etc/config/uhttpd
overlay/etc/config/wireless
overlay/etc/config/wonoff
overlay/etc/crontabs/cron.update
overlay/etc/crontabs/root
overlay/etc/dropbear/dropbear_dss_host_key
overlay/etc/dropbear/dropbear_rsa_host_key
overlay/etc/fw_env.config
overlay/etc/group
overlay/etc/hosts
overlay/etc/inittab
overlay/etc/passwd
overlay/etc/profile
overlay/etc/rc.local
overlay/etc/shadow
overlay/etc/shells
overlay/etc/sysctl.conf
overlay/etc/sysupgrade.conf
overlay/etc/uhttpd.crt
overlay/etc/uhttpd.key
overlay/root/logs
overlay/usr/lib/snmp/snmpd.conf
etc/uhttpd.key
etc/uhttpd.crt

  

posted @ 2020-04-10 17:12  HiLuf  阅读(1996)  评论(0编辑  收藏  举报