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