ubuntu的备份和还原

时间:2021-12-18 10:20:00

dd

备份mbr


dd if=/dev/sda of=/backup/mbr.img bs=512 count=1

 还原mbr


dd if=/backup/mbr.img of=/dev/sda bs=446 count=1

还原分区表,跳过主引导记录


dd if=/backup/mbr.img of=/dev/sda bs=1 count=64 skip=446 seek=446

 GNU/TAR

备份


tar -cpzvf backup.tar.gz /media/usb/*

 

  
 
 
  1. tar -cvpzf /backup/backuptest.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys --exclude=/media / 

 还原

 

  
 
 
  1. tar -xvpzf /backup/backuptest.tgz -C / 

cpio

dump/restore

xfsdump/xfsrestore

备份


sudo xfsdump - /boot > backup.file

 还原


sudo cat backup.file | xfsrestore - /boot