How to unbrick a totally dead WD My Cloud ?
Totally dead ?
I have totally bricked my WD Cloud. "Totally" for me means that the WD My Cloud will not boot ! The front LED is always red !
Unbrick how to
First important things: I'm an Ubuntu user and all of this work was done with this Linux distro.
Second important things: I'm not English and because this, this post contains lot of bad English :( Sorry.
Ok, let's go.
$ dmesg
blablabla
[ 9.024192] sd 0:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.63 TiB)
[ 9.048255] sd 0:0:0:0: [sda] 4096-byte physical blocks
[ 9.061665] sd 0:0:0:0: [sda] Write Protect is off
[ 9.068198] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 9.077504] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn''t support DPO or FUA
[ 9.172478] sda: sda1 sda2 sda3 sda4 sda5 sda6 sda7 sda8
blablabla
JRman explain here (link) how extract the firmware from the archive found on the official WD web site. I have done this step because in my case, the problem is that the Linux rootfs is broken in my WD Cloud.
At this point, I have the "rootfs.img" file and the old disk in which the Linux rootfs is broken connected to my computer.
For this "how to", I demonstrate how is possible to make an completely new disk. For this, I use an old sata disk that I have found in my drawer... This disk is an Fujitsu 160Go.
$ sudo parted -l
Model: Asmedia 1053-3G Ext. HDD (scsi)
Disk /dev/sda: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
3 15.7MB 528MB 513MB primary
1 528MB 2576MB 2048MB ext3 primary raid
2 2576MB 4624MB 2048MB ext3 primary raid
5 4624MB 4724MB 99.6MB primary
6 4724MB 4824MB 101MB primary
7 4824MB 4826MB 1049kB primary
8 4826MB 4828MB 2097kB primary
4 4828MB 4001GB 3996GB ext4 primary
OK. This is an GPT partition disk. I can't done the same partitioning (8 partitions) on the Fujitsu disk with this command. I must use gdisk command
$ sudo gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.5
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): ?
b back up GPT data to a file
c change a partition''s name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition''s type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu
Command (? for help): p
Disk /dev/sda: 7814037168 sectors, 3.6 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 35657341-DEC3-4E25-B65B-37BF00B5123C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7814037134
Partitions will be aligned on 2048-sector boundaries
Total free space is 32365 sectors (15.8 MiB)
Number Start (sector) End (sector) Size Code Name
1 1032192 5031935 1.9 GiB FD00 primary
2 5031936 9031679 1.9 GiB FD00 primary
3 30720 1032191 489.0 MiB 0700 primary
4 9428992 7814035455 3.6 TiB 0700 primary
5 9031680 9226239 95.0 MiB 0700 primary
6 9226240 9422847 96.0 MiB 0700 primary
7 9422848 9424895 1024.0 KiB 0700 primary
8 9424896 9428991 2.0 MiB 0700 primary
I will create later the same partitioning on my old Fujitsu disk. The difference between the two disks will be the fourth partition. On the WD Cloud disk, this fourth partition was ~4To large, in the Fujitsu disk, which has 160Go in total, it's impossible to make the fourth partition with 4To :)
I backup the partition 4, 5, 6, 7, 8 from my WD Cloud old disk. I don't backup the number 1, 2 and 3 because partitions 1 and 2 are the broken Linux rootfs and partition 3 are the "swap" partition.
$ sudo dd bs=1M if=/dev/sda4 of=sda4.img
3996+0 enregistrements lus
3996+0 enregistrements écrits
4190109696 octets (3.9 GB) copiés, 7.0127ex m, 238 kB/s
$ sudo dd bs=1k if=/dev/sda5 of=sda5.img
97280+0 enregistrements lus
97280+0 enregistrements écrits
99614720 octets (100 MB) copiés, 10.5191 s, 9.5 MB/s
$ sudo dd bs=1k if=/dev/sda6 of=sda6.img
98304+0 enregistrements lus
98304+0 enregistrements écrits
100663296 octets (101 MB) copiés, 11.1747 s, 9.0 MB/s
$ sudo dd bs=1k if=/dev/sda7 of=sda7.img
1024+0 enregistrements lus
1024+0 enregistrements écrits
1048576 octets (1.0 MB) copiés, 0.871361 s, 1.2 MB/s
$ sudo dd bs=1k if=/dev/sda8 of=sda8.img
2048+0 enregistrements lus
2048+0 enregistrements écrits
2097152 octets (2.1 MB) copiés, 8.80868 s, 238 kB/s
Now, I try to see what is in there partitions (5, 6, 7, 8. Not the 4 because the partition 4 is my datas :)?
$ file sda*.img
sda5.img: u-boot legacy uImage, Linux-3.2.26, Linux/ARM, OS Kernel Image (Not compressed), 3693624 bytes, Wed Jun 18 00:53:28 2014, Load Address: 0x0F008000, Entry Point: 0x0F008000, Header CRC: 0x2B2D9780, Data CRC: 0x26AD3DC6
sda6.img: u-boot legacy uImage, Linux-3.2.26, Linux/ARM, OS Kernel Image (Not compressed), 3693624 bytes, Wed Jun 18 00:53:28 2014, Load Address: 0x0F008000, Entry Point: 0x0F008000, Header CRC: 0x2B2D9780, Data CRC: 0x26AD3DC6
sda7.img: data
sda8.img: data
I think the partitions 5 and 6 are the copy of Linux kernel (twice). The kernel is copied apparently during the post-install. I found this in the kernel-mindspeed-sequoia.postinst file.
kernel_copy ()
{
kernelFile=${upgradePath}/boot/uImage
if [ -e "${kernelFile}" ]; then
## TBD: Add multi drive support
#dd if=${kernelFile} of=${kernelPart1}
#dd if=${kernelFile} of=${kernelPart2}
##
dd if=${kernelFile} of=/dev/sda${kernelPart1}
dd if=${kernelFile} of=/dev/sda${kernelPart2}
fi
echo "Done kernel partition copy."
}
_install ()
{
# perform copy and configure only when installing on a real target
[ ! -f /tmp/nas_build ] && kernel_copy
[ ! -f /tmp/nas_build ] && control_copy
configure
}
This two partitions contain
- uImage header, header size: 64 bytes, header CRC: 0x2B2D9780, created: Tue Jun 17 22:53:28 2014, image size: 3693624 bytes, Data Address: 0xF008000, Entry Point: 0xF008000, data CRC: 0x26AD3DC6, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "Linux-3.2.26"
- Linux kernel version "3.2.26 (buildmeister@ubuntu) (gcc version 4.7.3 20130102 (prerecc version 4.7.3 20130102 (prerelease) (crosstool-NG linaro-1.1"
The partitions 7 and 8 contain the same sh script. This script is an uBoot script used to find the kernel, initrd and the rootfs. Without this, your NAS can't boot !
#!/bin/sh
## Button initial state
btn_status=0
get_button_status
sata
satapart 0x3008000 5 0x5000
sata stop
# This is customized for each environment variable script
bootargs="console=ttyS0,115200n8, init=/sbin/init"
bootargs="$bootargs root=/dev/md0 raid=autodetect"
bootargs="$bootargs rootfstype=ext3 rw noinitrd debug initcall_debug swapaccount=1 panic=3"
bootargs="$bootargs mac_addr=$eth0.ethaddr"
bootargs="$bootargs model=$model serial=$serial board_test=$board_test btn_status=$btn_status"
bootm /dev/mem.uImage
I need a last one backup. It's the GPT table. We can find it at the start of the disk. It size is 16384 bytes length.
$ sudo dd bs=1 if=/dev/sda of=gpt.img count=16384
In this table, we can find the GPT Header with its own « UEFI PART » signature
$ hd gpt.img | more
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 02 00 ee ff ff ff 01 00 00 00 af 9e a1 12 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...|
Or the Linux GUID RAID A19D880F-05FC-4D3B-A006-743F0F84911E
00000400 0f 88 9d a1 fc 05 3b 4d a0 06 74 3f 0f 84 91 1e |......;M..t?....|
Next step, partitioning the new disk
Unplug the old disk (WD Cloud broken disk) and plug the new disk (Fujitsu old disk). Find it.
$ dmesg
blablabla
[15975.809541] sd 10:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB)
blablabla
Erase all old partitions with gparted or other similar tool and go to gdisk to create the structure like the WD Cloud disk saw earlier. In gdisk, I have used the n command to create new partition, the c command to change the partition's name and the t command to change the partition's type code.
Now, my Fujitsu disk have the same partitions as the WD Cloud disk except the partition 4. This is normal because the Fujitsu disk is an 160Go disk and the WD Cloud disk is an 4To disk.
...
Command (? for help): p
Disk /dev/sdb: 312581808 sectors, 149.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A3B92D9A-968A-4BFB-930E-A40DCC2D0717
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 312581774
Partitions will be aligned on 2048-sector boundaries
Total free space is 32365 sectors (15.8 MiB)
Number Start (sector) End (sector) Size Code Name
1 1032192 5031935 1.9 GiB FD00 primary
2 5031936 9031679 1.9 GiB FD00 primary
3 30720 1032191 489.0 MiB 0700 primary
4 9428992 312580095 144.6 GiB 0700 primary
5 9031680 9226239 95.0 MiB 0700 primary
6 9226240 9422847 96.0 MiB 0700 primary
7 9422848 9424895 1024.0 KiB 0700 primary
8 9424896 9428991 2.0 MiB 0700 primary
Now, I restore the partition from the files I have created earlier and the rootfs.img I have extracted earlier to.
Rem: the plugged disk is the Fujitsu disk.
$sudo dd bs=1 if=gpt.img of=/dev/sdb count=16384
16384+0 enregistrements lus
16384+0 enregistrements écrits
16384 octets (16 kB) copiés, 0.301818 s, 54.3 kB/s
$ sudo dd bs=1M if=rootfs.img of=/dev/sdb1
1952+1 enregistrements lus
1952+1 enregistrements écrits
2047803392 octets (2.0 GB) copiés, 43.6159 s, 47.0 MB/s
$ sudo dd bs=1M if=rootfs.img of=/dev/sdb2
1952+1 enregistrements lus
1952+1 enregistrements écrits
2047803392 octets (2.0 GB) copiés, 43.27 s, 47.3 MB/s
$ sudo dd bs=1M if=sda5.img of=/dev/sdb5
95+0 enregistrements lus
95+0 enregistrements écrits
99614720 octets (100 MB) copiés, 2.61089 s, 38.2 MB/s
$ sudo dd bs=1M if=sda6.img of=/dev/sdb6
96+0 enregistrements lus
96+0 enregistrements écrits
100663296 octets (101 MB) copiés, 2.23928 s, 45.0 MB/s
$ sudo dd bs=1M if=sda7.img of=/dev/sdb7
1+0 enregistrements lus
1+0 enregistrements écrits
1048576 octets (1.0 MB) copiés, 0.0741658 s, 14.1 MB/s
$ sudo dd bs=1M if=sda8.img of=/dev/sdb8
2+0 enregistrements lus
2+0 enregistrements écrits
2097152 octets (2.1 MB) copiés, 0.10491 s, 20.0 MB/s
Unplug your Fujitsu disk from your computer, plug it in the WD Cloud sata connector. Plug the network cable and the DC supply.
And, Welcome back :)
Make filesystem for datas
The final step is to make the filestytem for the datas partition (sda4). I choice to make it directly from WD Cloud. To do this, activate the ssh network service and connect the computer to the WD Cloud with a shell.
The default password is « welc0me ». After that, create ext4 partition on /dev/sda4 and reboot WD Cloud.
$ ssh root@ip.address.of.your_cloud
root@ip.address.of.your_cloud''s password:
Linux WDMyCloud 3.2.26 #1 SMP Tue Jun 17 15:53:22 PDT 2014 wd-2.2-rel armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Nov 13 02:08:42 2014 from ip.address.of.your_cloud
WDMyCloud:~# dmesg
blablabla
[ 402.657391] EXT4-fs (sda4): bad geometry: block count 487200000 exceeds size of device (37893888 blocks)
blablabla
WDMyCloud:~# mkfs.ext4 /dev/sda4
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
9478144 inodes, 37893888 blocks
1894694 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1157 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information: done
WDMyCloud:~# reboot
Broadcast message from root@WDMyCloud (pts/0) (Thu Nov 13 02:13:29 2014):
The system is going down for reboot NOW!
WDMyCloud:~# exit
logout
Connection to ip.address.of.your_cloud closed.
WD Cloud disk
Of course, if your problem is the same as mine but you want to keep your original WD drive, you can just do the same steps on this disc.