<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="华为全shell光猫备份分区脚本">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">admin</a><br />时间:2017-10-21 09:06<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">电脑技术</a><br />内容:
华为全shell光猫备份分区脚本


用笔记本直连光猫，并下载运行一个tftp服务，把下面的tftpsvr-ip换成你自己电脑的ip，欢迎各位使用并分享自己的分区造福网友。

1.telnet登录光猫，用户root ，密码adminHW,
Login:root
Password:
WAP&gt;su
success!
SU_WAP&gt;shell

BusyBox v1.18.4 (2017-06-30 17:46:01 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
profile close core dump
WAP(Dopra Linux) #

2.执行以下脚本
#!/bin/sh
for i in `cat /proc/mtd|awk '{print $1}'|sed -n '2,$p'| sed 's/://g'`;
do
dd if=/dev/$i of=/tmp/$i.bin ;
done
cd /tmp
cat /proc/mtd &gt; mtd.log
tar czvf fw.tar.gz *.bin mtd.log
tftp -p -l fw.tar.gz tftpsvr-ip
rm -f  fw.tar.gz *.bin


登陆后执行vi  backup.sh 创建一个脚本文件
按i键 进入编辑模式
复制粘贴上面的脚本
按esc键 退出编辑模式
输入:wq 保存
执行chmod u+x backup.sh
./backup.sh
</p><p>
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
