Confusingboat / flash-it

Easy one-step flashing for LSI SAS2-based HBA/RAID devices
GNU Affero General Public License v3.0
105 stars 30 forks source link

FLASH IT

The only script you'll need for flashing LSI SAS2-based adapters.

During execution the script will:

Just a single reboot is necessary after the script completes.*

*You will need to move your backups to persistent storage before rebooting or they will be lost

Brief background

This script was born from necessity. I've got a pile of 12G Dell servers that need IT firmware and I wasn't about to flash them all manually. Drives were removed for the first server I flashed, but left in for the subsequent machines to no ill-effect. If you're paranoid, remove them. I tried to make the script with as many safeties as possible since this is such a sensitive process, but it's not perfect, as nothing is.

Important notes

IOMMU

One of the tools the script utilizes (lsirec) is incompatible with IOMMU/VT-d. You will need to disable it before running this tool, but may safely re-enable it after the process is complete. It can be disabled either in your BIOS/UEFI or via GRUB kernel parameter with iommu=soft or iommu=off.

Supported hardware

Tested servers

Tested adapters

Untested adapters

Testing other adapters

Testing adapters that are currently not on the supported list is super easy! Just change the ADAPTER_PATTERN="H310" line, where H310 is a regex pattern that matches your adapter. Please let me know if you test another adapter with success or failure, with the following information:

PRs are also welcome!

Supported Linux distros

Tested

Ubuntu 20.04 (live)

  sudo add-apt-repository universe
  sudo apt update
  sudo apt install libncurses5

Ubuntu 18.04 (RancherOS 1.5.4 live or installed)

How to

Prerequisites

Flashing

  1. Ensure the adapter you want to flash is the only LSI/Avago/rebranded HBA device in the system.

  2. Copy flash-it.sh to a directory you're okay with making a mess in:

    wget https://raw.githubusercontent.com/confusingboat/flash-it/master/flash-it.sh
  3. Make the script executable:

    chmod +x flash-it.sh
  4. Make it go:

    sudo ./flash-it.sh

Don't forget to save your backups. They will be saved in /tmp/<your SAS address> throughout the flashing process; this directory is often emptied every reboot even on installed distros.

Troubleshooting

Due to the nature of what this script does there are many opportunities for breakage along the way. Unfortunately this means it won't be possible to document a solution for every possible failure, but the ones that have well-known solutions will be kept here.

Restoring original SBR

If the actual flash hasn't been erased or overwritten, there is a script for simply flashing back the SBR. This should bring your card back to its factory state and allow you to start over. This one is interactive, but if your backups are still in place you can just leave the inputs blank and the script will find them.

  1. wget https://raw.githubusercontent.com/confusingboat/flash-it/master/restore_sbr.sh
  2. chmod +x restore_sbr.sh
  3. sudo ./restore_sbr.sh

It broke half way through and I want it to work again

Throughout the process, the script echos out what it's about to do. You should be able to figure out how to recover based on where the failure occurred.

That didn't work, plz halp

Here is a guide to recovering a dead card using the lsirec itility.

Disclaimer

By downloading and using the scripty bits and associated file(s), you are relinquishing the ability to hold me accountable in any capacity for hardware/software damage or data loss, as well as any moldy pizzas or fruit flies that may manifest in and around your server(s). Use at your own risk.

Credit where it is due

The creation of this script would not have been possible without a PDF I found by /u/fourlynx or the lsirec tool and other info by Hector Martin.