Summary
•this tutorial is for white light single disc drives WDH1NCxx000E not for WDH2NCxx000E
•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!
Attention:
•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!
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:
http://websupport.wdc.com/firmware/list.asp?type=WDH1NC&fw=01.00.02
use this actual link with wget
# download the latest firmware - also see /proto/SxM_webui/admin/fw_chk.php
wget http://cache.websupport.wdc.com/wdhxnc-01.00.16.img -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)
wget http://mybookworld.wikidot.com/local--files/install-clean-hdd-in-white-light-my-book-world-edition/mbr_mac.tar.gz
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/upgrade1.sh
# 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
sync
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 factoryDefault.sh
# !!!! 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/factoryDefault.sh
# ...and check the result:
cat -n ./sdb1/proto/SxM_webui/admin/tools/factoryDefault.sh
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
sync
… 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
# 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
sync
part 4: boot the new disk
while booting mybook you gets at http-access "Making filesystem ………. (%)"
Clean Install New HDD into MBWE

Custom Search