configuring raids on freebsd

Some days ago, a disk in the old server failed. I replaced it with a new server having ECC memory. It also had a LSI raid controller, which I did not notice when ordering the system.

The configuration of the raid through the raid internal interface was pretty hard and took a long time. I could have booted a linux and used MegaCLI, but from work I knew that I would have to invest approximately the same time to investigate the same commands.

As I was trying to install FreeBSD, gpart had some problems using the created raids, so I investigated how I would configure the raid on FreeBSD and found mfiutil. It is a wonderful tool and makes creating raid sets very easy, without even reading the man page.

As an example, this is how listing the drives looks for my server

$ mfiutil show drives
mfi0 Physical Drives:
 5 (  279G) ONLINE <SEAGATE ST3300657SS 0008 serial=6SJ48V0H> SAS E1:S0
 6 (  279G) ONLINE <SEAGATE ST3300657SS 0008 serial=6SJ5S96X> SAS E1:S1

To adjust or read the current cache policy is only one command

$ mfiutil show volumes
mfi0 Volumes:
  Id     Size    Level   Stripe  State   Cache   Name
 mfid0 (  279G) RAID-0      64K OPTIMAL Writes
 mfid1 (  279G) RAID-0      64K OPTIMAL Writes

$ mfiutil cache mfid0
mfi0 volume mfid0 cache settings:
             I/O caching: writes
           write caching: write-back
write cache with bad BBU: disabled
              read ahead: none
       drive write cache: default
Cache disabled due to dead battery or ongoing battery relearn

$mfiutil cache mfid0 disable
Disabling caching of I/O writes

$ mfiutil cache mfid0
mfi0 volume mfid0 cache settings:
             I/O caching: disabled
           write caching: write-back
write cache with bad BBU: disabled
              read ahead: none
       drive write cache: default
Cache disabled due to dead battery or ongoing battery relearn

If you have to work with a LSI controller next time, remember mfiutil. It is in the base system and needn’t to be installed through ports.