3 pool=`zfs list -H -o name | head -1` # use first pool as target for zvol
4 ganeti_export=/var/lib/ganeti/export
8 #vol_opt="-b 4k -s -o compression=lz4"
11 zfs list -r $pool/block
13 # test ! -z "/mnt/*" && df -h /mnt/* | grep -v aufs
15 du -hcs $ganeti_export/* | cut -d/ -f1,6 | sed 's,/,,'
21 umount /mnt/$instance || true
22 zfs destroy $pool/block/$instance || true
24 zfs create -V $size $vol_opt $pool/block/$instance
26 test -d /mnt/$instance || mkdir /mnt/$instance
29 echo -n "waiting for $1 "
30 while [ ! -e $1 ] ; do
37 wait_for /dev/zvol/$pool/block/$instance
39 label=`echo $instance | cut -d. -f1`
40 echo "label $label = $instance"
42 time mkfs.ext4 -m 0 -L $label /dev/zvol/$pool/block/$instance
44 wait_for /dev/disk/by-label/$label
46 mount /dev/disk/by-label/$label /mnt/$instance/
48 dump=`ls $ganeti_export/$instance/*.disk0*.snap`
50 zpool iostat 2 | tee /dev/shm/$instance &
52 ( while true; do zfs list $pool/block/$instance ; sleep 10 ; done ) &
58 wc -l /dev/shm/$instance