Install Clean HDD in (white light) My Book World Edition


  • this tutorial is for white light single disc drives WDH1NCxx000E only (for WDH2NCxx000E see footnote)1
  • Build a firmware image from scratch: you need only a file of 945-Byte and a online connection to the update server from Western Digital!!
  • From an WD_MyBook_Firmware_download_V 1.00.16 extract the stuff that counts
  • Connect your new disk to a Linux-PC (I'm using Windows with Vmware "Ubuntu 9.10") and copy the stuff you extracted to the new disk
  • You must only copy the scripts to your terminal (root). Nothing must be changed (except /dev/sd?)
  • Take the new disk and stick it in the MyBook
  • While first booting the Mybook goes to factory reset and make the XFS file system on sda4 with all shares!


  • This way works with disk of every size and disk of every vendor.
  • this script kills all data on sdb4!!
  • You get a fantasy MAC address. Don't simple change the MAC address. The kernel bootcmd is protected by a check sum (you need fw_printenv with fw_env.config to change the mac).

some hints for ubuntu users:

  • I hope, do you know the root access in ubuntu: "sudo su"
  • you need the package mdadm for creating software raids (go to System/Administration/SynapticPackageManager and install madadm - the tool to administer Linux MD arrays (software RAID))
  • my new disk is the second disk: /dev/sdb -> check the disk numbers with sfdisk -l and change (if necessary) the device names in the following scripts to /dev/sd?

I reverted to rev 14 and killed the changes of user sorinacke (see history). Two weeks ago I wrote him a private message about his changes but he don't answered me. Please use the discuss thread at the end of this page before you make major changes!

edit 14. Febr 2011: New offsets in part2 with firmware >= 01.01.18 !!
read in discussion feed the post from mikeywikey 13 Feb 2011

edit 21. Febr 2011: some hints from user mikeywikey

1. Watch your blocksize, the guide assumes 512 bytes, however some new disks
(specifically, the larger advanced format disks) will come with 1024 bytes or even GPT style
4094 bytes (from the log I see the disk was a 1024 byte).

2. If you build your arrays under ubuntu 10.10 (possibly anything with a 2.6 kernel) then the
md superblock can be later than 0.90 (1.x, or 0.91 in some circumstances), this depends on
your mdadm.conf, but forcing -e 0.90 will ensure an older superblock - you would not get this
issue under the version of unbuntu in the guide.

edit 4. July 2011: use install scripts
here you find a solution with nice scripts (for newer firmware offsets):
it's only but only WD Caviar Green, or edit - see part for user of non WD disk further down

part1: firmware download

edit 31. March 2010: first check with your browser the newest firmware link - the link above to wdhxnc-01.00.16.img is down:

the way below only works with firmware < 01.01.18

use this actual link with wget

# download the latest firmware - also see /proto/SxM_webui/admin/fw_chk.php
 wget -O ./fw.img

# "decode" the firmware image and remove unnecessary files 
# see /proto/SxM_webui/admin/inc/wixHooks.class
dd skip=0 count=1 bs=5120 if=./fw.img of=./tmp_img1 
dd skip=15 count=1 bs=5120 if=./fw.img of=./tmp_img2
cp ./fw.img ./fw_img.orig
dd seek=0 count=1 bs=5120 if=./tmp_img2 of=./fw.img 
dd skip=1 seek=1 bs=5120 if=./fw_img.orig of=./fw.img 
cp ./fw.img ./fw_img.orig
dd seek=15 count=1 bs=5120 if=./tmp_img1 of=./fw.img 
dd skip=16 seek=16 bs=5120 if=./fw_img.orig of=./fw.img 
rm ./tmp_img1
rm ./tmp_img2
rm ./fw_img.orig

# extract gzipped image .tar.gz
 tar zxf ./fw.img

# check if md5sum matches
 md5sum -c upgrd-pkg-1nc.wdg.md5 

# unpack firmware to /fw
 mkdir ./fw
 SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ {print NR +1; exit 0 }' ./upgrd-pkg-1nc.wdg`
 tail -n+${SKIP} ./upgrd-pkg-1nc.wdg | gunzip  | /bin/tar xm -C ./fw

# check md5sums
cd ./fw
md5sum -c md5sum.lst
cd ..

part2: build the boot partition

# download 945 extra Bytes with the MBR, the stage1 and the MAC-address (kernel bootcmd) 
 tar -xzf ./mbr_mac.tar.gz -C ./fw

#clear boot partition
dd if=/dev/zero of=/dev/sdb bs=512 count=64260

# for infos about the DISK SECTOR OFFSETS see ./fw/

# write MBR with start address of stage1
 dd if=./fw/mbr of=/dev/sdb bs=512 seek=0

# main stage-1 image
 dd if=./fw/stage1 of=/dev/sdb bs=512 seek=1

# main u-boot image
 dd if=./fw/u-boot.wrapped of=/dev/sdb bs=512 seek=3

# main MAC image
 dd if=./fw/mac of=/dev/sdb bs=512 seek=239

# main kernel image
 dd if=./fw/uImage of=/dev/sdb bs=512 seek=300

# main upgrade rootfs
 dd if=./fw/uUpgradeRootfs of=/dev/sdb bs=512 seek=6000 

# main upgrade kernel 
 dd if=./fw/uImage.1 of=/dev/sdb bs=512 seek=6512

# backup stage-1 image
 dd if=./fw/stage1 of=/dev/sdb bs=512 seek=10608

# backup u-boot image
 dd if=./fw/u-boot.wrapped of=/dev/sdb bs=512 seek=10610

# backup MAC image
 dd if=./fw/mac of=/dev/sdb bs=512 seek=10846

# backup kernel image
 dd if=./fw/uImage of=/dev/sdb bs=512 seek=10862

# remove UPGRADE_FLAG 
 echo -ne '\x00\x00\x30' | dd of=/dev/sdb seek=255 


part3: build the filesystem

# if you have a disc with partitions
# now look for auto mounted raid devices and stop this raid arrays
# in ubuntu I have md_d1 / md_d0 / md_d3
 cat /proc/mdstat 

# and stop this raid arrays!!
 mdadm --stop /dev/md_d0
 mdadm --stop /dev/md_d1
 mdadm --stop /dev/md_d3

# delete old superblocks
 mdadm --zero-superblock /dev/sdb1
 mdadm --zero-superblock /dev/sdb2
 mdadm --zero-superblock /dev/sdb3

# delete all boot sectors
dd if=/dev/zero of=/dev/sdb1 bs=512 count=1
dd if=/dev/zero of=/dev/sdb2 bs=512 count=1
dd if=/dev/zero of=/dev/sdb3 bs=512 count=1

#clear 4. partition (/Datavolume) !!!!!!!!!!!!!!!!!!!!! Do YOU UNDERSTAND IT??
 dd if=/dev/zero of=/dev/sdb4 bs=512 count=1
 mdadm --zero-superblock /dev/sdb4

# make the raid partitions (md0 md1 md3) 
# echo y for "yes" !
 echo "y" | mdadm --create /dev/md0 -l 1 -n 2  /dev/sdb1 missing
 echo "y" | mdadm --create /dev/md1 -l 1 -n 2  /dev/sdb2 missing
 echo "y" | mdadm --create /dev/md3 -l 1 -n 2  /dev/sdb3 missing

# format the raid partitions 
 mkfs.ext3 /dev/md0
 mkfs.ext3 /dev/md3

# format swap partition
 mkswap /dev/md1

# mount
 mkdir ./sdb1
 mkdir ./sdb3
 mkdir ./rootfs
 mount -o rw,noatime /dev/md0 ./sdb1
 mount -o rw,noatime /dev/md3 ./sdb3
 mount -o loop,ro,noatime ./fw/rootfs.arm.ext2 ./rootfs

# copy rootfs-files to /sdb1 
 cp -a ./rootfs/* ./sdb1

# /var: copy files to /sdb3 
 cp -a ./rootfs/var/* ./sdb3

# it's necessary for success
echo final_tested_ok > ./sdb1/etc/mfgtest_state
echo WCAU44141904 > ./sdb1/etc/serialNumber

# set the factory_restore flag -> thats rebuild a clean (=deleted!!!) md2/sda4 after reboot
  touch ./sdb1/etc/.factory_restore

Here is a part for user of non WD disk. You must hack the

# !!!! if you have a non WDC Disc !!!!!
# use an editor and comment out following lines 158 and 161 in
# gedit ./sdb1/proto/SxM_webui/admin/tools/
# ...and check the result:
 cat -n ./sdb1/proto/SxM_webui/admin/tools/ | head -161l | tail -5l
#   157    cat /sys/block/sda/device/model | grep WDC >/dev/null 2>&1
#   158    #if [ "$?" -eq "0" ]; then
#   159        let WD_DISK_COUNT=WD_DISK_COUNT+1
#   160        DISK1=sda
#   161    #fi

now you are ready

# the file system is ready -> stop Raid
 umount ./sdb1
 umount ./sdb3
 umount ./rootfs
 mdadm --stop /dev/md0
 mdadm --stop /dev/md1
 mdadm --stop /dev/md3

# you are ready - shutdown

… and if your disk size not 1TB then correct the MBR

# if you use not the original WD 1TB disk now correct the size of sda4
# fdisk reads lines of the form     <start> <size> <id> <bootable> 
# When a field is absent or empty, a default value is used.
# The default value of size is as much as possible 
# (until next partition or end-of-disk). 
 echo 4,244,fd>DSKPART
 echo 248,32,fd>>DSKPART
 echo 280,123,fd>>DSKPART
 echo 403,,fd>>DSKPART
 /sbin/sfdisk --force /dev/sdb <./DSKPART

part 4: boot the new disk

while booting mybook you gets at http-access "Making filesystem ………. (%)"

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License