Add new HDD to WDWE

(p.s. I wasn't skilled enough to publish this page, so I created new page at http://wdwe.wikidot.com/ , before I figure it out.)

This instructions have not been tested with NEW MBWE (1TB, 2TB), they will probably work, but don't mix one software system with other hardware system

-> for white light instructions go to http://mybookworld.wikidot.com/install-clean-hdd-in-white-light-my-book-world-edition
-> for upgrading white-light dual-drive from 2x1tb-to-2x2tb post

I've been hacking around this problem for a week now, but I made it. Following are the steps to install a fresh hdd to a WD WE:

I took backup from my original HDD , but you can download from links in this article. After you open the box and connect original hdd and new hdd to some linux machine you do the following.
My Original hdd was mounted as "sdb" under fedora
My New 400G hdd was mounted as "sdc" under fedora (note that if you're going to use a non- hdd , you'll have to disable or correct the script 'S15wdc-heat-monitor' in the '/etc/init.d' folder, or else the blue light will start flashing after a couple of minutes and your device will be inaccessible.)

Summary

  • From an existing WD MyBook disk extract the stuff that counts
  • Connect your new disk to a PC and copy the stuff you extracted to the new disk
  • Do some fiddling to make the configuration on the new drive know how big the disk is.
  • Format the new disk
  • Take the new disk and stick it in the MyBook World Box

1.) Backup original

Extract the Master Boot Record:

# dd if=/dev/sdb of=mbr.sdb bs=512 count=1

Extract the boot loader:

# dd if=/dev/sdb of=boot.sdb bs=512 skip=1 count=12512

(extract boot loader after mbr, and before 1st part. ~6MB is enough)

Extract the remaining partitions to bz2 archives:

# dd if=/dev/sdb1 | bzip2 > sdb1.img.bz2
# dd if=/dev/sdb2 | bzip2 > sdb2.img.bz2
# dd if=/dev/sdb3 | bzip2 > sdb3.img.bz2

Extract partition table:

sfdisk -d /dev/sdb | sed s/sdb/sdc/ > part.sdb

Restore Files to Hard Drive

Now you have all data for new hdd (those files are also available in this article)
Fun part now (be carefull as with dd or sfdisk is very easy to mess up other system/data disks)

2.) Restore MBR and Boot loader

# dd if=mbr.sdb of=/dev/sdc bs=512 count=1
# dd if=boot.sdb of=/dev/sdc bs=512 count=12512 seek=1

3.) Edit part.sdb to modify size of the HDD (see below for description a detailed explanation of 3 )

4.) Overwrite partition of new hdd

# sfdisk /dev/sdc <part.sdb

5.)restore partitions (to check your hdd you can cfdisk /dev/sdc or sfdisk -l /dev/sdc)

# bzcat sdb1.img.bz2| dd of=/dev/sdc1
# bzcat sdb2.img.bz2| dd of=/dev/sdc2
# bzcat sdb3.img.bz2| dd of=/dev/sdc3

6.) Create and activate raid disks (I suggest you disconnect your original hdd or do mdadm -S /dev/md1 (2,3,4)

# mdadm -Cv /dev/md1 -l1 -n2 -c64 /dev/sdc1 missing
# mdadm -Cv /dev/md2 -l1 -n2 -c64 /dev/sdc2 missing
# mdadm -Cv /dev/md3 -l1 -n2 -c64 /dev/sdc3 missing
# mdadm -Cv /dev/md4 -l1 -n2 -c64 /dev/sdc4 missing

7.) format md4 (data)

# mkfs -L "Data" -j /dev/md4

8.) Activate swap (not sure if needed but it doesn't hurt)

# mkswap /dev/md2
# swapon /dev/md2

9.) Optionally you can copy data from original disc (if you haven't disconnected it yet) (I have created 2 folders => mkdir /mnt/sdb; mkdir /mnt/md

# mount -t ext3 /dev/sdb4 /mnt/sdb
# mount /dev/md4 /mnt/md
# rsync -av —progress /mnt/sdb/ /mnt/md/
# umount /mnt/sdb
# umount /mnt/md

10) Now tricky part

# mdadm -Es

1. You should get result like

ARRAY /dev/md1 level=raid1 num-devices=2 UUID=38f61aa3:44d57f6e:371d16a4:c628cbe8
ARRAY /dev/md2 level=raid1 num-devices=2 UUID=d76e6d02:bbdc6d24:944ec00b:1ce3d3f3
ARRAY /dev/md3 level=raid1 num-devices=2 UUID=52c5fcaf:6e5975eb:7ef85dd8:b9eb2bec
ARRAY /dev/md4 level=raid1 num-devices=2 UUID=91c6bb94:a1f85a42:95e839e2:477a7ccc

2. You can replace those for lines in the file /etc/mdadm.conf but be carefull=>

# mount /dev/md1 /mnt/md
# nano /mnt/md/etc/mdadm.conf

now replace 4 lines or only UUIDs

3. Don't forget to unmount the partition when done!

# umount /dev/md1

11.) Don't forget to STOP the running RAID array volumes before you shut-down or disconnect.
This is especially important if you're hooking your drive up to the computer on a USB adapter
as unplugging a running RAID device is a BAD THING

# mdadm --stop /dev/md1
# mdadm --stop /dev/md2
# mdadm --stop /dev/md3
# mdadm --stop /dev/md4

If you get a "device busy" error when you try to stop one of the MD devices
This means that the device is still in use.

  • Is a partition still mounted?
    • Try unmounting the three md partitions that can be mounted (1, 3, & 4)
  • Is swap still "on"?
    • Try "swapoff /dev/md2"

12.) This should do, you can now disconnect hdd and plug it in to your WD box and have fun :)

Details of 3.)


When your hdd is different size than original you have to modify your partition table accordingly
do

sfdisk -l /dev/sdc

1. you will get something like

Disk /dev/sdc: 48641 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sdc1 3 368 366 2939895 fd Linux raid autodetect
/dev/sdc2 369 381 13 104422+ fd Linux raid autodetect
/dev/sdc3 382 504 123 987997+ fd Linux raid autodetect
/dev/sdc4 505 121600 121096 972703620 fd Linux raid autodetect

#now take total number of cylinders (48641) minus starting point of last partiton (505) so
48641-505=48136 x 255 x 63 = 773304840 => this is the size of your last partition
=> edit your part.sdb and correct this last size ie
unit: sectors

/dev/sdc1 : start= 48195, size= 5879790, Id=fd
/dev/sdc2 : start= 5927985, size= 208845, Id=fd
/dev/sdc3 : start= 6136830, size= 1975995, Id=fd
/dev/sdc4 : start= 8112825, size=773304840, Id=fd

=> now you can replace your new HDD partition table (my number is for the WD 400GB) your number will be different

Good Luck Recover Lost Or Deleted Files In 3 Steps.

D

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