Hard drive firmware update on linux

Before reading this:

  • backup your data;
  • make sure you understand you can brick your hard drive;
  • make sure to understand I am not responsible for any damage which may occur to your devices.

Situation

I have an old Synology NAS, the software is out of date and this model is not supported anymore, so there is no path to upgrade. Except build a new Linux-based NAS. Which I’m doing, keeping both the 1.5TB Seagate disks I had in this old NAS, because 1.5TB (RAID1) is enough to do some testings.

Problem

Building this new NAS, I’m paying attention to a lot of details and logs I usually overlook. So I’m looking for bad sectors on this disk, there’s none of them, but smartctl -a /dev/sda warns me that there is a firmware update available for this disc, and even provides me with an URL.

The firmware I need is CC35, either .exe (not good) or .iso (good, bootable solution). My disk is a ST31500541AS, this firmware update was published on January 18th, 2010, so it’s past time to do it.

Download the ISO, burn a USB key:

> sudo dd if=BarracudaLP-ALL-CC35.iso of=/dev/sdc

Try to boot the NAS with it, but not working: this is a very old FreeDos, and my boot is UEFI, I suspect this will not work, and I don’t want to dig into this.

Doing it manually

Since I can’t use the tool provided by Seagate, the workaround is:

  • find the firmware in the ISO
  • apply it manually to both disks

Haystack, needle…

Mount the key (or the ISO):

> sudo mount -o loop ./Downloads/BarracudaLP-ALL-CC35.iso /home/fabien/plop/

Look up all those files, there’s this one which seems interesting:

-r-xr-xr-x 1 root root      52 févr. 10  2010 Autorun.inf
dr-xr-xr-x 1 root root    2048 févr. 11  2010 BCDW
-r-xr-xr-x 1 root root   77312 avril 30  2009 drivedetect.exe
dr-xr-xr-x 1 root root    2048 févr. 11  2010 FreeDOS
-r-xr-xr-x 1 root root 5898240 févr. 18  2010 HE-CC35.ima
-r-xr-xr-x 1 root root   18739 févr. 10  2010 README.txt
-r-xr-xr-x 1 root root    3638 nov.   7  2002 seglogo.ico

This HE-CC35.ima looks interesting, let’s see:

> file HE-CC35.ima
HE-CC35.ima: DOS/MBR boot sector, code offset 0x4c+2, OEM-ID "FreeDOS ", sectors/cluster 4, root entries 240, sectors 11520 (volumes <=32 MB), sectors/FAT 9, sectors/track 36, heads 4, serial number 0x0, label: "           ", FAT (12 bit), followed by FAT

Great, assuming this is again a disk image, let’s mount:

> mkdir seagate_firmware
> sudo mount -o loop plop/HE-CC35.ima seagate_firmware/
> l seagate_firmware/
total 2650
-rwxr-xr-x 1 root root   66090 mai    3  2007 COMMAND.COM
-rwxr-xr-x 1 root root    2103 févr. 10  2010 FDAUTO.BAT
-rwxr-xr-x 1 root root     327 févr. 10  2010 FDCONFIG.SYS
-rwxr-xr-x 1 root root   14036 mars  23  2005 FINDTDSK.EXE
-rwxr-xr-x 1 root root    7736 juil.  7  2005 HIMEM.EXE
-rwxr-xr-x 1 root root   45565 mai    3  2007 KERNEL.SYS
-rwxr-xr-x 1 root root 2143428 févr. 17  2010 LOD.zip
-rwxr-xr-x 1 root root    4933 mai   26  2007 NANSI.SYS
-rwxr-xr-x 1 root root  374043 févr. 11  2010 SFLASH.ZIP
-rwxr-xr-x 1 root root   13740 janv. 31  1993 TDSK.EXE
-rwxr-xr-x 1 root root   30226 mai   26  2004 UNZIP.EXE

Looking up on internet, it seems that Seagate firmware are LOD, so I unzip the LOD.zip file.

Archive:  LOD.zip
  inflating: HECC352H.LOD
  inflating: HECC354H.LOD
  inflating: HECC358H.LOD
  inflating: flash-m.bat
  inflating: he-cc35.cfs
  inflating: model.lst  

So now we have 3 LOD.

Risks and bricks

Stones and mortar, our house in Austin; A long time ago.

Big fat warning: don’t do this if you don’t know what you’re doing. Most probably you will brick your disk, and this is your fault. What follows can lead to catastrophic failure, your disk may not be recoverable (not talking about the data on the disk, but the disk itself).

My disk is a ST31500541AS, there is no obvious clue to find which LOD is the proper one. Let’s grep:

> grep ST31500541AS *.LOD

No result. Go for the coarse-grain grep:

> grep ST31 *.LOD
Binary file HECC358H.LOD matches

OK, but how do we make sure this is the proper one ?

Using vi, with the magical command :%!xxd to read the hexa, and looking for the ST31 string:

000f8f60: 2020 2020 2020 2020 2020 2020 2020 2020
000f8f70: 2020 5354 335f 494e 5641 4c49 445f 5046    ST3_INVALID_PF
000f8f80: 4d53 5433 3830 3331 3443 5353 5433 3235  MST380314CSST325
000f8f90: 3033 3132 4353 5354 3332 3530 3431 3243  0312CSST3250412C
000f8fa0: 5353 5433 3235 3035 3132 4353 5354 3335  SST3250512CSST35
000f8fb0: 3030 3331 3243 5353 5433 3530 3034 3133  00312CSST3500413
000f8fc0: 4353 5354 3335 3030 3531 3343 5353 5433  CSST3500513CSST3
000f8fd0: 3735 3033 3232 4353 5354 3337 3530 3432  750322CSST375042
000f8fe0: 3343 5353 5433 3735 3035 3233 4353 5354  3CSST3750523CSST
000f8ff0: 3331 3030 3033 3232 4353 5354 3331 3030  31000322CSST3100
000f9000: 3034 3232 4353 5354 3331 3030 3035 3233  0422CSST31000523
000f9010: 4353 5354 3331 3530 3035 5858 5858 5354  CSST315005XXXXST
000f9020: 3332 3030 3035 5858 5858 5354 3338 3033  320005XXXXST3803
000f9030: 3134 4353 5354 3332 3530 3331 3243 5353  14CSST3250312CSS
000f9040: 5433 3235 3034 3132 4353 5354 3332 3530  T3250412CSST3250
000f9050: 3531 3243 5353 5433 3530 3033 3132 4353  512CSST3500312CS
000f9060: 5354 3335 3030 3431 3343 5353 5433 3530  ST3500413CSST350
000f9070: 3035 3133 4353 5354 3337 3530 3332 3243  0513CSST3750322C
000f9080: 5353 5433 3735 3034 3233 4353 5354 3337  SST3750423CSST37
000f9090: 3530 3532 3343 5353 5433 3130 3030 3332  50523CSST3100032
000f90a0: 3243 5353 5433 3130 3030 3432 3243 5353  2CSST31000422CSS
000f90b0: 5433 3130 3030 3532 3343 5353 5433 3135  T31000523CSST315
000f90c0: 3030 3558 5858 5853 5433 3230 3030 3558  005XXXXST320005X
000f90d0: 5858 5800 d296 0b06 0c20 0100 c696 0b06  XXX...... ......

OK, we can read ST315005XXXX so assuming a X can be replaced by any character it matches my model number. I check the other LOD files, no such string, no such model description. I also check all the other files (hoping to find an explicit readme), but nothing. So let’s do it.

> sudo hdparm --yes-i-know-what-i-am-doing --please-destroy-my-drive --fwdownload HECC358H.LOD /dev/sda

Done. Firmware updated. And the disk is still working.

Results

Now reporting an up to date firmware (from 2010 …):

> smartctl -i /dev/sda
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.18.0-193.28.1.el8_2.x86_64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda LP
Device Model:     ST31500541AS
Serial Number:    XXXXXXXX
LU WWN Device Id: 5 000c50 01b98d6f4
Firmware Version: CC35
User Capacity:    1,500,301,910,016 bytes [1.50 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    5900 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Mon Nov  9 21:03:14 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

\o/

Précédent
Suivant