Replace Linux RAID disk the ‘right’ way
Well before you power to replace the disk - can you be sure it will power back on?
Some distros have the bad habit of only install GRUB to one physical disk and if that disk dies…RAID wont save you (but a boot CD will…)
Firstly I like to confirm if /boot is configured in RAID 1. I then usually also install GRUB to all the physical disks via:
grub-install /dev/sda
and sdb and sdc etc. Then I power off the server and replace the disk.
After powering on the server, sometimes it won’t boot due to the new disk getting booted first, so make sure to select another disk in the BIOS boot-up menu.
After the operating system returns it’s a matter of recreating the partitions on the new disk, before trying to add it back into the RAID array. My servers all have the same disk sizes in the array and the same partition layouts, so to recreate them on the old disk I just perform:
sfdisk -d /dev/existing-disk | sfdisk /dev/new-disk
Confirm the new disks get the correct layout via:
cat /proc/partitions
and then add the partition back to the RAID array:
mdadm --add /dev/mdX /dev/sdXX
And then finally confirm its rebuilding via:
mdadm --detail /dev/mdX
OR
cat /proc/mdstat
Configure UTM 220 LCD panel under Linux
I had the task of rebuilding an Astaro UTM 220 with CentOS and the LCD panel looked so lifeless, So I decided to restore it to some version of functional! From my research I can see that the display is LCM-162 and utilises the lcd driver HD44780.
In a nut shell here is what I did:
- Download LCDproc (http://lcdproc.omnipotent.net/)
- Modify: lcdproc-0.5.6/server/drivers/hd44780-ext8bit.c
Change:
#define RS STRB #define RW LF #define EN1 INIT
To:
#define RS SEL #define RW INIT #define EN1 LF
- compile it with option: ‘./configure –enable-drivers=hd44780′
- make && make install
- Modify: /usr/local/etc/LCDd.conf
Change:
- Line 53: Driver=hd44780
- Line 502: ConnectionType=8bit
- Line 509: Device=/dev/parport0
- Line 544: Size=16×2
Test it:
LCDd -f -r 4 -c /usr/local/etc/LCDd.conf &
lcdproc -f -s localhost -p 13666 C M L
If it works its just a matter of copying: scripts/init-LCDd.rpm and scripts/init-lcdproc.rpm to /etc/init.d and configuring chkconfig properly.
Hopefully that helps.
Good regex sites to help with Splunk
- https://regex101.com/ - Great for general regex stuff and capture groups.
- http://www.regexe.com/ - Great for dealing with capture groups in the way that Splunk likes them for anonymising data.
- http://regexr.com/ - Classic website for quick PoC regexs.
Install or Change Server 2012 Product Key
- Open Admin command prompt or powershell
- Remove the unused KMS key: slmgr -upk
- Install your MAK key: slmgr -ipk XXXX-XXXX-XXXX-XXXX
- Activate Windows
How to mount dd images under Linux
For a raw filesystem try:
fdisk -l harddrive.img mount -o ro,loop,offset=xxxxxxxxx harddrive.img /mnt/loop
or for filesystems with volume groups etc try:
losetup /dev/loop0 disk.img kpartx -a /dev/loop0
Then to mount the first partition:
mount /dev/mapper/loop0p1 /mnt
Or to activate the volume group then mount the logical volume:
vgscan vgchange -ay vg mount /dev/vg/lv /mnt
Hope that helps.