I am building a new software linux RAID array consisting of 4 1TB Western Digital green drives to replace my aging array of 6 200GB maxtor drives that are quickly reaching the end of their usable life. When I recieved the new drives one of them was making a bad clicking noise and was obviously bad. I needed to confirm this for the return by running the Western Digital Diagnostic Tools. I had a few problems though, I am not running windows, nor do I have a working cd/dvd drive in the server not to mention not having a working bootable dos cd.

What is the solution?

A combo of freedos, grub and bootable USB.

First things first, insert your USB drive, then unmount it.

*note, during this process your usb drive will be totally cleared, so don’t use one with anything important on it.

You don’t need a ton of space, so you can use any old USB drive. All the software only takes up 2.1M on my drive.

Partition and Formatting

First create a partition, this assumes your usb drive is /dev/sdb (you can grep dmeg to check):

sudo cfdisk /dev/sdb

Remove all partitions, then create a FAT32 partition,  write, then quit

Now you can format the partition in FAT16, you can try FAT32 but FAT16 is recommended :
sudo mkdosfs -F16 /dev/sdb1

Download and install FreeDOS

Create temp dir and mount the usb drive:

sudo mkdir /mnt/usb (temp mounting dir)

sudo mount /dev/sdb1 /mnt/usb

cd /mnt/usb

wget http://odin.fdos.org/fdodin06.bin.zip

unzip fdodin06.bin.zip fdodin06.144

rm -f fdodin06.bin.zip

Grub install

cd /mnt/usb

mkdir grub

cp /boot/grub/stage* /mnt/usb/grub/

cp /usr/lib/syslinux/memdisk /mnt/usb/

Create a GRUB config (menu.lst) :
File: /mnt/usb/grub/menu.lst

default=0
timeout=10
root=(hd0,0)
title FreeDOS
kernel /memdisk
initrd /fdodin06.144

And finally, you can install GRUB, run :

grub

grub> device (hd5) /dev/sdx (replace sdx with the device you are using)

grub> root (hd5,0)

grub> setup (hd5)

grub> quit

Download and extract WD tools

wget "http://websupport.wdc.com/rd.asp?p=sw30&t=122&lang=en&s=http://support.wdc.com/download/dlg/Diag504fCD.iso"

Download the ISO then extract the files inside to your usb drive. The floppy executables require windows.

Also remove the ;1 from the end of each file.

Boot from USB drive

This part is motherboard specific, but on my motherboard I had to select Hard drive as the first boot device, then choose from the USB drive from the list of available hard drives in the bios.

Run WD tools

You should see the grub boot screen when the usb drives boots.

“FreeDOS” should be your only choice, so select that.

It will boot the the A:\>  but the WD software is on C, so type: c: <enter>

then: dir

and you should see a list of files that includes DLGDIAG5.exe

so run that software with: C:\> DLGDIAG5.EXE

You should now be running the WD diagnostics successfully.

Much of this was adpated from the gentoo wiki for use with ubuntu, thanks!:

http://en.gentoo-wiki.com/wiki/FreeDOS_Flash_Drive