fredag 9 maj 2014

Hard disk Firmware update on the Linux command line

Sometimes you will find that your hard disk is slow, or there are some other issues with disk performance. If you are lucky, the disk is not broken. It could have some firmware bugs, and if you are even more lucky, the manufacturer could have issued a firmware update. I've updated several hard disk firmwares in the past. Usually you have to use a boot disk with DOS or something to update the firmware.

Why updating firmware?

One of my hard disks in the past needed a new firmware because it was dropping out from a RAID controller. It began working fine after the firmware update.

The latest hard disk that needed firmware update was Seagate 15k.7 ST3450857SS SAS. I noticed that the disks sometimes slowed down during writes and even stalled. I use two 450GB disks in software RAID 1.

By googling I found that there were other people having similar problems with the same disk and that there were actually a firmware update available from Seagate. Also Dell, HP and IBM seems to have this firmware update available for their particular server systems. If you have a drive coming from Dell or some other server manufacturer, your disk has probably a custom firmware. You should not mix firmware. Also the firmware update tools will not allow updating disks with different firmware used by a different manufacturer, despite that it is actually the same hard disk.

You can check if there are any firmware updates for your Seagate disk at You need to enter the serial number of your disk.

Seagate's firmware update for linux for the ST3450857SS disk was named

Seagate command line tool

The nice thing with this firmware update is that it contains a linux tool, dl_sea_fw, for flashing the firmware on a live system. No need for rebooting or FreeDOS USB sticks.

As a side note, it is possible to flash SCSI and SAS disks with the free linux command line tool  sg_write_buffer (from the package sg3_utils), but as I don't have experience with this tool, I can't comment on it.

The zip file contained a pdf with instructions and two folders, "firmware" and "linux cli tools". Read the instructions!

Copy the correct firmware from the firmware folder into the "linux cli tools" folder. Open a terminal in the "linux cli tools" folder. Make the command line tools executable by issuing:

chmod +x  dl_sea_fw-0.2.0_64

(or dl_sea_fw-0.2.0_32 for the 32-bit binary on a 32-bit OS)

Make sure to have the sg generic SCSI module loaded in linux to be able to access SCSI or SAS devices behind for instance LSI controllers. See the previous blog post on LSI RAID cards.

Issue the following command to list your hard disks. The output is seen below:

./dl_sea_fw-0.2.0_64 -i
 Seagate Firmware Download Utility v0.2.0 Build Date: Dec 18 2012
 Copyright (c) 2012 Seagate Technology LLC, All Rights Reserved
 Fri May  9 16:29:34 2014
Optiarc   /dev/sg0 MN: DVD                  SN:          FW: 1.01
LSI       /dev/sg1 MN: Logical              SN: 16733438 FW: 3000
ATA       /dev/sg2 MN: WDC WD10EAVS-00D7B0  SN: WD-WCAU4 FW: 1A01
ATA       /dev/sg3 MN: ST31000528AS         SN: 6VP2B44D FW: CC49
SEAGATE   /dev/sg4 MN: ST3450857SS          SN: 3SK1JPXS FW: 0006
SEAGATE   /dev/sg5 MN: ST3450857SS          SN: 6SK00JF9 FW: 0006
ATA       /dev/sg6 MN: SAMSUNG HD502IJ      SN: S1PZJ90Q FW: 1113

The disks that need firmware update are /dev/sg4 and /dev/sg5. Note the last column, FW:. It states that the firmware revision is 0006. The three first digits "000" indicates that the disk has standard Seagate firmware. The new firmware has version 000B and is obviously higher than the installed firmware (B is a hexadecimal digit).

It should be safe to update the disks in a live system, also with software RAID. It is not recommended to run any large IO operations or background disk scans at the same time, however.

Updating the firmware

To update the firmware, issue

./dl_sea_fw-0.2.0_64 -m ST3450857SS -f Cheetah15K7-Eagle-StdOEM-SAS-000B-450GB.lod -d /dev/sg4

where -m is the disk model, -f is the firmware file and -d is the specific device. You can leave out -d to update all devices, but I prefer to do one disk at a time and check that everything went right. The output should say:

Downloading file Cheetah15K7-Eagle-StdOEM-SAS-000B-450GB.lod to /dev/sg4 .  !

Check that the disk firmware is updated with

./dl_sea_fw-0.2.0_64 -i
 Seagate Firmware Download Utility v0.2.0 Build Date: Dec 18 2012
 Copyright (c) 2012 Seagate Technology LLC, All Rights Reserved
 Fri May  9 17:00:11 2014
Optiarc   /dev/sg0 MN: DVD                  SN:          FW: 1.01
LSI       /dev/sg1 MN: Logical              SN: 16733438 FW: 3000
ATA       /dev/sg2 MN: WDC WD10EAVS-00D7B0  SN: WD-WCAU4 FW: 1A01
ATA       /dev/sg3 MN: ST31000528AS         SN: 6VP2B44D FW: CC49
SEAGATE   /dev/sg4 MN: ST3450857SS          SN: 3SK1JPXS FW: 000B
SEAGATE   /dev/sg5 MN: ST3450857SS          SN: 6SK00JF9 FW: 000B
ATA       /dev/sg6 MN: SAMSUNG HD502IJ      SN: S1PZJ90Q FW: 1113

You can tell that the firmware update was successful by checking the Firmware revision. Now it says 000B.

The smartctl command also allows you to check the firmware:

smartctl -i /dev/sg4

Vendor:               SEAGATE
Product:              ST3450857SS
Revision:             000B

Now I only have to monitor the disk performance and see if the firmware update helped.

Disclaimer! I don't take responsibility for what you do with the information provided in this blog post. The information is provided as is. I don't have any connection with the trademarks mentioned in this blog post.

lördag 26 april 2014

Using IBM ServeRAID M1015 card in Linux

The FusionMPT SAS2 based cards by LSI are cheap RAID cards that perform well in RAID 0 and 1 under Linux with SSDs and ZFS arrays. They are used in many 1U servers with one or two disks. They are also a popular SAS 6.0 / SATA III controllers for enthusiasts. You can get them cheap on ebay. Before SATA III was common on motherboards, this was THE card to get. It can still be useful if you need SAS disks or additional disks or have a need for disk enclosures.

It is identical to the LSI MegaRAID SAS 9220-8i. The same hardware is also used in LSI 9240 and LSI 9211. It is possible to use the BIOS from another card (crossflashing) to change the features of the card. There are a few different BIOS files you can use.


Official LSI information
  • 8-lane, 5 GT/s PCI Express 2.0
  • Identical to LSI 9240-8i card
  • 6 Gb/s per port
  • Two x4 internal SFF-8087 connectors
  • Controller LSISAS2008
  • Low cost SATA+SAS RAID solution
  • RAID levels 0, 1, 5, 10, 50 and JBOD mode
  • >2TB logical drive support
  • S.M.A.R.T. support
Low-profile, 8 internal port 6Gb/s SATA+SAS RAID card with x8 PCIe 2.0 host interface and a full complement of data protection features.


The BIOS flashing procedure is well explained on the following page:

I chose to flash the card to LSI9211-IR. This way I can use pass through for single drives and software RAID, and additionally use the RAID features of the card (RAID 0, RAID 1, RAID 1e and RAID 10).

To flash the card, read the excellent article above, but in short you have to boot with an USB stick with the correct firmware and and issue:

megarec -writesbr 0 sbrempty.bin
megarec -cleanflash 0
<reboot, back to USB stick>
sas2flsh -o -f 2118ir.bin -b mptsas2.rom
sas2flsh -o -sasadd 500605b0xxxxxxxx (x= numbers for SAS address)

The SAS address is found on the back of the card, on the green sticker.

In Linux

The card works out of the box in Linux. It is using the mpt2sas kernel driver.

[root@localhost ~]# lspci|grep LSI
02:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)

Hard disks that use passthrough will be visible to smartmontools.

[root@localhost ~]# smartctl -a /dev/sdb

To show disks in RAID arrays you have to load the generic sg SCSI driver:

[root@localhost ~]# modprobe sg

Then you can add the disk to smartd:

echo "/dev/sg4 -d scsi -a -s L/../../3/02" >> /etc/smartmontools/smartd.conf

To keep the sg driver loaded over reboots, issue (on Fedora):

[root@localhost ~]# echo sq >> /etc/modules-load.d/sg.conf

Linux Tools

Because this is a low-end card, MegaCLI and similar tools will not work with the Fusion-MPT SAS-2. LSI provides a command line tool with basic funtionality, sas2ircu. The tool is hard to find, but at least supermicro provides a link for it. The tool is mostly useful for monitoring.

Simple usage:

[root@localhost ~]# sas2ircu LIST
LSI Corporation SAS2 IR Configuration Utility.
Version (2013.03.01) 
Copyright (c) 2009-2013 LSI Corporation. All rights reserved. 

         Adapter      Vendor  Device                       SubSys  SubSys 
 Index    Type          ID      ID    Pci Address          Ven ID  Dev ID 
 -----  ------------  ------  ------  -----------------    ------  ------ 
   0     SAS2008     1000h    72h   00h:02h:00h:00h      1000h   3020h 
SAS2IRCU: Utility Completed Successfully.
[root@localhost ~]# sas2ircu 0 DISPLAY 
IR Volume information
IR volume 1
  Volume ID                               : 286
  Status of volume                        : Okay (OKY)
  Volume wwid                             : 0c620c8063bd337c
  RAID level                              : RAID1
  Size (in MB)                            : 428199
  Boot                                    : Primary
  Physical hard disks                     :
  PHY[0] Enclosure#/Slot#                 : 1:0
  PHY[1] Enclosure#/Slot#                 : 1:1

There is a nice script, sas2ircu-status, at HWRAID. The script can be used with nagios to report the status of the controller and RAID arrays.

I made a cron script to regularly check the status of the controller and send a mail if there is something wrong. It is used together with the sas2ircu-status script. You can download it here.

torsdag 3 april 2014

Installing Linux on a tablet

Tablets usually have only a few USB ports. The Viewsonic Viewpad 10pi has two. I'll show later that this makes things a bit complicated.

Because of the badly supported hardware in Z670 tablets, you have to improvise a few things. The graphics chip doesn't necessary let the installer run in grahical mode and the Wi-fi chip is not detected automatically by the installer.

I first tried installing Fedora 20. It failed, because the Wi-fi chip was not detected and the installer refused to continue without a configured network device (at least the text mode installer, because the graphical installer refused to run). Using an external USB Wi-fi device helped, but Fedora fails to start X-windows on this graphics chip. I'm not sure what the problem is. It doesn't load the required module, gma500_gfx, automatically. Loading it manually doesn't help.

Then I tried Debian. It turned out that Debian automatically loads the graphical driver and it is possible to start X. This is how I did it:

1. Download debian-7.4.0-i386-netinst.iso and put it on an USB stick.  Just copy the ISO to your USB with
cp debian-7.4.0-i386-netinst.iso /dev/sdX

The driver for the network card is available in firmware-libertas backports (mwifiex_sdio). I wasn't able to use it during installation. I had to use a separate USB wifi device and an USB hub. Not sure what the problem was, but it began working after installation.

2. Connect an USB keyboard to the tablet. Boot the tablet  with the USB stick. Press F9 to boot the USB. 

3. Install Debian normally.

Debian Wheezy will start Gnome in fallback mode (without grahipcs hardware acceleration), and unfortunately on-screen keyboard doesn't work at the login screen in fallback mode.

I also tried Debian Jessie Alpha 1, but there was a bug with gdm and I couldn't start any desktop (I tried gnome and lightdm). Instead I had to switch to lightdm-greeter and start gnome that way. Unfortunately there was no on-screen keyboard support for lightdm-greeter, so I had to enable auto-login.

You wonder of course how I did all that without logging in, but I was in fact logged in, from another PC with ssh. All you need is a terminal and ssh server running on the tablet.

Jessie also had another bug, the panel in gnome wasn't working with the touch screen.

To be continued...

torsdag 27 mars 2014

Linux on an x86 tablet

I've for a long time wanted to run Linux on a tablet. Why, because I use Linux on all of my computers. Why not on a tablet? I dislike Android with its app store model. I need a terminal where I can tell the system what to do, select repositories and download the software I want. Even more important: to be able to create my own software and modify the applications and the system.

There are a number of x86 tablets that came on the market around 2011. Most of them were running Windows 7, but some had even x86 Android. Many of them were based on Intel Atom Z670 with GMA600 graphics (Oak Trail tablet platform). I list a couple here in no specific order:

Viewsonic Viewpad 10 and variants
Fujitsu Stylistic Q550
Motion CL900
HP Slate 2
Dell Latitude ST-LST01

The problem with all of these is the dreaded PowerVR graphics chip. Some binary drivers were released at the time, but they don't work anymore with modern linux systems. There is work ongoing to support the Intel Minnowboard, which uses the same chipset. Hopefully there will be 2-D graphics acceleration available at some point.

They are also a bit slow by today's standard, but for my usage, occasional browsing and reading, I think they are still nice. For other things, I use a "real" PC.

A few tablets running Windows with Intel graphics have been released in the last year. They could be a better candidate to run Linux on, but they are still quite expensive.

I wanted to try out, so I bought a used Viewsonic Viewpad 10pi. My next post will examine this tablet. I will provide in-depth info on what works and what not.

Note! Don't rush out and buy these tablets with the intention to run Linux on them. There are still a couple of things that make them hard to use without a lot of work.