Converting LXC to Proxmox LXC

# On LXC host
# lxc-stop -n lxc-testing
# qemu-img create -f raw vm-102-disk-1.raw 20G
# losetup /dev/loop0 vm-102-disk-1.raw 
# Create partition table (basically just start fdisk, press w and <enter>
# fdisk /dev/loop0
# mkfs.ext4 -F /dev/loop0
# mount /dev/loop0 /mnt/tmp/
# rsync -avP /var/lib/lxc/lxc-testing/rootfs/ /mnt/tmp/
# umount /mnt/tmp/
# losetup -d /dev/loop0
# rsync -vP --sparse vm-102-disk-1.raw pve:/mnt/lxc/images/102/
# On Proxmox host
# cd /etc/pve/lxc
# cp 101.conf 102.conf
# Edit config
# cat 102.conf 
arch: amd64
cores: 2
hostname: lxc-testing
memory: 2048
net0: name=eth0,bridge=vmbr0,hwaddr=FA:AA:BB:CC:AA:BB,ip=dhcp,ip6=dhcp,tag=41,type=veth
onboot: 1
ostype: debian
rootfs: ssd:102/vm-102-disk-1.raw,size=20G
swap: 2048

Upgrades for Lenovo W500

For anyone interested. It is possible to upgrade your aging Lenovo W500 to 802.11ac wifi, if you have flashed your BIOS without the whitelist. Upgrades I’ve done.

– WWAN F5521GW (Still 3G, but supposedly a bit faster than the original F3507g).
– WiFi Intel 7260 (this is a half hight mini-pcie card, so you need a extension plate).

intel amt/me debian

Endel Intel systemer idag kommer med vPro. Dette vil si at det er en slags billig iLO/iDRAC løsning integrert. Systemet jeg konfigurerte hadde en eldre versjon, som kun gir mulighet for å styre power samt konsoll over seriell. For oss er det mer enn godt nok for breakfix ved feil.

I korte trekk hva som må konfigureres.

1. IP på Intel ME firmware. Trykk F9? rett etter BIOS. I utgangspunktet kan Intel ME ligge på samme IP som host, og ta over trafikk på vei inn på maskinen. Av gammel vane liker jeg helst å separere denne trafikken helt.
2. Konfigurer grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet elevator=deadline console=ttyS2,115200n8"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --port=0xc000 --speed=115200 --word=8 --parity=no --stop=1"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Kort forklaring på “–port=0xc000”. Denne finner du ved å kjøre:

# dmesg |grep ttyS2 |grep irq
[ 0.527818] 0000:00:03.3: ttyS2 at I/O 0xc000 (irq = 17, base_baud = 115200) is a 16550A

Ser at det stemmer med

# lspci |grep KT
00:03.3 Serial controller: Intel Corporation 82Q35 Express Serial KT Controller (rev 02)

3. Konfigurer systemd med getty.

# systemctl enable serial-getty@ttyS2.service
# systemctl start serial-getty@ttyS2.service

4. Koble til med amttool / amtterm

# export AMT_PASSWORD=passw0rd
# amttool hostname
### AMT info on machine 'hostname' ###
AMT version: 3.2.3
Use of uninitialized value $domainname in printf at /bin/amttool line 244.
Hostname: hostname.
Powerstate: S0
Remote Control Capabilities:
IanaOemNumber 0
OemDefinedCapabilities IDER SOL BiosSetup
SpecialCommandsSupported PXE-boot HD-boot cd-boot
SystemCapabilitiesSupported powercycle powerdown powerup reset
SystemFirmwareCapabilities 0
# amtterm hostname
amtterm: NONE -> CONNECT (connection to host)
ipv4 hostname [] 16994 open
amtterm: CONNECT -> INIT (redirection initialization)
amtterm: INIT -> AUTH (session authentication)
amtterm: AUTH -> INIT_SOL (serial-over-lan initialization)
amtterm: INIT_SOL -> RUN_SOL (serial-over-lan active)
serial-over-lan redirection ok
connected now, use ^] to escape

Debian GNU/Linux 8 hostname ttyS2

hostname login:

Kan også nå web interface for å styre power, se på events osv på port 16992. eks


Utvide ZFS pool med ny RAIDZ VDEV

Rimelig rett frem, det vil riktignok ikke være noen rebalansering av data, så dette må en ta seg av selv. Fordelen er jo at kommandoen er ferdig på sekunder og plassen kan utnyttes umiddelbart.

Først kjørte jeg kommandoen med oppsjonen “-n” for å være sikker på at den var korrekt.

# zpool add -n tank raidz ata-HGST_HDN724040ALE640_PK1381PCJSZ50S-part4 ata-HGST_HDN724040ALE640_PK1381PCJT6EWS-part4 ata-HGST_HDN724040ALE640_PK1381PCK3N9DS-part4 ata-HGST_HDN724040ALE640_PK1381PCKZ840S-part4
would update 'tank' to the following configuration:

Ser riktig ut, så da kjører vi kommandoen.

# zpool add tank raidz ata-HGST_HDN724040ALE640_PK1381PCJSZ50S-part4 ata-HGST_HDN724040ALE640_PK1381PCJT6EWS-part4 ata-HGST_HDN724040ALE640_PK1381PCK3N9DS-part4 ata-HGST_HDN724040ALE640_PK1381PCKZ840S-part4
# zpool status
pool: tank
state: ONLINE
scan: scrub repaired 0 in 21h19m with 0 errors on Sat Aug 15 01:49:26 2015

tank ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ata-HGST_HDS724040ALE640_PK1334PBGX5SJS-part4 ONLINE 0 0 0
ata-HGST_HDS724040ALE640_PK1334PBGY417S-part4 ONLINE 0 0 0
ata-HGST_HDS724040ALE640_PK1334PBHJT8NP-part4 ONLINE 0 0 0
ata-HGST_HDS724040ALE640_PK1334PBHJT9UP-part4 ONLINE 0 0 0
raidz1-2 ONLINE 0 0 0
ata-HGST_HDN724040ALE640_PK1381PCJSZ50S-part4 ONLINE 0 0 0
ata-HGST_HDN724040ALE640_PK1381PCJT6EWS-part4 ONLINE 0 0 0
ata-HGST_HDN724040ALE640_PK1381PCK3N9DS-part4 ONLINE 0 0 0
ata-HGST_HDN724040ALE640_PK1381PCKZ840S-part4 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
ata-Samsung_SSD_840_EVO_250GB_S1DBNSBF485213N-part5 ONLINE 0 0 0
ata-Samsung_SSD_840_EVO_250GB_S1DBNSBF485216D-part5 ONLINE 0 0 0
ata-Samsung_SSD_840_EVO_250GB_S1DBNSBF485213N-part6 ONLINE 0 0 0
ata-Samsung_SSD_840_EVO_250GB_S1DBNSBF485216D-part6 ONLINE 0 0 0

errors: No known data errors
# zpool list tank
tank 28.2T 11.8T 16.4T - 9% 41% 1.00x ONLINE -

Utvide mdadm RAID10

Det var litt lite informasjon via google om dette var støttet. Men det viser seg etter litt graving at dette går fint så lenge RAID10 settet er opprettet via mdadm 3.3

Selve utvidelsen er rimelig rett frem.

# cat /proc/mdstat
md1 : active raid10 sda3[0] sdc3[2] sdd3[3] sdb3[1]
195179520 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]

# mdadm --manage /dev/md1 --add /dev/sde3 /dev/sdf3 /dev/sdg3 /dev/sdh3
# mdadm --grow --raid-devices=8 /dev/md1
# cat /proc/mdstat
md1 : active raid10 sdh3[7] sdg3[6] sdf3[5] sde3[4] sda3[0] sdc3[2] sdd3[3] sdb3[1]
195179520 blocks super 1.2 512K chunks 2 near-copies [8/8] [UUUUUUUU]
[>....................] reshape = 0.1% (339584/195179520) finish=9.5min speed=339584K/sec


odroidc1-gpsBased on the gps receiver from hab supplies, the work of jgilje and debian jessie I have been able to compile a minimal image which can work as a Stratum-1 ntp server.

The image itself is ~90MB compressed, and contains a minimal installation of debian jessie, kernel from hardkernel with the pps-gpio patch from jgilje. ntp package was recompiled and is held from future updates. ntpd is preconfigured to use NMEA( driver with PPS sync. And udev rules to create the apropriate devices for ntpd to use. I also removed all of the dvb drivers in the kernel provided by hardkernel.

odroidc1-gps1If you want to relocate the PPS signal to a different gpio pin, this can be done by altering the meson8b_odroidc.dts file and compiling it to an apropriate .dtb file.

Image can be written to memory card using win32diskimager or dd, it will use dhcp for network configuration. Only user enabled is root with the password root. Framebuffer should also work, so you can connect it to a screen and configure it locally.

Things to do at first boot. Use fdisk to delete partition 2, and recreate the partition with the same size as the sd-card. Then resize the root partition.

Please note that on cold boot, it will take some time to lock onto the PPS.



Some ntpd output.

root@odroid-c1:~# ntpq -p
remote refid st t when poll reach delay offset jitter
============================================================================== 2 u 5 64 377 11.512 0.230 0.812
+2.81-166-42.cus 2 u 36 64 377 4.607 -0.430 0.612
+langbein.monslo 2 u 40 64 377 15.449 -1.063 0.953
-ntp-ext.cosng.n 2 u 24 64 377 14.528 1.604 1.253
oGPS_NMEA(0) .GPS. 0 l 12 16 377 0.000 -0.001 0.001

root@odroid-c1:~# ntpq -c rl
associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync,
version="ntpd 4.2.6p5@1.2349-o Mon May 25 18:52:44 UTC 2015 (1)",
processor="armv7l", system="Linux/3.10.75", leap=00, stratum=1,
precision=-20, rootdelay=0.000, rootdisp=0.354, refid=GPS,
reftime=d90ed892.9bbc5b1d Tue, May 26 2015 11:33:38.608,
clock=d90ed89b.4cfcafe8 Tue, May 26 2015 11:33:47.300, peer=59860, tc=4,
mintc=3, offset=-0.001, frequency=9.542, sys_jitter=0.001,
clk_jitter=0.001, clk_wander=0.000

CactiEZ tom for plass.

Innimellom så begynner CactiEZ å logge masse, og da går en tom for plass. For å ikke ødelegge grafene er trikset å restore en gammel backup. Også sørge for at poller_output cachen blir opprettet på ny i mysql.

# /etc/init.d/httpd stop
# cd /
# tar zxvf /var/www/backups/cacti-backup-2015-03-08.tar.gz
# mysql -ppassord cacti < /var/www/html/cacti-backup.sql # mysql -ppassord syslog < /var/www/html/syslog.sql # cd /var/www/html/cli/ # php repair_database.php

Så for å gjenskape mysql output tabellen.

use cacti;
truncate poller_output;

Denne bruker typisk hvis du ser

03/10/2015 02:29:07 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1017', SQL:"select poller_output.output, poller_output.time, UNIX_TIMESTAMP(poller_output.time) as unix_time, poller_output.local_data_id, poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name) LIMIT 10000"

i loggene.