Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pcn
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcn/73d822d957de0bdd1c5f to your computer and use it in GitHub Desktop.
Save pcn/73d822d957de0bdd1c5f to your computer and use it in GitHub Desktop.
Check to see if an appropriate mdadm.conf is in the initrd

The salt mdadm state is slightly broken until saltstack/salt#24952 becomes a release (not sure how to track that). In the mean time, I think I want this anyway:

gunzip -c /boot/initrd.img-3.13.0-52-generic \
  | cpio --to-stdout -i etc/mdadm/mdadm.conf 2>/dev/null \
  | egrep -q '^ARRAY'

This could be a state check, like so:

(gunzip -c /boot/initrd.img-3.13.0-52-generic  \
    | cpio --to-stdout -i etc/mdadm/mdadm.conf 2>/dev/null \
    | shasum; shasum /etc/mdadm/mdadm.conf) \
  | cut -d' ' -f1 | sort -u | wc -l

1 means they are the same, 2 means they are divergent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment