DRBD: Troubleshooting and Error Recovery of Hard Drive Failure or Replacement
DRBD refers to block devices designed as a building block to form high availability cluster. This is done by mirroring a whole block device via an assigned network. DRBD can be understood as network based RAID-1. (DRBD)
Sometimes we have a disk failure on hard drive which contains DRBD backing device. The following steps can be used to replace or recover the failed drive.
1. detach drbd resource from broken backing storage
# drbdadm detach <resource>
2. check state of drbd disk
# drbdadm dstate <resource>
Diskless/UpToDate
3. if using internal meta data, bind DRBD device to new hard disk
# drbdadm create-md <resource>
# drbdadm attach <resource>
4. if using external meta data DRBD unable to recognize hard drive was swapped, need additional step
# drbdadm create-md <resource>
# drbdadm attach <resource>
# drbdadm invalidate <resource>
Reference: http://www.drbd.org/users-guide-8.4/ch-troubleshooting.html
DRBD: Manual Split Brain Recovery
Split Brain in DRBD is a condition where each host think that resource in another host is outdated, thus synchronization won’t be occured. This condition often occurs because of network or power failure which is indicated by these variables:
log: Split-Brain detected, dropping connection
connection-state: StandAlone/WFConnection
To manually recover the cluster from split brain condition, the following steps is required.
1. on victim connection state must be StandAlone
# drbdadm disconnect <resource>
2. set victim as secondary
# drbdadm secondary <resource>
3. reconnect victim
# drbdadm connect --discard-my-data <resource>
4. on the survivor, if the connection state StandAlone enter following command
# drbdadm connect <resource>
Reference: http://www.drbd.org/users-guide-8.4/s-resolve-split-brain.html
(Hu)go Template Primer
Hugo uses the excellent go html/template library for its template engine. It is an extremely lightweight engine that provides a very small amount of logic. In our experience that it is just the right amount of logic to be able to create a good static website. If you have used other template systems from different languages or frameworks you will find a lot of similarities in go templates.
This document is a brief primer on using go templates. The go docs provide more details.
Migrating from Jekyll
Move static content to static
Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there.
With Jekyll, something that looked like
▾ <root>/
▾ images/
logo.png
should become
▾ <root>/
▾ static/
▾ images/
logo.png
Additionally, you’ll want any files that should reside at the root (such as CNAME) to be moved to static.
Getting Started with Hugo
Step 1. Install Hugo
Goto hugo releases and download the appropriate version for your os and architecture.
Save it somewhere specific as we will be using it in the next step.
More complete instructions are available at installing hugo
Step 2. Build the Docs
Hugo has its own example site which happens to also be the documentation site you are reading right now.
Follow the following steps:
- Clone the hugo repository
- Go into the repo
- Run hugo in server mode and build the docs
- Open your browser to http://localhost:1313
Corresponding pseudo commands:
Find A Virtual Machine by MAC Address with VSphere Client and PowerCLI
It is usual task to find someone computer by its MAC address when there is an issue related to his computer in the local network. The common case is IP conflict or network abuse. But, if the MAC Address shows that machine is one of many scattered VMware virtual machine out there, how do we find it?
####vSphere Client If you have an VMware ESX or ESXi server, vSphere Client is tool to manage your virtual machines from remote computer. But, vSphere Client cannot tell the MAC Address of virtual machines from version 10 or higher and to find virtual machine based on MAC Address we must open the virtual machine Setting one by one. It is still possible when there are few virtual, but it is exhausting when we have many virtual machine.