[GUIDE] Debrick a MyBookLive DUO

I messaged Timmy1024.  After I finished flashing the drives, i dropped them both into my enclosure for a 6tb duo the light went blue then (about 30secs) it went yellow/white.  Here is where I am stuck.  Any more suggestions I could try?  BTW thank you for helping :slight_smile:

EDIT: Thought I saw a problem but all looks perfect

Did it again with a different firmware .img (older) still same result

Do you still have the old drives with OS intact? You could always try to image one and then write the image to the new disks and use gparted to expand the data volumes after a quick factory restore.

no sadly i don’t. but im thinking i could take one of my mybook live 3tb drives back up data, then img it, then have it do a raid 1 restore. switch with my other 4TB Drive then do what you said by expanding the volume then put the 3tb back together again. Its just so much data to move…

wait i could do it with a 160gb drive right then expand?

Has Timmy messaged you back yet? If not, here is my crazy suggestion

Follow guide 2 at this link which will put a MBL OS on the drive. Just do this on one disk…

http://community.wd.com/t5/My-Book-Live/GUIDE-Debrick-MyBookLive-v2-0/td-p/567582

Since this is only a 3TB image you will need to follow the steps in guide 1 to expand the data partition after you boot the drive once from the enclosure and do a quick factory restore

After you are done, follow this guide to write the MBL DUO OS to the drive. You will obviously need to use the rootfs.img from a MBL DUO firmware in place of where I tell you to download the MBL firmware.

http://community.wd.com/t5/My-Book-Live/GUIDE-Restore-Downgrade-firmware-via-the-reset-button/td-p/481588

The one thing we will have to do manually is set sda4 as raid if you get the one drive working.

You can try to SSH in and type

parted

p

set 4 raid on

reboot

I don’t know if we can do this with the datavolume (sda4) mounted. If you run into errors you can do this part by again taking the drive out of the enclosure and hooking it up to your pc and booting the system rescue cd and issue the commands from terminal

Once you get the one drive working, put an unallocated/unpartitioned drive in the disk B slot and disk A should rebuild disk B

As I said, I don’t own a MBL DUO but this is how I would start to go about it if you can’t get the wiki images working

1 Like

No Luck.  It has to be somehting with the Seagate 4TB drives.  I can format them fine windows or otherwise it just wont boot when attached to the duo.  I got the dashboard by installing the OS to a 36GB Raptor I had laying around with one of the 4TB the raid rebuilt until I got solid green.  Pulled the 36GB put in the other 4TB It would just stay at yellow.  A funny thing though it would say the drive was unsupported in the raid manager if I didn’t format the 4tb before putting it in.  If I did format it it would keep saying it was bad.  If i formated the unknown (swap) partion as a swap partition in gpart then it would say the disk is good.  I don’t understand. This is maddening.  I did get a message from timmy1024. But nothing since.

I just want to know if running this script will void my warranty?

Also I can’t get mediafire from my work location it’s blocked by network security.

Is there another location for downloading the script.

I know I can get it from home, but then I have to wait until tomorrow.

Techinicallly yes.  But I have talked at length witht he Western digital people, and they don’t care.  I was trying to get them to let me RMA my 6tb duo with 2 x4TB seagate drives.  Needless to say they weren’t having that. If you make a file called “debrick.sh” then open it with note pad and paste the following info into it.

#!/bin/bash

The purpose of the script is to reinstall the operating system (debrick) on

a harddrive that has been extracted from the housing of a WD MyBook Live.

#help screen
if [$# = 1 -a “$1” = “–help”]; then
echo "
standard use of script is:
sudo ./debricker.sh the script will find out what disk to use, it will not
touch the partition tables and therefore perserves data.
it will look what the newest version of the firmware is
via internet and then search for it in current folder or
subfolders. if none is found it will download one.

possible options are:
/dev/sd? path to the disk from mybook live. if not given, the script
will figure it out on its own.
/*/*.img path to the firmware that will be written to the disk. if
not given, the script will search for and then download it.
destroy script will rewrite the partition table of disk,
this will not perserve data, must match /dev/sd?.

example
sudo ./debricker.sh /dev/sda /firmwares/mine.img destroy
"
exit 1
fi

echo

#check that requirements are fullfilled
if [“$(id -u)” != “0”]; then
echo -e “this script must be run as root.\n”
exit 1
fi
if ! which mdadm > /dev/null; then
echo -e “this script requires the mdadm package.\n”
exit 1
fi

#making sure the mountpoint is available
rootfsMount=/mnt/md0
if [-e ${rootfsMount}]; then
if mountpoint -q ${rootfsMount}; then
echo “${rootfsMount} needs to be unmounted.”
exit 1;
fi
fi
test -d “./mnt” || mkdir -p “/mnt”
test -d “$rootfsMount” || mkdir -p “$rootfsMount”

#making sure that there is no raid unit running
rootfsRaid=/dev/md0
if [-e $rootfsRaid]; then
echo -e “\n$rootfsRaid already exists! you need to stop and remove it.\n”
exit 1;
fi

#standard choices
disk=notset
image_img=notset
destroy=false

#handles the arguments and sets options
for (( arg=1; arg<=${#}; arg++ ))
do
case ${!arg} in
/dev/sd?) disk=${!arg};;
*.img) image_img=${!arg};;
“destroy”) destroy=true;;
*) echo “unknown argument: ${!arg}”
exit 1
esac
done

echo “********************** DISK **********************”
echo

#figure out what disk to use
if [$disk = “notset”]; then
for x in {a…z}
do
#avoid a to literal matching in order to avoid incompability.
if [-e /dev/sd${x}]; then
diskTest=$(parted --script /dev/sd${x} print)
if [! -e /dev/sd${x}0 -a ! -e /dev/sd${x}5]; then
if [[$diskTest = *WD??EARS*]]; then
if [[$diskTest = *??00GB*]]; then
if [[$diskTest = *3*B*B*5??MB*primary*]]; then
if [[$diskTest = *1*B*B*2???MB*ext3*primary*raid*]]; then
if [[$diskTest = *2*B*B*2???MB*ext3*primary*raid*]]; then
if [[$diskTest = *4*B*B*GB*ext4*primary*]]; then
if [$disk != notset]; then
echo “multiple disk founds, you must enter the path manually:”
echo " sudo ./debricker.sh /dev/sd?"
exit 1;
fi
disk=/dev/sd${x}
fi; fi; fi; fi; fi; fi; fi; fi
done

if [$disk == notset]; then
echo “script could not find a matching sd unit connected to system.”
exit 1
fi
else
if [! -e $disk]; then
echo “$disk does not exist.”
exit 1;
fi
fi

echo -e “script will use the following disk: \n”
parted --script $disk print
read -p "is this REALLY the disk you want? [y] " -n 1
if ! [[$REPLY =~ [1]$ ]]; then
echo -e “\nuser did not confirm, nothing was done.\n”
exit 1;
fi
echo

diskRoot1=${disk}1
diskRoot2=${disk}2
diskSwap=${disk}3
diskData=${disk}4

echo
echo “********************** IMAGE **********************”
echo

#the image was not given as parameter
if [$image_img = notset]; then
#find out what the latest version of firmware is
if ! which curl > /dev/null; then
echo -e “\nthis script requires the curl package, either install it or specify image file.\n”
exit 1
fi
wdc_homepage=“”
wdc_latestfirmware=$(curl “${wdc_homepage}?type=AP1NC&fw=01.03.03” 2> /dev/null | awk ’ {
if ( match($0, “upgrade file” ) != 0 ) {
split($0, http, “"”);
print http[2];
exit 1;
}
}‘)
latestversion_simple=$(echo $wdc_latestfirmware | cut -d’-’ -f 2)
latestversion_pattern=$(echo $latestversion_simple | sed ‘s/…/&*/g;s/:$//’)
if [“$latestversion_simple” == “” -o “$latestversion_pattern” == “”]; then
echo -e “\ncould not fetch the latest version!\n”
exit 1;
fi
echo “checking: ${latestversion_simple}”
echo “searching: ./*/*${latestversion_pattern}.img”
image_img=$(find ./ -type f -name “*${latestversion_pattern}.img” -print; 2>/dev/null)

#get the latest firmware either from subdirs or internet
case echo $image_img | wc -w in
0) echo “searching: ./*/*${latestversion_pattern}.deb”
test -d “./firmware” || mkdir -p “./firmware”
image_deb=$(find ./ -type f -name “*${latestversion_pattern}.deb” -print; 2>/dev/null)
image_img=“./firmware/rootfs_$latestversion_simple.img”
if ! [echo $image_deb | wc -w == 1]; then
image_deb=“./firmware/rootfs_$latestversion_simple.deb”
echo
echo “downloading: $image_deb”
read -p "confirm [y]: " -n 1
if ! [[$REPLY =~ [2]$ ]]; then
exit 1
fi
echo
curl $wdc_latestfirmware > $image_deb
if [$? != 0]; then
echo -e “\ndownloading encountered problems.\n”
exit 1;
fi
fi
echo
echo “will extract: $image_deb”
read -p "confirm [y]: " -n 1
echo
if ! [[$REPLY =~ [3]$ ]]; then
exit 1
fi
echo “extracting: ./firmware/rootfs_${latestversion_simple}.img”
ar p $image_deb data.tar.lzma | unlzma | tar -x -C ./firmware
if [$? != 0]; then
echo -e “\nextraction encountered problems.\n”
exit 1;
fi
mv ./firmware/CacheVolume/upgrade/rootfs.img ./firmware/rootfs_${latestversion_simple}.img
rm -rf ./firmware/CacheVolume;;

  1. echo “found: $image_img”;;
    *) echo -e “\nmultiple image_img files was found.”
    exit 1
    esac
    else
    if [! -e $image_img]; then
    echo “$image_img does not exist.”
    exit 1;
    fi
    fi

#construct the swap program
echo "\
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/mount.h>

#define MD_RESERVED_BYTES (64 * 1024)
#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)

#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS)

main(int argc, char *argv)
{
int fd, i;
unsigned long size;
unsigned long long offset;
char super[4096];
if (argc != 2) {
fprintf(stderr, "Usage: swap_super device\n");
exit(1);
}
fd = open(argv[1], O_RDWR);
if (fd<0) {
perror(argv[1]);
exit(1);
}
if (ioctl(fd, BLKGETSIZE, &size)) {
perror("BLKGETSIZE");
exit(1);
}
offset = MD_NEW_SIZE_SECTORS(size) * 512LL;
if (lseek64(fd, offset, 0) < 0LL) {
perror("lseek64");
exit(1);
}
if (read(fd, super, 4096) != 4096) {
perror("read");
exit(1);
}

for (i=0; i < 4096 ; i+=4) {
char t = super[i];
super[i] = super[i+3];
super[i+3] = t;
t=super[i+1];
super[i+1]=super[i+2];
super[i+2]=t;
}
/* swap the u64 events counters */
for (i=0; i<4; i++) {
/* events_hi and events_lo */
char t=super[32*4+7*4 +i];
super[32*4+7*4 +i] = super[32*4+8*4 +i];
super[32*4+8*4 +i] = t;

/* cp_events_hi and cp_events_lo */
t=super[32*4+9*4 +i];
super[32*4+9*4 +i] = super[32*4+10*4 +i];
super[32*4+10*4 +i] = t;
}

if (lseek64(fd, offset, 0) < 0LL) {
perror("lseek64");
exit(1);
}
if (write(fd, super, 4096) != 4096) {
perror("write");
exit(1);
}
exit(0);

}" >./swap.c

gcc swap.c -o swap
rm swap.c

echo
echo “********************** IMPLEMENTATION **********************”

echo -e "
everything is now prepared!
device: $disk
image_img: $image_img
destroy: $destroy\n"

read -p "this is the point of no return, continue? [y] " -n 1
echo
if ! [[$REPLY =~ [4]$ ]]; then
exit 1;
fi
echo

#rewrite the partition table
if [$destroy = true]; then
backgroundPattern=“${backgroundPattern:-0}”

dd if=/dev/zero of=$diskRoot1 bs=1M count=32
dd if=/dev/zero of=$diskRoot2 bs=1M count=32
dd if=/dev/zero of=$diskSwap bs=1M count=32
dd if=/dev/zero of=$diskData bs=1M count=32
badblocks -swf -b 1048576 -t ${backgroundPattern} ${disk} 16 0

sync
sleep 2

parted $disk --align optimal <<EOP
mklabel gpt
mkpart primary 528M 2576M
mkpart primary 2576M 4624M
mkpart primary 16M 528M
mkpart primary 4624M -1M
set 1 raid on
set 2 raid on
set 3 raid on
set 4 raid on
quit
EOP

sync
sleep 1

#blocksize 65536 is required by the hardware, you won’t be able to mount if different.
mkfs.ext4 -b 65536 -m 0 $diskData

echo
read -p "destroying was done, would you like to continue with installation? [y] " -n 1
echo -e
if ! [[$REPLY =~ [5]$ ]]; then
exit 1;
fi
fi

#write the image to the raid disk
echo
sync
mdadm --create $rootfsRaid --verbose --metadata=0.9 --raid-devices=2 --level=raid1 --run $diskRoot1 missing
mdadm --wait $rootfsRaid
sync
sleep 2
mkfs.ext3 -c -b 4096 $rootfsRaid
sync
sleep 2

mdadm $rootfsRaid --add --verbose $diskRoot2
echo
echo -n "synchronize raid… "
sleep 2
mdadm --wait $rootfsRaid
sync
echo -e “done\n”
echo "copying image to disk… "
dd if=$image_img of=$rootfsRaid
mount $rootfsRaid $rootfsMount
cp $rootfsMount/usr/local/share/bootmd0.scr $rootfsMount/boot/boot.scr
echo “enabled” > $rootfsMount/etc/nas/service_startup/ssh
sync
sync
sync
umount $rootfsMount
rmdir $rootfsMount
mdadm --stop $rootfsRaid
./swap $diskRoot1
./swap $diskRoot2
rm ./swap

echo
echo “all done! device should be debricked!”
echo


  1. Yy ↩︎

  2. Yy ↩︎

  3. Yy ↩︎

  4. Yy ↩︎

  5. Yy ↩︎

1 Like

Great Help!

I’ll give this a shot.

Don’t want to void the warranty but I’ve already done the RMA once.

Should I just avoid any updates after this?

updates shouldnt matter just make sure you follow the guide and after its all said and done, then do the updates

So I gave up on having the 2 seagate 4tb drives in the Duo.  Instead I am harvesting the 2x(mybook live 3TB) drives I have and making those mybook lives 4TB’s its just gonna take 4 days to do the 3 data transfers so I can keep my stuff. LOL no idea why a Seagate 4TB works in a MBL but not a MBLD.

If you’re running 2 Seagate drives in the MBL Duo, that would explain all kinds of things.  The firmware looks for the vendor ID as well as the product ID.  Putting the WD drives back in should make it work.

[Edit]

As for your MBL, don’t do a firmware update if you don’t want to brick it.  What I said above applies to it as well as the MBL Duo.

Hi Bill,

Does the firmware or the onboard flash memory look for the vender and product ID?

Also I contacted customer support and they said they would e-mail me a list of compatible drives by yesterday for the MBLD.  If you have the info would you mind posting it either here or link me to where it can be found?

Also I didn’t read this until after I flashed the duo.  The 6TB MBLD running 2x 3TB WD green drives updated to the latest firmware without incident.  I am not going to update the seagate 4TB drives currently inside the 2 MBL’s I have.  They work fine but when they go in to what I assume is powersave mode the light goes blue.  If I access the drive it promptly turns green again. Just a little nerve wracking.

Thank you NFODIZ for all of your help!  I got all the drives working and am in the 3rd day of a 4day transfer to get all my files where I want them. (about 10TB over 4 transfers).  AFter deciding upon my disk config so that the duo would boot.  I followed your debrick for the MBL 2 times (plus once in the past) and the MBLD once.  All without incident.  Thank you so much!

P.S.  Timmy1024 thank you for your help too!  

No problem scuba, I’m just glad you were able to get everything running again :slight_smile:

1 Like

Thanks NFODIZ! 

Just in case it matters to someone else I did a firmware update via web via dashboard to both MBL’s with seagate drives and there was no problems.

scubafossil wrote:

Hi Bill,

Does the firmware or the onboard flash memory look for the vender and product ID?

Also I contacted customer support and they said they would e-mail me a list of compatible drives by yesterday for the MBLD.  If you have the info would you mind posting it either here or link me to where it can be found?

 

Actually, the external cases are drive specific.  If you replace them with different drives, you will most likely have issues.  So, you should only use the drives that came with them. 

How do I mount the folder containing the image and .sh file? When in terminal and I type command

./debrick.sh roots.img/dev/sdc destroy

I receive the message

bash: ./debrick.sh: No such file or directory

Everything else has been working as you said so far and I just hit this wall. I am new to working in terminal and I am working from an Ubuntu box.

@nfodiz Thank you so much for this tutorial. After bricking my MBLD when trying to install pyLoad with a different tutorial than yours ( http://community.wd.com/t5/My-Book-Live/GUIDE-Install-pyLoad-on-02-41-05-034/td-p/558511) this unbrickification thing (variant 1) worked just like a charm. KUDOS!!!

Someone should Pinn/Sticky such precious threads…