I recently found a need to implement text colours (warnings, attention) in a large pre-Vagrant host installer bash script. I couldn't remember which codes were which and static lists are passé, so I made this:
Which outputs colours like this:
I recently acquired an HP Proliant DL380 2U rackmount server. One can reasonably expect a rackmount server boasting 6 hot-swappable hard drive bays also to sport hardware RAID. But how can you be sure? What about that tower you inherited from a hobbyist sysadmin who claims that it "has hardware RAID", but can't tell you what the RAID controller card is.
This might not work for everyone, but it's a good start. Comments are welcome; I'm happy to add more info to the original article.
This question on ServerFault is currently a prominent search result for "how can I tell if I'm using hardware or software RAID". I thought I'd contribute my personal experience and add that, in Linux,
cat /proc/mdstat will show your software RAID configuration (assuming the md kernel module, which is probably a fairly safe bet).
If you're using software RAID, you'll see something like
Personalities : [raid6] [raid5] [raid4] md0 : active raid5 sda1 sdd1 sdb1 1465151808 blocks level 5, 64k chunk, algorithm 2 [4/3] [UUU_] unused devices: <none>
If not, you'll see
Personalities : unused devices: <none>
You can also check the output of
dmraid --sets, whose output is fairly clear (no RAID and you'll get
no block devices found back).
Hardware RAID implementations vary. Some provide logical devices in
/dev/sdX, some (like the Compaq Computer Corporation Smart Array 64xx (rev 01) in my HP Proliant) use
(This post originally took the format of an answer on ServerFault, which unfortunately incurred the wrath of someone who hadn't yet had their morning coffee; I've converted it to this blog post in the spirit of learning and sharing.)