Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
umount /btrfs-filesystem || true
btrfs subvolume remove /btrfs-filesystem/source || true
btrfs subvolume remove /btrfs-filesystem/target || true
btrfs subvolume remove /btrfs-filesystem/snapshot || true
rm --recursive --force /btrfs-device /btrfs-filesystem
truncate --size 1GiB /btrfs-device
mkfs.btrfs /btrfs-device
mkdir /btrfs-filesystem
mount /btrfs-device /btrfs-filesystem
btrfs subvolume create /btrfs-filesystem/source
btrfs subvolume create /btrfs-filesystem/target
touch /btrfs-filesystem/source/cow
touch /btrfs-filesystem/source/nocow
chattr +C /btrfs-filesystem/source/nocow
btrfs subvolume snapshot -r /btrfs-filesystem/source /btrfs-filesystem/snapshot
cp --reflink=always /btrfs-filesystem/snapshot/cow /btrfs-filesystem/target
cp --reflink=always /btrfs-filesystem/snapshot/nocow /btrfs-filesystem/target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.