Adding Lots of Storage Pools to Libvirt

I do not enjoy having subdirectories involved for storing files in libvert. The virt-manager interface is just way too brutal about how you manually add storage pools. After much ranting, I wrote a bash script to add these directories for my VM disk images.

  1 #!/bin/bash
  2 
  3 set -e
  4 #set -x
  5 existing_pools=()
  6 export existing_pools
  7 
  8 function add_this_dir() {
  9     local -n xisting_pools="$1"
 10     if [ ! -d "$2" ]; then
 11       echo "add_this_dir: $2 is not a directory"
 12       return
 13     fi
 14     local shortname=`basename $2`
 15     if [[ " ${xisting_pools[@]} " =~ " $2 " ]]; then
 16       echo "$2 already exists"
 17       sudo virsh pool-start "$shortname"  &>/dev/null ||:
 18       sudo virsh pool-autostart "$shortname"  &>/dev/null ||:
 19       return
 20     fi
 21     if [[ " ${xisting_pools[@]} " =~ " $shortname " ]]; then
 22       echo "$shortname already exists"
 23       sudo virsh pool-start "$shortname" &>/dev/null ||:
 24       sudo virsh pool-autostart "$shortname" &>/dev/null  ||:
 25       return
 26     fi
 27     sudo virsh pool-define-as --name $shortname --type dir --target "$2" --source-path "$2"
 28     sleep 1
 29     sudo virsh pool-start "$shortname" &>/dev/null ||:
 30     sudo virsh pool-autostart "$shortname"  &>/dev/null ||:
 31     sleep 1
 32 }
 33 
 34 while read L; do
 35   if [[ x$L = x ]]; then continue; fi
 36   hunks=($L) 
 37   existing_pools+=("${hunks[0]}")
 38 done < <(sudo virsh pool-list --all | grep -v -e Autostart -e '----' )
 39 
 40 echo "You have these existing pools defined: "
 41 echo "%%${existing_pools[@]}%%"
 42 
 43 while read D; do
 44   add_this_dir existing_pools "/tank/VMs/$D"
 45 done < <(ls /tank/VMs) 
 46 while read D; do
 47   add_this_dir existing_pools "/tank/softlib/iso/$D"
 48 done < <(ls /tank/softlib/iso)

 

Replacing a loud fan in my home ZFS NAS

The blue-LED fan I have in my ZFS on Linux NAS is a bit louder than the other fans that I’ve been hoping for. I am going to replace it with a 600rpm fan.

image

 

You will notice that I have drilled extra ventilation into the top case panel.

image

 

Notice the clear-plastic fan. It is held in with zip ties.

image

Zip tied those SAS cables to tidy them up.

image

See the 140mm low profile fan on the cpu? Pretty quiet. 120mm 600 rpm exit fan.

image

Let’s snip some zippies!

image

image

image

Getting the fan power connected is always a chore. My fingers are almost too big.

image

image

 

Fan is now attached and power cables are managed well enough.

image

Trim it up.

image

Plenty of inlet.

image

 

Now I put it up on it’s shelf and get it plugged in.

image

and there’s a power switch at the farthest point back there.

image

Alright. Powered up and out of the way.

image

Replacing a Four Drives at Once

I would not have considered this tactic possible, but then I’ve often come from small raid setups or hardware raid setups that are unlikely to want to replace multiple disks at a time. Replacing four at a time!

Replacing four bad drives at once.

Replacing four bad drives at once.

Recommendations for #Linux storage server?

I’ve got an embedded 800mhz Via system that I’m going to retrofit with a 2TB drive for catching backups. I used to run CentOS 3.5 on there but those days are long gone. I’d rather run a rolling distro…Debian…Arch. I will likely also retrofit it with a CF adapter for the boot device. Likely I will use it for a caching DNS server, and if I have resources left over, maybe some Squid caching for the household as well. What would you recommend?