These are my notes while testing.
Ubuntu LTS 10.04 doesn't support removing btrfs snapshots. It can be fixed by installing newer btrfs.
cd /tmp
wget "http://se.archive.ubuntu.com/ubuntu/pool/main/b/btrfs-tools/btrfs-tools_0.19+20100601-3ubuntu3_i386.deb"
dpkg -i btrfs-tools_0.19+20100601-3ubuntu3_i386.deb
mkdir -p /flash/disk0
cd /flash/disk0
git init
echo 'This is a test file.' > test.txt
git add test.txt
git commit -a -m 'Added initial test data.'
mkdir /ramdisks
mount -t tmpfs tmpfs /ramdisks
mkdir /ramdisks/raw /ramdisks/mnt
dd if=/dev/zero of=/ramdisks/raw/disk0 bs=1M count=256
mkfs.btrfs /ramdisks/raw/disk0
mount -o loop /ramdisks/raw/disk0 /ramdisks/mnt/disk0
git clone /flash/disk0 /ramdisks/mnt/disk0/data
btrfsctl -s /ramdisks/mnt/disk0/snapshot/disk0-20120124-2149 /ramdisks/mnt/disk0/data
cd /ramdisks/mnt/disk0/snapshot && btrfsctl -D disk0-20120124-2149 . && cd -
For some strange reason this doesn't work:
# btrfsctl -D /ramdisks/mnt/disk0/snapshot/disk0-20120124-2149 /ramdisks/mnt/disk0/snapshot
ioctl:: Invalid argument
...or any of these -- although these are probably wrong anyway:
# btrfsctl -D disk0-20120124-2149 /ramdisks/mnt/disk0/data
ioctl:: No such file or directory
# btrfsctl -D /ramdisks/mnt/disk0/snapshot/disk0-20120124-2149 /ramdisks/mnt/disk0/data
ioctl:: Invalid argument
# btrfsctl -D disk0-20120124-2149 /ramdisks/mnt/disk0/snapshot
ioctl:: No such file or directory
# time ./transaction-test.sh
Commit successful.
real 0m0.220s
user 0m0.112s
sys 0m0.072s
I am running these tests on a VIA ARTiGO A2000 Storage Server which has a VIA C7-D processor.
# cat /proc/cpuinfo
processor : 0
vendor_id : CentaurHauls
cpu family : 6
model : 13
model name : VIA C7-D Processor 1500MHz
stepping : 0
cpu MHz : 1499.885
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge cmov pat clflush acpi mmx fxsr sse sse2 tm nx up pni xtpr rng rng_en ace ace_en ace2 ace2_en phe phe_en pmm pmm_en
bogomips : 2999.77
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 32 bits virtual
power management:
This machine has 1 GB 800 MHz DDR-2 RAM.