Btrfs
跳到导航
跳到搜索
备份
dosnap 可用于定时备份。
备份到移动硬盘:
sudo btrfs send -p /mnt/_snapshots/%home/{2021-04-30T23-00-57-auto,2021-05-09T23-00-01-auto} | pv |
sudo btrfs receive /path/to/backupdrive/home
相关程序
以下是一些好用的 Btrfs 相关的程序。
compsize
查看 /
的压缩类型和压缩前后的大小
sudo compsize /
btrfs-heatmap
查看 /mountpoint
的 heatmap
sudo btrfs-heatmap /mountpoint
btrfs-list
查看树形的 snapshot 列表
sudo btrfs quota enable /
# 等待 quota rescan
sudo btrfs-list
sudo btrfs quota disable /
btrfs-diff
查看第二个 subvolume 相对于第一个改变的文件
sudo btrfs-diff /mnt/_snapshots/%home/snap /mnt/@home
脚本如下(拷贝自 https://serverfault.com/a/580264)
set -eu
usage() {
echo "Usage: $0 <older-snapshot> <newer-snapshot>" >&2
exit 1
}
[ $# -eq 2 ] || usage "Incorrect invocation"
snapshot_old=$1
snapshot_new=$2
[ -d "$snapshot_old" ] || usage "$snapshot_old does not exist"
[ -d "$snapshot_new" ] || usage "$snapshot_new does not exist"
old_transid=$(btrfs subvolume find-new "$snapshot_old" 9999999)
old_transid=${old_transid#transid marker was }
[ "$old_transid" -gt 0 ] || usage "Failed to find generation for $snapshot_new"
btrfs subvolume find-new "$snapshot_new" "$old_transid" | sed '$d' | cut -f17- -d' ' | sort | uniq