当前位置: 首页 > 科技观察

GitHubstars14K!程序员必备的开源备份工具

时间:2023-03-11 22:47:28 科技观察

备份软件,已经是老生常谈了。今天猿娘就给大家分享一个备份工具——restic。Restic是一种快速、高效、免费的开源备份应用程序,它使用AES-256加密保护您的数据。Restic还利用重复数据删除来帮助节省备份空间。此外,Restic与大多数主要云提供商兼容,支持三大操作系统(Linux、macOS、Windows)和一些较小的操作系统(FreeBSD、OpenBSD)。目前,Restic在Github上已经star了14.6K,共计999个分支(Github地址:https://github.com/restic/restic)首先,可以从源码编译restic,也可以从发布页面下载。一旦安装好restic,就可以开始备份:$resticinit--repo/tmp/backupenterpasswordfornewbackend:enterpasswordagain:createdresticbackend085b3c76b9at/tmp/backupPleasenotethatknowledgeofyourpasswordisrequiredtoaccesstherepository.Losingyourpasswordmeansthatyourdataisirrecoverablylost.并添加一些数据:$restic--repo/tmp/backupbackup~/workenterpasswordforrepository:scan[/home/user/work]scanned764directories,1816filesin0:00[0:29]100.00%54.732MiB/s1.582GiB/1.582GiB2580/2580items0errorsETA0:00duration:0:29,54.47MiB/ssnapshot40dc1520restoreresavedStore下一个文件,可以使用要获取所有备份快照的列表,可以使用以下命令:restic-rb2:bucketname:/snapshots例如:$restic-rb2:g534fbucket:/snapshotsenterpasswordforrepository:IDDateHostTagsDirectory----------------------------------------------------------------d864c4652018-03-2715:20:42client/home/curt/Documents如果要恢复整个快照,运行以下命令:restic-rb2:bucketname:/restoresnapshotID--targetrestoreDirectory示例:$restic-rb2:g534fbucket:/restored864c465--target~enterpasswordforrepository:re将存储到/home/curt如果您的系统上仍然存在此目录,请确保为restoreDirectory指定不同的位置,例如:restic-rb2:g534fbucket:/restored864c465--target/tmp要恢复单个文件,运行以下命令:$restic-rb2:g534fbucket:/restoresnapshotID--targetrestoreDirectory--includefilename例如:$restic-rb2:g534fbucket:/restored864c465--target/tmp--includefile1.txtenterpasswordforrepository:restoring到/tmp