File recovery from WD My Book World Edition NAS

I have a NAS WD ® My My Book World Edition and was happy with it but after six years of constant usage the device stopped working. At first from time to time the NAS was not accessible but a restart helped. Then one day it completely stopped to respond and the LED boot indicator (white light) showed no progress at all any longer.

Lucky you if you have a recent back-up. Mine was not recent enough and there were some pictures on the NAS that I wanted to recover?! So here is what happened and may help you as well. A few useful links that helped me can be found at the end of this article.

I provide this as a report about what helped in my situation yours may be completely different and if you follow the steps given in this article you act on your own risk and I will not be liable for any damage! I assume you have some knowledge of Linux and drives.

I hope you have  a backup of your data 😉

Well there are three main components of such a device that may break down. The power adapter, the controller and the harddrive. In my case the controller has a malfunction but the hard drive and power adapter were working.

There is a grain of salt for you. I was lucky that the drive was still working but if you have a problem it may as well be the case that your hard drive has a major failure. If you desperately need the data recovered don’t tinker around with it, please seek out professional support. Following the steps in this article may worsen the situation and you may lose all data.

Windows will kind of detect the drive but will not display it easily so I used Ubuntu 12.04.

Just mounting the drive to get a look at the data?

My first shot at the problem was to just mount the drive to see what happens. With the following command. (If your drive is not discovered as sdb you will have to change it accordingly maybe to sdc4, sdd4, …)

sudo mkdir /media/sdb
sudo mount -t ext3 -o ro /dev/sdb4 /media/sdb

Now you can explore the drive with the nautilus filemanager GUI. However there was no accessible data on that drive.The good news for me was that my drive looked physically OK!

So next tool please.

Using palimpset to look at the drive

There is a disk utility program that provides a nice graphical overview about what you have on a drive. The English name for it is “disk utility” the German name is “Laufwerksverwaltung”. So you better use the name palimpset if your GUI is not set to English by default.

Open the Ubuntu dock (press the windows key), enter palimpset and select the drive manager.  This will open the following program that allows you to have a look at installed hard drives.

Bildschirmfoto vom 2015-04-18 23:42:08-small

As you may see there are 4 raid partitions on that drive.

Partition one to three (sdb1, sdb2, sdb3) contain the operating system and swap partition of the WD controller.

Partition four (here sdb4) is the larger partition and contains the data.

So my version of the WD My book world edition utilizes for some reason a soft raid system that you can use on a Linux machine by installing mdadm. For the standard use case this is just adding hassle. Raid from my point of view makes most sense in set-ups of two and more disks for your data.

Using the tool parted to get drive information

$ sudo parted -l
Modell: ATA SAMSUNG SSD 830 (scsi)
Festplatte  /dev/sda:  128GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos

Nummer  Anfang  Ende    Größe   Typ       Dateisystem     Flags
1      32,3kB  62,9GB  62,9GB  primary   ntfs            boot
2      62,9GB  105GB   42,0GB  extended
5      62,9GB  82,9GB  20,0GB  logical   ext4
6      82,9GB  103GB   20,0GB  logical   ext4

Modell: ATA WDC WD10EARS-00M (scsi)
Festplatte  /dev/sdb:  1000GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt

Nummer  Anfang  Ende    Größe   Dateisystem     Name     Flags
1      32,9MB  2040MB  2007MB  ext3            primary  RAID
2      2040MB  2303MB  263MB   linux-swap(v1)  primary  RAID
3      2303MB  3315MB  1012MB  ext3            primary  RAID
4      3315MB  1000GB  997GB                   primary  RAID

Modell: ATA WDC WD20EFRX-68E (scsi)
Festplatte  /dev/sdc:  2000GB
Sektorgröße (logisch/physisch): 512B/4096B
Partitionstabelle: gpt

Nummer  Anfang  Ende    Größe   Dateisystem  Name  Flags
1      1049kB  1144GB  1144GB  ext2
2      1144GB  2000GB  856GB   ext2

Installing the multi device administration program (mdadm)

To work with raid drives you will have to install the mdadm program.

$ sudo apt-get install mdadm</pre>
...
Generating mdadm.conf... done.
Removing any system startup links for /etc/init.d/mdadm-raid ...
update-initramfs: deferring update (trigger activated)
* Starting MD monitoring service mdadm --monitor [ OK ]
...

Then you can some brief information about the drive by invoking mdadm as shown here.

$ sudo mdadm --examine /dev/sdb1

/dev/sdb1:
Magic : a92b4e
Version : 0.90.00
UUID : 2ac90fc8:85f6502a:3b
Creation Time : Thu Mar 11 04:54:42 2010
Raid Level : raid1
Used Dev Size : 1959872 (1914.26 MiB 2006.91 MB)
Array Size : 1959872 (1914.26 MiB 2006.91 MB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 0

Update Time : Sat Apr 18 12:52:12 2015
State : clean
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
Checksum : 3e885ad7 - correct
Events : 481246

Number Major Minor RaidDevice State
this 0 8 1 0 active sync /dev/sda1

0 0 8 1 0 active sync /dev/sda1
1 1 0 0 1 faulty removed

A word of caution. In my case rebooting the machine now leads to a situation where Ubuntu discovered a raid file system and asks you if you want to mount it. I chose not to do this to stay on the save side. After this question you may end up in a bootloader, to be more specific in initramfs, here you should type “exit” and if asked to manually mount the drive you should not do it. Thereafter you boot normally into Ubuntu.

I booted up in this constellation a few times and once I discovered that the drives were mounted, shown in Nautilus and usable! That is all the below would not be necessary if this would work all the time. However I do not know how to reproduce this.

 My way to success

My procedure in short is:

  1. Get the WD hard drive out of it’s case and plug it into the PC
  2. Get a second hard drive to store the recovered data from the WD drive
  3. Generate a copy of the WD data partition to the other hard drive
  4. Bring up that image as a device
  5. Start the device with mdadm as a raid device
  6. Mount the raid device as a normal drive

Generate a copy

First I generated a copy of the sdb4 drive with the dd command. This took some time, in my case 24 hours. The recovery drive is the sdc drive and the sdc1 partition on it is big enough to contain the image.

$ sudo dd if=/dev/sdb4 of=/media/sdc1/sdb4.img bs=4096 conv=sync,noerror
1055197+0 Datensätze ein
1055196+0 Datensätze aus
4322082816 Bytes (4,3 GB) kopiert, 50,5156 s, 85,6 MB/s
1236669+0 Datensätze ein
1236668+0 Datensätze aus
5065392128 Bytes (5,1 GB) kopiert, 59,0936 s, 85,7 MB/s
...

Bind in the image as a device

With the losetup command it is possible to bind the image as a device. On my machine it is /dev/loop0. See [2].

$ sudo losetup -d /dev/loop0
$ sudo losetup /dev/loop0 /media/sdc1/sdb4.img

The command losetup -d is used to unbind any possible previous use of the loop0 device. Usually unnecessary, here I do it just to be sure.

Start the raid

$ sudo mdadm --assemble /dev/md4 /dev/loop0

mdadm: /dev/md4 has been started with 1 drive (out of 2).

Mount the raid

$ sudo mount /dev/md4 /media/raid_img

Useful links in English

  1. http://community.wd.com/t5/WD-ShareSpace/HOWTO-Recover-files-from-a-RAID-1-mirrored-drive-when-the/td-p/138448
  2. http://wiki.osdev.org/Loopback_Device
  3. http://unix.stackexchange.com/questions/72279/how-do-i-recover-files-from-a-single-degraded-mdadm-raid1-drive-not-enough-to
  4. http://mybookworld.wikidot.com/forum/t-90514/how-to-recover-data-from-wd-my-book-world-edition-nas-device
  5. https://www.linuxquestions.org/questions/linux-server-73/mdadm-assemble-raid5-with-loopback-mounted-disk-images-715343/
  6. http://unix.stackexchange.com/questions/72279/how-do-i-recover-files-from-a-single-degraded-mdadm-raid1-drive-not-enough-to

Useful links in German

  1. http://www.florian-fritsch.com/mdadm-raid-nach-ausfall-wiederherstellen/
  2. http://www.synology-wiki.de/index.php/Datenrettung_von_Raid-Systemen_unter_Linux
  3. http://www.zeroathome.de/wordpress/platte-platt-datenrettung-mit-ddrescue-und-grml/

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.