timeshift 系统快照备份
timeshift 支持ubuntu ,debian系统
安装timeshift
sudo apt-add-repository -y ppa:teejee2008/ppasudo
apt-get updatesudo
apt-get install timeshift
安装报错ValueError: SSL support not available
处理方法:安装ssl
sudo apt-get install openssl
sudo apt-get install libssl-dev
命令行详解:
Syntax:timeshift --check
timeshift --create [OPTIONS]
timeshift --restore [OPTIONS]
timeshift --delete-[all] [OPTIONS]
timeshift --list-{snapshots|devices} [OPTIONS]
Options:
List:
--list[-snapshots] List snapshots
--list-devices List devices
Backup:
--check Create snapshot if scheduled
--create Create snapshot (even if not scheduled)
--comments <string> Set snapshot description
--tags {O,B,H,D,W,M} Add tags to snapshot (default: O)
Restore:
--restore Restore snapshot
--clone Clone current system
--snapshot <name> Specify snapshot to restore
--target[-device] <device> Specify target device
--grub[-device] <device> Specify device for installing GRUB2 bootloader
--skip-grub Skip GRUB2 reinstall
Delete:
--delete Delete snapshot
--delete-all Delete all snapshots
创建实列:
root@ubuntu:~# timeshift --create
Select backup device:
Num Device Size Type Label
------------------------------------------------------------------------------
0 > /dev/sda1 20.0 GB ext4
1 > /dev/sdb1 21.0 GB ext4 #提前准备好一个ext4的盘,作为备份盘
Enter device name or number (a=Abort): 1
------------------------------------------------------------------------------
Estimating system size...
Creating new snapshot...(RSYNC)
Saving to device: /dev/sdb1, mounted at path: /mnt/nfs
Synching files with rsync...
Created control file: /mnt/nfs/timeshift/snapshots/2021-04-21_02-21-42/info.json
RSYNC Snapshot saved successfully (231s)
Tagged snapshot '2021-04-21_02-21-42': ondemand
------------------------------------------------------------------------------
root@ubuntu:~#ls timeshift/snapshots/2021-04-21_02-21-42/localhost/
bin dev home lib media opt root sbin sys tmp var
boot etc initrd.img lib64 mnt proc run srv timeshift usr vmlinuz
恢复实例:
#timeshift --list
#timeshift --restore --snapshot ‘2021-04-21 02-21-42’
#备份
$ timeshift --create --rsync //使用RSYNC创建一个增量备份
$ timeshift --create --btrfs //使用BTRFS创建一个子分区备份
$ timeshift --create //如果不定义--rsync或--btrfs参数timeshift会按照配置进行选择
//也可以自定义备份分区以及路径
$ timeshift --create --target /dev/sda1
$ timeshift --create --target ~/backup
$ timeshift --create --comments "comments" --tags {B,H,D,W,M} //也可以对备份文件输入标签
#恢复
$ timeshift --list //列出所有备份
$ timeshift --list --snapshot-device /dev/sda1 //列出特定分区的备份
$ timeshift --restore --snapshot 'snapshot-name' --target /dev/sda1 //选择特定备份恢复到指定分区
#删除备份文件
$ timeshift --delete //列出所有备份文件并选择进行删除
$ timeshift --delete --snapshot 'snapshot-name' //删除特定备份
评论