martedì 6 febbraio 2018

Unbrick a DEAD WD My Cloud 4TB and convert in a Linux Box

WD MyCloud suddenly went unaccessible.
My data as well, so I had to physically unbrick it.
Here's how I managed to repair it and convert it.

Instructions to open it with a credit card without voiding warranty are available all around the internet. However, as soon as you'll reach the HD, you'll need to break the paper/plastic seal in order to remove the HD. This will void your warranty. You could fake your shop, but not WD.

If you need an image up to 6TB, you can find some links here (from Korean):
https://translate.google.com/translate?hl=it&sl=ko&tl=en&u=https%3A%2F%2Fwww.wsgvet.com%2Fbbs%2Fboard.php%3Fbo_table%3Diomega%26wr_id%3D452&sandbox=1

In case links don't work, you can google for mycloud4tb.7z or the firmware for 2TB / 3TB mycloud.img. I used a 2TB firmware version 3 (5.24GB) instead of my original 4TB version 4. I managed later to resize the partition (instructions below) and eventually upgrade the firmware via the builtin GUI tool. Then I decided to skip the firmware upgrade since I replaced the firmware with a clean Debian and an alternative cloud manager: I need more speed and a stable NFS protocol support.

I used my Mac, but you can also use e.g. Live Ubuntu (free) on your PC, or on Virtualbox for Mac (free). In case of Virtualbox, you just need to select and virtually attach the USB adapter to make it visible to your VM (instructions googling around). From the VM you're free to install whatever operative system: I suggest Debian Jessie.

Before you ask or try, I already tried to install a standalone distro via live CD (in my case OpenMediaVault NAS, a Debian-based distro) and it didn't work: red led and no network connection. I suppose that the hardware doesn't support any of the most common distros, so you'd better follow the instructions below.

References:
FIRMWARE https://community.wd.com/t/guide-debrick-a-completely-dead-mycloud/92253
MOD https://community.wd.com/t/clean-os-debian-openmediavault-and-other-firmwares/93714

STEP BY STEP:
  • removed the HD from the case
  • attached to a USB-to-SATA cable to my Mac
  • "This disk is unusable" alert on my Mac. Just press IGNORE
  • from the terminal type: ls /dev/disk*
  • you'll find that
    • disk0 is the recovery partition for your Mac
    • disk1 is your Macintosh HD
    • disk2 is the USB attached WD HD
PAY ATTENTION: after this step you'll lose all your data. To backup it, you can use Mac-Fuse to read and mount the EXT4 partition.
  • type dd if=/Users/youruser/Desktop/mycloud.img of=/dev/disk2
  • you can monitor the progress on Mac with CTRL+T or on ubuntu just append to the command above " status=progress". It takes 30 mins or less. On Mac you'll be alerted by the dialog "this disk can't be read"...
  • plug the WD HD into the original board, attach power and LAN and you're done
  • expect the LED to become Yellow -> blinking -> fix blue
  • from the GUI, enable SSH
Then I followed the instructions here, which involve also how to resize the partition with the command "parted", however I'll list them below: https://community.wd.com/t/guide-how-to-unbrick-your-2tb-3tb-4tb-my-cloud/93336

Via SSH on WD MyCloud:
  • parted
  • Enter the following commands in the (parted) prompts:
  • unit s
  • p
  • Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used. OK/Cancel?
  • OK
  • Warning: Not all the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 39070080000 blocks) or continue with the current setting?
  • Fix
  • We're looking for the start sector of the last partition (4).  I would think it would be the same on 3TB and 4TB, but I can only speak for the 4TB, which is 9428992.
  • rm 4
  • mkpart primary
  • File system type?   [ext2]?
  • ext4
  • Start?
  • 9428992s
  • End?
  • 7814037167s
  • Warning: You requested a partition from 9428992s to 7814037167s (sectors 9428992..7814037167). The closes location we can manage is 9428992s to 7814037134s (sectors 9428992..7814037132). Is this acceptable to you Yes/No?
  • Yes
  • quit
  • Now you're back to the command prompt..
  • sync
  • reboot
First boot can take a while. For 3TB/4TB Drives, once you get to the dashboard, do a Quick Factory Restore. This reformats your data partition to its full size. Once it reboots, DON’T PANIC. It will show as only 2GB for a short time.

######## MODDING #########

For the Modding, my WD hardware is MyCloud GEN1 (part number is WD-BCTL). Follow the MOD link I pasted before and you'll get here: https://drive.google.com/drive/folders/0B_6OlQ_H0PxVZTBtM3EyRVhDVms

A decent and detailed guide in German is here, Google Translate makes a good job:
https://translate.google.it/translate?hl=it&sl=de&tl=en&u=https%3A%2F%2Fwww.onderka.com%2Finhalt%2Fwd-mycloud%2Fdebian-auf-der-wd-mycloud%2F

STEP BY STEP:
  • inside WDMyCloud-GEN1 download the autoinstall folder
  • download your folder of interest between OpenMediaVault, or CleanDebian depending on what you need: download the WHOLE folder
  • unzip all the files
  • connect to MyCloud via your PC / Mac and mount Public folder
  • copy all the downloaded files into the Public folder, ignoring their folders: you'll come up with 4 files from Autoinstall and several files from the folder chosen before, e.g. OMV has 2, Backup has 4
  • cd /DataVolume/shares/Public
  • chmod +x install.sh
  • ./install.sh
  • After 10 minutes the device reboots
  • optionally run "bash run_me_after_reboot.sh" for additional tweaks and cleanups
I prefer Clean Debian because it runs faster and you are free to install whatever software on top of it, included the latest OMV.

For your convenience, in case you need to rollback, you can even dd the image drive and also downgrade the firmware. Here's a list of original firmwares, manuals, goodies to download:
https://community.wd.com/t/wd-my-cloud-v3-x-v4-x-and-v2-x-firmware-versions-download-links/148533?source_topic_id=190846