This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.
Step 1 - Enable NBD on the Host
modprobe nbd max_part=8
| upstream myapp { | |
| server 127.0.0.1:8081; | |
| } | |
| limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
| server { | |
| listen 443 ssl spdy; | |
| server_name _; | |
Find orphaned objects
rados ls -p <POOLNAME> | grep -vE "($(rados -p <POOLNAME> ls | grep rbd_header | grep -o "\.[0-9a-f]*" | sed -e :a -e '$!N; s/\n/|/; ta' -e 's/\./\\./g'))" | grep -E '(rbd_data|journal|rbd_object_map)'Select inconsistent PG's and uniq them per OSD
# This output can be used to semi-automate `ceph pg repair` and not do a pg repair on duplicate primary OSDs
ceph pg dump --format json | jq -r '.pg_stats[] | select(.state | contains("active+clean+inconsistent")) | "\(.acting_primary)\t\(.pgid)\t\(.state)"' | sort -k1 | uniq -w4 | awk '{print $2}'Wipe the start and end of a block device
# Change /dev/SDX on 3 places to the correct block device
# DANGER!!! THIS WILL WIPE EVERYTHING OF THE BLOCK DEVICE
dd if=/dev/zero of=/dev/SDX bs=1M count=1024
dd if=/dev/zero of=/dev/SDX bs=512 seek=$(( $(blockdev --getsz /dev/SDX) - 8192 )) count=8192| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
Filter volumes per availability zone
# Using openstack-cli with jq (Since openstack-cli isn't able to filter or show the az)
AZ="zone" ; for volume_id in $(openstack volume list -fvalue --quote=none --all-projects --sort-column=ID -cID); do openstack volume show -fjson "${volume_id}" | jq -r '. | select(.availability_zone == "'"${AZ}"'") | "\(.id)"'; done
# Using cinder-cli which has the option to show the az, but can't filter if using volumev2
AZ="zone" ; cinder --os-volume-api-version=2 list --all-tenants --sort id:asc --fields id,availability_zone | grep "${AZ}" | awk '{print $2}'
# Get all instance ID's which are using an ephemeral image
openstack server list --all-projects --limit -1 --no-name-lookup --sort-column ID -fjson | jq -r '.[] | select(.Image != "") | "\(.ID)"'Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:
Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.
Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.
Instructions provided for both Fedora and Ubuntu (including Debian):
Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:
| #!/bin/sh | |
| # This script runs every other night at 04:56 CET on a webserver I maintain | |
| # Results are always at: https://jult.net/block.txt ( or https://jult.net/block.txt.gz ) | |
| # And much smaller, stripped of BS; https://jult.net/bloc.txt | |
| # For use in Tixati IP filter: https://jult.net/bloc.txt.gz !!! | |
| # And finally a txt file with just the bold IP-ranges: https://jult.net/bl.txt (or https://jult.net/bl.txt.gz ) | |
| # Download open block-lists, unpack, filter: | |
| curl -s https://www.iblocklist.com/lists.php | grep -A 2 Bluetack | xargs wget -qO - --limit-rate=500k | gunzip -f | egrep -v '^#' > /tmp/xbp |
rsync (Everyone seems to like -z, but it is much slower for me)
| #Workaround for 'Subnet matching query does not exist' error trying to delete a subnet in MaaS | |
| #See bug https://bugs.launchpad.net/maas/+bug/1702527 | |
| #Usage force-del-maas-subnet <maas subnet name> | |
| #ex force-del-maas-subnet '192.168.122.0/24' | |
| force-del-maas-subnet() { | |
| unset SN_NAME MAAS_SN_ID MAAS_STATICIP_ID MAAS_INTIP_ID MATCH CONT | |
| export MATCH=false | |
| command -v ipcalc > /dev/null 2>&1 || sudo apt install -yq ipcalc | |
| command -v ipcalc > /dev/null 2>&1 || { printf "This function requires ipcalc. Please install it via \"apt install ipcalc -y\"\n";return; } | |