Hacker News new | ask | show | jobs
by ajb 1550 days ago
" If it’s your boot drive, no luck there and you can try flashing while it’s mounted."

Err no, that's when you boot from USB stick. Or do it from initramfs. Or anything, other than modifying the firmware of a drive you are running from.

2 comments

Modern Samsung SSDs support online updates. Here's SMART from mine:

  Firmware Updates (0x16): 3 Slots, no Reset required
Same thing as BIOS flashback in modern motherboards. Flash it and reboot, if anything is broken it'll roll back (hopefully).
Ok that makes more sense. TBH I would still boot from a USB stick though. But it makes sense they would implement that, why make ordinary users need to do that. After all, you might need to deploy a security patch these days without user intervention.
You ought to be able to flash the firmware on a mounted drive.

Anyone sane implementing the firmware flashing algorithm will either:

1. Just reject all IO requests from the point of the firmware update onwards. The system will see the drive disappear, but since you are using a journaling filesystem, it will be like you just pulled the power, and no data corruption will happen.

2. Complete all IO requests before the update, then update, then continue requests as before.

3. Save the firmware update, but only apply it at next powerup of the drive.

#3 is the correct option, I think, except you update the firmware but don't start using it. The OS should handle powercycling the drive at a convenient moment, at which point it'll load the new firmware.

Netapp filers do this; they update disk firmware online by installing it and then just rebooting the drive. The RAID controller/software handles the momentary interruption with zero issues, but even without redundancy an OS can handle a drive disappearing for a few moments.

I don't think Linux can do this... When hardware is powercycled, that would be a disconnect event followed by a connect event. There is no way to be sure it's the same drive connected, or that it will connect again at all. And on the disconnect event, all the datastructures associated with the device get discarded, so all file handles are invalid and nothings gonna work again...
Linux has support for multipath devices, so disks disappearing and re-appearing at runtime definitely isn't a new concept. Making it work with a single disk might take some work though.

If the power cycle is controlled, then the kernel can be reasonably sure that the re-appearing device is the same one. File handles wouldn't really be affected as long as the mounted filesystem can resume IO after the device reappears.

Most likely you'd still want to use a RAID scheme and/or data checksumming as an extra layer to ensure data integrity though.

You're basically right, but hardware manufacturers are not known for writing sane firmware and a lot of people have been burned enough times to absolutely never ever trust that reasoning.