Skip to content

Instantly share code, notes, and snippets.

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

@xandr0s
xandr0s / bashcheck
Created September 29, 2014 07:26
test script for shellshocker and related vulnerabilities
#!/bin/bash
r=`x="() { :; }; echo x" bash -c ""`
if [ -n "$r" ]; then
echo -e '\033[91mVulnerable to CVE-2014-6271 (original shellshock)\033[39m'
else
echo -e '\033[92mNot vulnerable to CVE-2014-6271 (original shellshock)\033[39m'
fi
cd /tmp;rm echo 2>/dev/null
@xandr0s
xandr0s / vhost_creater.sh
Created September 27, 2014 15:34
Bash-скрипт для автоматического создания виртуальных хостов Nginx+Apache2
#!/bin/bash
####### CONFIG START ########
OWNER_NAME='root' # Пользователь, которому будет принадлежать директория вирт. хоста
OWNER_GROUP='root' # Группа, которой будет принадлежать директория вирт. хоста
HOME_WWW=/sites # Домашняя директория для вирт. хостов
HOST_DIRS=('logs' 'www')
SERVER_IP='127.0.0.1' # IP адрес сервера
@xandr0s
xandr0s / command to run
Created August 16, 2014 10:53
Dig NS domains from input file
sh digIt.sh input.txt > result.txt
@xandr0s
xandr0s / zabbix_agentd.conf
Created May 8, 2014 10:06
Config Zabbix-agent on OpenWRT router/AP
LogFile=/tmp/zabbix_agentd.log
Server=1.2.3.4
ServerActive=1.2.3.4
Hostname=Zabbix server
# wifi interface discovery
# exemple: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]}
#
UserParameter=wifi.ifdiscovery,lua -l uci -l iwinfo -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("wireless", "wifi-iface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#MODE}\":\""..s.mode.."\", \"{#SSID}\":\""..s.ssid.."\", \"{#NET}\":\""..s.network.."\", \"{#DEV}\":\""..s.device.."\", \"{#ENC}\":\""..(s.encryption or "?").."\", \"{#TYPE}\":\""..x:get("wireless",s.device,"type").."\", \"{#HWMODE}\":\""..(x:get("wireless",s.device,"hwmode") or "?").."\", \"{#CHANNEL}\":\""..x:get("wireless",s.device,"channel").."\", \"{#BSSID}\":\""..iwinfo[iwinfo.type(s.ifname)].bssid(s.ifname).."\"}," end); list=string.gsub(list,",$",""); print(li