Created
February 4, 2014 09:15
-
-
Save zahradil/8800421 to your computer and use it in GitHub Desktop.
btrfs: how to use and create snapshotable btrfs volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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