Skip to content

Instantly share code, notes, and snippets.

@zahradil
Created February 4, 2014 09:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zahradil/8800421 to your computer and use it in GitHub Desktop.
Save zahradil/8800421 to your computer and use it in GitHub Desktop.
btrfs: how to use and create snapshotable btrfs volume
sudo apt-get install btrfs-tools
sudo su
mkdir /data
cd /data
# create 500 MB file
dd if=/dev/zero of=/data/datadisk bs=1024 count=500000
# create btrfs
mkfs.btrfs -m single /data/datadisk
mkdir /mnt/datadisk
mount /data/datadisk /mnt/datadisk
# filesystem is mounted now
# create subvolume for data
btrfs subvolume create /mnt/datadisk/mydata
# store same data now to mydata
# create read-only snapshot
btrfs subvolume snapshot /mnt/datadisk/mydata /mnt/datadisk/snapshot-1 -r
# Additional commands:
# ====================
# list subvolumes (+snapshots)
btrfs subvolume list /mnt/datadisk
# delete snapshost:
btrfs subvolume delete /mnt/datadisk/snapshot-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment