0%

Arch Linux 系统备份

使用 rsync

安装 rsync
1
sudo pacman -S rsync
备份
1
2
3
4
5
6
sudo rsync -aAXv --delete \
--exclude={/dev,/mnt,/proc,/run,/sys,/tmp,/var/tmp,/var/log}/* \
--exclude={Downloads,.cache,.Cache,cache,Cache,CachedData,GPUCache,ScriptCache,ShaderCache,'Code Cache',CachedExtensions,Backups,logs}/* \
--exclude={.log,Trash,lost+found,'Crash Reports',VirtualBox,swapfile,__pycache__,.venv,.DS_Store,_cacache,*_history,workspaceStorage} \
--exclude=*.{old,bak,tmp,backup} \
/ /path/to/backup
恢复
1
sudo rsync -aAXv /path/to/backup /

使用 tar

安装 tar
1
sudo pacman -S tar
备份
1
2
3
4
5
sudo tar -cvpzf /path/to/backup.tar.gz \
--exclude={/dev,/mnt,/proc,/run,/sys,/tmp,/var/tmp,/var/log}/* \
--exclude={Downloads,.cache,.Cache,cache,Cache,CachedData,GPUCache,ScriptCache,ShaderCache,'Code Cache',CachedExtensions,Backups,logs}/* \
--exclude={.log,Trash,lost+found,'Crash Reports',VirtualBox,swapfile,__pycache__,.venv,.DS_Store,_cacache,*_history,workspaceStorage} \
--exclude=*.{old,bak,tmp,backup} /
恢复
1
sudo tar --numeric-owner -xvpzf /path/to/backup.tar.gz -C /

使用 timeshift

安装 timeshift
1
sudo pacman -S timeshift rsync

timeshift 是图形界面的备份工具,简单易用,可以方便地把整个系统备份到移动硬盘上。