Recovering Western Digital My Cloud NAS device

Jerry Komor     

This process can be used to recover bricked device or just to upgrade to larger disk drive

About 8 months after I bough my 4TB WD My Cloud NAS drive it decided that it did not wanted to provide access to any of the shares nor let me into the console. After a very lengthy call with WD support they had it replaced after trying to extort money for the replacement unit while it was still under warranty. The drive run fine ever since. I was slowly starting to run out of space on the device and as I wanted to keep power consumption to minimal and I was on a kick of shrinking my servers in the rack I had virtualized all of my servers leaving me with just with a single host and about 10 to 14 VM running inside of it at any one time. With the shrinkage of physical servers and no place to put my extra files on I decided to by another 4TB NAS drive. The new drive also gave me the possibility of splitting my data/files so that I would have my media / pictures / personal / etc ... files on one drive and other stuff like tools I use and just random apps on another drive. The new drive had been running for some time again, however this time it passed warranty period. where again it just stopped responding and after restarting it just did not wanted to boot and had this infamous white light ON and just did not wanted to boot up. I'm not an a.... cause as  some people would have called WD and start complaining about till they got it their way. But... Not sure exactly how many times I tied to power down and boot up. I even tried soft and eventually hard reset to it just did not wanted to recover so I just left it alone as it did not had anything i could not get back from other machines and got my self a 4 bay NAS device capable of  RAID 5 so that if a drive fails it would still run on the CRC checksum. I slapped a 1TB drive that I had lying around and really never expanded it to full 16GB RAID 5 setup. One day as the 1Tb drive started filling up again I decided to turn the 4TB drive back on to see what would happen miraculously it booted up. Surprisingly I did not lost anything from it and kept on using it as nothing had happened. They run for another year where the second drive crapped out again, this time the drive was full of stuff, defaulting the drive to factory and possibly loosing everything was not an option.
Not wanting to loose anything and as the drive was out of warranty decided to open up the case and see if I could copy data from it. First thing I tried was to hook it up to my windows machine Unfortunetaly it did not wanted to read the drive and prompted to format it. Well that definetaly as not a good first sign. After some quick search, I had found out that the My Cloud devices are running Linux.... thou how obvious. Out came the Windows OS disk and came Linux disk. Boot it up and whaaa  laaa. there's my data in all of it glory. Quickly turned on one of my servers with enough disk space and ported the data to it.
Now what, have the data back, preassure of possibility loosing it is gone but its on a physical server that is loud and running 2Amps (240w) of power...... not very power efficient as the tiny NAS running on only 16w.
After fruitless restarts and trying to restore to factory OS defaults she still does not want to boot. At a loss and not making progress, decided to take off to the wealth of information on internet.
Found couple of good solutions to the problem but all really evolved around re-imaging the drive with fresh OS. One cool idea was to take currently running device and take OS snapshot and save it to local share. One cavit is to default the OS to factory. Other option is to find "virgin" copy of the OS that could be used as source and applied to the drive. After numerous downloads of the OS images and all being corrupted and just not having much of a luck getting the drive running decided to get a copy of OS from still running drive. However decided to skip on defaulting the OS to factory trying to avoid of possibly messing up the running drive and just for the sake of reinitializing it backup.
After making a backup of my running drive (without resetting to factory) I managed to restore the bricked device but for some reason it has just sluggish and was pausing randomly or just dropping connections. So off I whent back on a hunt of "virgin" OS images. After some time searching I had found couple "virgin" images of 2 and 3 TB devices. I never tried the 3TB and just used 2TB image and it worked perfectly fine. One thing I had to do was to resize the data partition 4 from 2 to 4TB well actually 6TB as I decided to get a larger drive as I had bought it for the 4bay device but never used. The fact that the 6TB drive is SATA III which really does not matter but the fact that it has larger buffer size, the overall performance is much faster. Also the drive runs cooler then the 4TB drive which is additional bonus.  
Maybe at some point I'll try upgrading the first NAS to 8TB if I have nothing better to do or just want to waste $300 for new drive.

So if you like to make a backup of your current My Cloud OS and partition table you will need to do following and you don't even need to open the drive up.

1. Boot up your MyCloud device log into it and make sure SSH is enabled. Once you confirmed that its on you can logout from it.

2. Login to the drive using PuTTY (Windows) or Terminal on (OSX) or terminal on your Linux machine.

Type this command to reset the firmware to a factory state, this will give you standard WD defaults as per brand new out of box experiance and you will not have to guess on passwords, IP of the device or change name or anything that was custom set.

    /usr/local/sbin/ noreformat

Following command will backup OS all of the OS partitions etc minus any data on data partition 4. This assumes you have share name called  Public or you can change public to any share thats you have setup on your device

    dd if=/dev/sda of=/DataVolume/shares/Public/mycloud.img bs=1M count=5000

After about 5 minutes you will have a virgin Image of your OS and partitions, you can move it somewhere else for safe keeping if at any time you need to restore your device. Below table is sample of 6TB hard drive partition table. Please do not take it as the defacto for yours as you may have drive with different geomertry due to different brand or type.


Now to restore image to the drive, the drive will need to be physically connected to a PC via either USB adapter or to SATA port. So if you are trying to recover your original drive you have no choice but to open up the case. Its very simple and if you are carefull  not like me and with a bit of patiance you will not break any locking tabs on the case. The case has 4 small tabs that hold the outer shell (sides and front) to the edges (top, back and bottom). You can insert a small flat blade on top front and you can crak open the case and gently loosen remaining tabsand slide the case off. Or if you have strong finger dexterity, hold top and bottom back corners of the case and push on back center of the case, the back panel will bow in and while its doing it will release the tabs and again you can slide cover from the device.
Once the cover is removed you can gently lift front of the drive and it will slide out of the frame. The drive will have a controller bolted to it with 3 screws covered with kapton take as security device. You either rip the tape off and remove the screws or put the drive back together if you dont want to void warranty.
once you remove the screws and unplug the controller you can either plug it to SATA port on PC or  use USB adapter.

mycloud 2TB v03.00.03-413 virgin image

If you are running Linux you have all tools that are required
If you are running Windows you will need DD tool to apply image to the drive and possibly 7zip to extract the image if you downloaded from here.  GPART or other partitioning utility if you want to expand the data partition.
Or you can download System Rescue CD, burn it to CD or USB drive.
You will also need a USB flash drive if you are booting of CD

If you downloaded image from here you will need a minimal 4Gb USB flash drive to hold the image. If you plan of  booting from USB drive make sure the flash drive is big enough to hold your OS and the image.

Assuming you are using CD to boot with SystemRescueCD and flash drive. I would also suject that if you have any other hard drives in the system you may want to disconnect them at this time so that you only have the singe hard drive for your NAS device.
1. format flash drive with NTFS partition on your Windows PC and extract image from the compressed file or if you have your own copied it into it
2. with destination hard drive plugged into PC put the CD in and plug in USB flash drive.
3. Bring boot menu up and boot from CD
4. From system rescue CD boot into graphical option. you may see some errors while its booting, you can just ignore them at this time.
5. verify that you can see the hard drive. if you only have the single hard drive it will be mounted as /dev/sda
6. Within terminal window mount the USB flash drive with following commands

       mkdir /mnt/usb
       mount -t ntfs /dev/sdb1 /mnt/usb
Do a listing of the USB drive to make sure you can see the image file

7. Make sure hard drive is dismounted and apply image to the drive

       umount /dev/sda
       dd if=/mnt/usb/mycloud.img of=/dev/sda bs=1M

8. You can now shut down the system by entering shutdown -h now  command and trying the new drive after plugging in the controller onto the drive and see if you can get the blue light.   or you can simply skip the extra step and just extend partition to its maximum. If you just want to extend the partition start gpart select sda4 partition and extend it to maximum and apply changes.  For some reason that did not worked for me and I had to delete the partition and create a new one. One thing to watch for is to make sure its formated as ext4. 

You can now assemble everything back together and enjoy the fact that you recovered your NAS.

NOTE: One thing to keep in mind is that image from this site had old v3x firmware version, Your device might automatically upgrade it self to latest version once it reaches WD site.












From windows:
  1. Download “Disk image”: 1.4k
  2. In “Physical drives” choose WD drive.
  3. Choose “Partition 1”, press “Import from file”
  4. Agree to all messages (3)
  5. Switch to “Any file type” and choose rootfs.img
  6. Repeat steps 3-5 for Partition 2.
  7. Repeat steps 3-5 for Partition 5, but choose “kernel.img”
  8. Repeat steps 3-5 for Partition 7, but choose “config.img”
  9. Close app. Shutdown PC. Place disk in WDMC, turn it on
  10. Profit?

Also you can try “dd for windows”:

  1. Download DD: 457 and unzip to any folder. (C:\dd for example)
  2. Run “Command promt” (Start - All programs - Standart - command promt - right click - Run as administrator.)
  3. Type  cd C:\dd
  4. Type  dd --list.  Find your WD disk (For exapmle: \?\Device\ Harddisk1 )
  5. dd if=c:\dd\rootfs.img of=\?\Device\ Harddisk1 \Partition0 bs=1M --size --progress
  6. dd if=c:\dd\rootfs.img of=\?\Device\ Harddisk1 \Partition1 bs=1M --size --progress
  7. dd if=c:\dd\kernel.img of=\?\Device\ Harddisk1 \Partition4 bs=1M --size --progress
  8. dd if=c:\dd\config.img of=\?\Device\ Harddisk1 \Partition6 bs=1M --size --progress
  9. exit
  10. Shutdown PC. Place disk in WDMC, turn it on.
  11. Profit?




Manually restoring OS partisions

unmount amd mirror OS partisions
mdadm --stop /dev/md127
mdadm -A /dev/md0 /dev/sdd1 /dev/sdd2

mkdir /mnt/usb
mount -t ntfs /dev/sdc1 /mnt/usb
cd /mnt/usb

dd if=kernel.img of=/dev/sdd5
dd if=kernel.img of=/dev/sdd6
dd if=config.img of=/dev/sdd7
dd if=config.img of=/dev/sdd8
dd if=rootfs.img of=/dev/md0