在Amazon Glacier中存储本地加密的增量ZFS快照

Tin*_*ank 2 linux encryption zfs amazon-s3 amazon-glacier

为了真正实现我的ZFS池的异地和持久备份,我想在Amazon Glacier中存储zfs快照.数据需要在本地加密,独立于亚马逊,以确保隐私.我怎么能做到这一点?

Tin*_*ank 7

可以将现有快照发送到S3存储桶,如下所示:

zfs send -R <pool name>@<snapshot name> | gzip | gpg --no-use-agent  --no-tty --passphrase-file ./passphrase -c - | aws s3 cp - s3://<bucketname>/<filename>.zfs.gz.gpg
Run Code Online (Sandbox Code Playgroud)

或者用于增量备份:

zfs send -R -I <pool name>@<snapshot to do incremental backup from> <pool name>@<snapshot name> | gzip | gpg --no-use-agent  --no-tty --passphrase-file ./passphrase -c - | aws s3 cp - s3://<bucketname>/<filename>.zfs.gz.gpg
Run Code Online (Sandbox Code Playgroud)

此命令将获取现有快照,使用zfs send序列化它,压缩它,并使用带gpg的密码加密它.密码必须在./passphrase文件的第一行可读.

请记住在多个位置单独备份密码短语文件! - 如果您无法访问它,您将永远无法再次访问您的数据!

这需要:

  • 预先创建的亚马逊s3存储桶
  • awscli installed(pip install awscli)和configured(aws configure).
  • 安装了gpg

最后,S3生命周期规则可用于在预设的时间(或立即)之后将S3对象转换为冰川.


恢复:

aws s3 cp s3://<bucketname>/<filename>.zfs.gz.gpg - | gpg --no-use-agent --passphrase-file ./passphrase -d - | gunzip | sudo zfs receive <new dataset name> 
Run Code Online (Sandbox Code Playgroud)