Created
July 2, 2015 15:42
-
-
Save mikemccracken/f5e2a42cedb79c6129f3 to your computer and use it in GitHub Desktop.
Test for scalability of creating thin snapshots of a thin LV containing a rootfs
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
#!/bin/bash | |
NUM_LVS=200 | |
mkdir -p test-mounts | |
loop_count=0 | |
while true; do | |
[ $loop_count -ge $NUM_LVS ] && break; | |
echo "Creating lv $loop_count" | |
start=$(date +%s) | |
sudo lvcreate -kn -n "test-lv-$loop_count" -s /dev/mantest_vg/04aac4257341478b49c25d22cea8a6ce0489dc6c42d835367945e7596368a37f || { echo "Failure to create # $loop_count"; break;} | |
# step 2: | |
echo "Activating" | |
sudo lvchange -ay "/dev/mantest_vg/test-lv-$loop_count" | |
#step 3: | |
echo "Mounting" | |
mkdir -p "test-mounts/test-lv-$loop_count" | |
sudo mount "/dev/mantest_vg/test-lv-$loop_count" "test-mounts/test-lv-$loop_count" | |
# step 4: | |
echo "Writing something" | |
echo "$loop_count" > "test-mounts/test-lv-$loop_count/rootfs/home/ubuntu/$loop_count.txt" | |
end=$(date +%s) | |
elapsed=$(($end - $start)) | |
echo "Created lv $loop_count in $elapsed" | |
loop_count=$(($loop_count + 1)) | |
done | |
read -p "waiting" x | |
while true; do | |
loop_count=$(($loop_count - 1)) | |
[ $loop_count -eq -1 ] && break; | |
echo "Removing test-lv-$loop_count" | |
sudo umount "test-mounts/test-lv-$loop_count" | |
sudo lvremove -f "mantest_vg/test-lv-$loop_count" || break; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my testing, this runs on a NUC, the mantest_vg volumegroup contains one PV, an external USB drive.
The volume /dev/mantest-vg/04aac4257341478b49c25d22cea8a6ce0489dc6c42d835367945e7596368a37f is an untarred LXD image on an ext4 fs.
The thin pool that the original volume is in is 1t in size.
This runs with no problems up to 200 containers (haven't bothered testing higher). Each container takes about 1-2 seconds with basically no deviations