首页 > 代码库 > shell dd备份系统
shell dd备份系统
备份MBR、根分区、Boot分区
#!/bin/bash
Bak_dir=/mnt #已挂载的移动硬盘或其他外设
Mbr=`fdisk -l |grep "Disk" |awk NR==1‘{print $2}‘ |awk -F"/" ‘{print $3}‘|sed s/://g`
Root=`df |awk ‘/\//{print $1}‘ |awk NR==1‘{print $1}‘`
Boot=`df |awk ‘/\/boot/{print $1}‘`
### Backup MBR
dd if=/dev/$Mbr of=$Bak_dir/mbr.img bs=512 count=1
### Backup Root [/]
dd if=$Root |gzip >$Bak_dir/root.img.gz
### Backup Boot [/boot]
dd if=$Boot |gzip >$Bak_dir/boot.img.gz
shell dd备份系统
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。