I thought I knew the difference between HBA and RAID.
In my mind, HBA is offloading from the main motherboard/CPU and is simply JBOD... usually has an external SAS ports, whilst a RAID card does the same job as HBA but adds all the nice RAID levels and possibly battery backup + other benefits.
After looking at the LSI website for a product, I see that they have HBA cards that have built in RAID, for example the LSI SAS 9211-8i Host Bus Adapter.
So... Clearly I am wrong!
What is the difference between an HBA card and a RAID card?
HBA just means 'host bus adapter', so it's anything that lets you connect to an external bus (although usually the term is applied to a something that lets you connect storage).
You might put one in to fit an external tape drive, or a SAN storage array. Usually, as in this case, it means the card isn't that intelligent. It supports only the simple types of RAID 0, 1, 10, and no onboard cache. So, I think you are more right than wrong.
It may not matter, depending on what your goals are... there are gray areas between both definitions - RAID controller and Host-Bus Adapter (HBA).
Understand that most high-quality servers have embedded RAID controllers today, so the need to select and shop for a separate RAID card has diminished as systems become more integrated...
RAID controller cards can have HBA-like functionality. Sometimes they'll have the ability to function in a JBOD mode or the ability to interface with an external tape drive, blurring the lines between RAID-only duties and the traditional purpose of an HBA.
HBAs may have basic RAID functionality. Sometimes purpose-built SAS HBAs can provide hardware RAID as an option, but will not perform as well as dedicated RAID controllers.
So to your question, if you're shopping or searching for a solution, buy the device whose primary functions align with what you're trying to do.
HBA: Device that plugs into your computer's bus and allows it to talk to hard drives. It may or may not provide RAID, acceleration, or other such features.
RAID controller: Device that provides RAID support, usually with hardware acceleration. It may or may not connect to your computer's bus. It may, for example, connect to a SATA port.
HBA stands for "Host Bus Adapter". It basically identify a card whose role is to interface the main host bus (ie: PCI-E) to other kind of buses (eg: SAS, SATA, USB, etc). As such, an HBA fulfills two different but correlated roles:
This means that a pure HBA has limited intelligence, mainly used to enumerate/control/export the attached device to the main host CPU.
A RAID card is a disk-specific, higher-end evolution of a disk HBA. A pure RAID card hides the single devices from the main bus/CPU, exporting a virtual device with a specific RAID personality (ie: RAID0, RAID1, ecc).
So, given the above definitions, why there are RAID-capable HBA cards and pass-through RAID cards that export single devices to the OS? Because nowadays many HBA/RAID cards are based on similar (if not identical) chipset, with the main difference residing in the firmware images they run. For example, some LSI cards can be switched in IT (pass-through) mode rather than RAID mode (and vice-versa) by simply loading the appropriate firmware.
Moreover, RAID0/1/10 personalities are sufficiently simple to be implemented even in so-called HBA-only cards. On the other hand, RAID5/6 and BBU writeback cache are features commonly reserved for higher-end RAID cards.
HBA is an interface to a scsi protocol bus (whether that's parallel scsi, SAS or FC - it's just that we got out of the habit of calling parallel scsi controllers "scsi HBAs" a couple of decades ago.)
RAID controllers have more smarts and more onboard CPU to perform raid function - they may or may not have scsi interfaces on the drive side. (SATA is a subset of scsi)
For most modern applications where you need raid functionality, you're better off with a HBA and software raid.
The CPU loading for that is trivial and the drives are interchangeable if the controller fails (vs hardware raid usually needing the exact same model controller). On top of that, direct access usually allows better monitoring of drive health than the often-rudimentary monitoring on most RAID controllers.