git line ending handling on a project that is using multiple platforms

# for osx and linux this uses lf in the repo and will convert any cr/lf to lf on commit.
git config --global core.autocrlf input

# for windows if you want your working copy to use cr/lf this will covert on checkout.
git config --global core.autocrlf true

# for windows if you want your working copy to use what comes from the remote
# and to convert windows cr/lf to just lf on commit.
git config --global core.autocrlf input

# for windows only dev's you can keep both the wc and the remote as cr/lf.
git config --global core.autocrlf false

Checking for and installing GRUB on both disks of an md RAID 1 array

If you are using a two disk md RAID 1 for your system to provide for redundancy then you want to be able to boot from either drive in the event of a disk failure. That means you need to have GRUB installed on both boot blocks. The check is easy:

-bash-4.1# dd if=/dev/sdb bs=1 count=512 | grep -o -a --color '[\x20\x30-\x7a]\{2,4\}' 
ZR
;D
GRUB
Ha
512+0 records in
512+0 records out
512 bytes (512 B) copied, 0.000566734 s, 903 kB/s
-bash-4.1#

The command above intentionally shows the use of grep rather than the more convenient strings because if you boot into linux rescue from a flash drive you won’t have strings! If you are being proactive and setting this up before a disk failure then you can use strings. The dd dumps the first 512 bytes of the disk to stdout and pipes it into grep. The -a tells grep to process the bytes as if they were text, and the -o instructs grep to only show the matched strings. If you see GRUB you are good to go. Continue reading Checking for and installing GRUB on both disks of an md RAID 1 array

Script for EDAC Diagnosis

Here is a bash script that I wrote to grab the important information using dmidecode. The problem with “Having to invert the logic” as Sebastian mentioned in his comment on my previous post on “How To Diagnose Memory Errors on AMD x86_64 using EDAC”┬áis handled by using the switch -b.

Sorry that there are no comments. I was just playing around when I wrote this and never cleaned it up. Continue reading Script for EDAC Diagnosis

How To Diagnose Memory Errors on AMD x86_64 using EDAC

This is a writeup I put together to help identify the defective DIMM from EDAC errors on linux x86_64.

Over several years of managing a linux cluster I have occaisionally had systems with a bad memory DIMM. An early manifestation of these errors is EDAC errors (Error Detection and Correction kernel module) reported in the kernel ring buffer. One frustrating problem is identifying the bad DIMM. In the past I have used a brute force approach to diagnose this by running the system with a single DIMM at a time until I found the offending DIMM. However, as systems have become larger with more CPUs and more DIMMS this has become very impractical. It seems that the information in the EDAC error messages should be sufficient to identify the offending DIMM. Unfortunately, it is not obvious how to do this, and I have found no single source that explained the process. As a result, using information from a number of sources I have figured it out for some of our current motherboards (e.g. SuperMicro AMD64). The following is a summary of the steps that I used which I believe can be generalized to other motherboards.
Continue reading How To Diagnose Memory Errors on AMD x86_64 using EDAC

Editing initrd (Initial ramdisk)

Editing an initrd is often simpler than creating one.

I needed to create a new node for the system md device because while working on the system RAID1 md after a power failure under linux rescue, the minor device number changed. init was throwing the error “mount: could not find filesystem /dev/root
The following steps are what I did to fix it…
Continue reading Editing initrd (Initial ramdisk)