[Solved] WD MyBook Live Duo / two disks

I've installed 18.06-rc1 on My Book Live Duo, it works (almost) perfectly. Thank everyone for the effort to make it happen!

Though I have a problem: the system boots up regardless I put the disk in slot A or B (detects in both cases as /dev/sda). But it doesn't boot at all, if I put another disk in the other slot. Is there anybody else using the Duo with this release? How to make it work with two disks?

Advice, please!

I've tried it with another disk with no partition table at all (all zeroes) - no boot.
I've tried it with two identical disks (both with the same partitions and data) - no boot.

What could be the problem? Please advice!

You cloned the disk? Does is boot with the other disk alone?

On the other disk I've made an initial install (dd openwrt*.img), and then cloned the partitions from the first disk.
I didn't try to boot from that disk alone, but I will as I got home.

Thanks for the hint...

At the moment I cannot offer an explanation, but I can confirm strange behaviour from previous experiments.

I still have serial hooked op to my Duo from a different experiment (running it from USB). I could look into where the boot process fails on later today, but I would have to dig up two spare disks first.

I have a spare FTDI TTL-232R-3V3 cable somewhere (from JP1 remote experiments), but I don't feel brave enough to connect it to the MBLD. :frowning:
http://mybookworld.wikidot.com/wd-mybook-live-duo-uart

Reading your comment I have a feeling that the problem lies in the device tree somewhere. Perhaps not properly initialized SATA interface? I compared the original and the openwrt version of apollo3g.dtd file (decompiled), but it's a completely unknown field to me...

Alright, I think I found the problem.

TL;DR: The MBL Duo fails to boot if two drives are present and only the the drive on the left ("drive A" in the manual) contains OpenWrt. It boots fine with two drives and OpenWrt only on the right drive ("drive B"), and it boots fine from a single drive. It should also boot if OpenWrt is on both drives, but I couldn't test that to confirm.

Here's what's happening (and someone please CMIIW if I bungled this up):

  • drive 0:1 is the drive in the bay on the right side (called "drive B" in the manual), with two disks present, it gets assigned /dev/sda
  • drive 1:1 is the drive in the bay on the left side (called "drive A" in the manual), with two disks present, it gets assigned /dev/sdb
  • yes, WD enumerates them in reverse in both their manual and the original firmware
  • the MBLD uboot script tries to boot off 1:1 first, and upon failure tries to boot from drive 0:1
  • a single drive (naturally) always gets assigned /dev/sda regardless of what bay it is in

OpenWrt tries to mount its boot partition at /dev/sda2. From /boot/boot.scr in its first partition:

setenv boot_args 'setenv bootargs root=/dev/sda2 rw rootfstype=ext4'

Now if two drives are present and only drive 1:1 ("drive A" on the left) being assigned /dev/sdb contains OpenWrt, the boot partition would be on /dev/sdb2, so naturally the mounting of /dev/sda2 fails:

[    1.089282] VFS: Cannot open root device "sda2" or unknown-block(8,2): error -6
[    1.096588] Please append a correct "root=" boot option; here are the available partitions:
[    1.104913] 0800      1465138584 sda
[    1.104917]  driver: sd
[    1.111008]   0801      1465135104 sda1 c61c1c84-01
[    1.111010]
[    1.117359] 0810       488386584 sdb
[    1.117362]  driver: sd
[    1.123450]   0811            8192 sdb1 5452574f-01
[    1.123451]
[    1.129800]   0812          262144 sdb2 5452574f-02
[    1.129801]
[    1.136150] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)

However, as long as the drive it tries to boot OpenWrt off of is assigned /dev/sda, everything is fine. This is the case for a single drive, and for two drives if only the drive on the right contains OpenWrt.

This puzzles me. It should also work if both drives contain OpenWrt. In this case it would still boot off /dev/sdb, but since /dev/sda2 also contains an OpenWrt boot partition it should be able to just mount that one and be none the wiser. Again, I could not test this case because I didn't have a second spare drive handy, so I can't tell why it would fail for you.

I could imagine a fringe case though: If you accidentally put the image for the My Book Live Single on a drive, I found that it boots fine in either bay of a My Book Live Duo. The hardware apparantly is so close to identical that it works. However, it doesn't work with another drive present.

(As for the reversed enumeration in WD's manual, I can only assume this is done to not confuse people used to reading and numbering things left to right. Since the boot script in uboot does a sata init before checking every single drive to boot off, this would shave a few seconds off the boot process when people only populate "drive A" first. As for what the original firmware mounts as its boot partition, I never looked into the original firmware, but I assume it keeps its boot partition in a RAID between the two drives to circumvent the problem.)

I had no time to play with it yesterday, but I'm quite sure I used the image for the Duo (the board info says it so also). Anyway, I will try all the possible combinations...

The original firmware is even more complicated: the root filesystem is on a raid with four members. There are two copies on each disk, they are used in firmware update process (disassemble raid, update first partition on each disk, if it boots normally, then reassemble the raid with the new firmware).

Thanks, this is in line with what they do with the MBL Single: Two partitions in RAID, at update time they disassemble the RAID, overwrite one partition, mark the other one as bad and have the RAID rebuilt.

Alright, I could find another drive to test (actually an original MBL that is slated for OpenWrt conversion anyway), so I could test what happens with two drives, both containing OpenWrt.

And, as expected, it works fine. As predicted, the MBLD loads its boot script, dtb and kernel image from drive 1:1 ("drive A" in the left bay) which is assigned /dev/sdb. It then continues to mount /dev/sda2 from the other drive 0:1 ("drive B" in the right bay) as root, where it consequently stores all subsequent changes to the root file system.

All tests done with OpenWrt 18.06.0-rc1.

Personally, I would probably run the MBLD with OpenWrt in both drives. There is no downside to the boot process "shared" across the two drives as long as one keeps track which drive contains the configuration. And as the MBR for Single and Duo installations is identical, it is easy to "flash" a drive to convert it between Single and Duo, meaning that you can always take out a drive out of a Duo and put it into a Single enclosure (and vice versa).

Edit: Come to think of it, an MBL Single board boots up just fine on an MBL Duo image, and the MBL Single board identifies completely identical to the MBL Duo (Board: Apollo-3G - APM82181 Board, 2*SATA, 1*USB). I wonder if there is any downside to just using the MBL Duo firmware on a MBL Single. I wonder if the two firmwares could even be unified. Paging Dr. @chunkeey for consultation!

Sure, if you want to give it a try:
https://github.com/chunkeey/apm82181-lede/commit/1f1ef9267a0b8b8d7b0716dcb4679f6f33b55963

Knock yourself out :smile: :wink:

Yikes, that escalated quickly. :slight_smile:

My question was genuine though: There's no downside? With that "unified" image on an MBL Single, SATA0 and USB would just behave as if nothing is ever connected to them, but that should not influence the system negatively, right?

Well, this would need to be tested. My My Book Live Duo has dead SATA ports (probably power related).

As far as other stuff go: the sata driver used to crash if no device was attached... But this was fixed ages ago: https://patchwork.kernel.org/patch/8936891/. What will probably also change is the drive enumeration since the drive will be now on "ata2" instead of "ata1".

(There's also the dma-channel "dma0chan0" that is now occupied / in_use. But nothing is really using it so: meh)

It would have to be tested on a Single anyway. We already know that the Duo works with the Duo image, and AFAICS the unification simply declares "Duo for all!". :slight_smile:

Edited: Never mind, I was confused about the Single, it only uses 1:1.

I'm really interested in this, and willing to test, but I can't do that at the moment. :frowning:
In preparation to use OpenWrt I started to make a snapshot of my Duo. It is estimated to complete in 3 days (~5TB)...

Just as a heads up since you're handling large amounts of data: Reading is a little bit, and writing to disk in OpenWrt is a lot slower than in the original WD firmware (especially through SMB). Presumably this is because the WD firmware uses a nonstandard 64 kb block size vs. OpenWrt's (and pretty much every other Linux kernel's) 4 kb. Adjust your expectations accordingly. On the other hand, you will be able to read your disks with any bog-standard system, something that you cannot (easily) do with original MBL disks.

Thank you, I'm prepared to this. I've read your comments in the other thread.
I'm using mostly nfs (for wdtv and linux desktop) and smb a little (for windows once a month). Speed is a kind of worrying me, but I'll see. Anyway, I can restore the factory firmware at a pinch... :wink:

Some questions: Is this unified firmware available somewhere? Or should I build it with the image builder? Or from the sources? Will this be ready and included in the release version?

At the moment, it's only available in chunkeey's fork of OpenWrt's source code, and it's just about two hours old. :slight_smile: This "unification" is rather cosmetic, it doesn't really improve anything. If you have a MBL Duo, just go with a release version Duo image for the disks. You can always "cross-flash" to a MBL Single or this new "unified" version if and when necessary.

Thank you for all your help!

The snapshot has been completed, so I could make a fresh install (on spare disks for the time being). The Duo behaves exactly as described above: it starts the boot process on sdb1 (slot A / left) and then the root filesystem is mounted from sda2 (slot B / right). However, it's a little bit confusing, that is shows /dev/sda1 mounted as /boot (though it is not the actual boot partition)...

Now I can start experimenting with raid, nfs, smb, etc... :slight_smile:
Looking forward to the final 18.06 release...

Something is wrong with this firmware still...

I created two identical disks, went through the initial setup (network, dhcp, firewall), created the big partitions on both disks for the data (no filesystem, no raid yet), and now it doesn't boot with two disks anymore. It can boot with the first disk (slot B / right - all modifications saved there), but not from the other one. It cannot boot with two disks at all. I've checked the other disk in a desktop PC, it still holds the original openwrt image without any modifications (except for the newly created big partition). I've copied the partitions from the properly working disk to the other one, there's no change, it cannot boot.

I suspect the problem is with the partition table, but cannot find any errors in it. I have no idea what went wrong...