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
| server { | |
| listen 80; | |
| server_name backend; | |
| root /usr/share/nginx/www; | |
| index index.html index.html; | |
| location / { | |
| header_filter_by_lua ' |
| #!/bin/bash | |
| # | |
| # Copyright (c) 2015, Intel Corporation | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # | |
| # * Redistributions of source code must retain the above copyright notice, | |
| # this list of conditions and the following disclaimer. | |
| # * Redistributions in binary form must reproduce the above copyright |
| hdparm --user-master u --security-set-pass PasSWorD /dev/sdX | |
| hdparm --user-master u --security-erase PasSWorD /dev/sdX |
| # Heavily depends on: | |
| # libqrencode (fukuchi.org/works/qrencode/) | |
| # paperkey (jabberwocky.com/software/paperkey/) | |
| # zbar (zbar.sourceforge.net) | |
| # Producing the QR codes: | |
| # Split over 4 codes to ensure the data per image is not too large. | |
| gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp | |
| split temp -n 4 IMG | |
| for f in IMG*; do cat $f | qrencode -o $f.png; done |
| #!/usr/bin/env python | |
| """ | |
| LICENSE http://www.apache.org/licenses/LICENSE-2.0 | |
| """ | |
| import argparse | |
| import datetime | |
| import sys | |
| import time | |
| import threading |
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)| def power(base, exp): | |
| """ Fast power calculation using repeated squaring """ | |
| if exp < 0: | |
| return 1 / power(base, -exp) | |
| ans = 1 | |
| while exp: | |
| if exp & 1: | |
| ans *= base | |
| exp >>= 1 | |
| base *= base |
| # You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
| # This is how I upload my new Sol Trader builds (http://soltrader.net) | |
| # Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
| S3KEY="my aws key" | |
| S3SECRET="my aws secret" # pass these in | |
| function putS3 | |
| { | |
| path=$1 |
| * |