User Tools

Site Tools


toh:wd:mybooklive

Western Digital My Book Live ("Single") / My Book Live Duo

Western Digital My Book Live "Single"/Duo

Supported Versions

Hardware Highlights

ModelVersionSoCCPU MHzRAM MBGbit portsSATA portsUSB
MyBook LiveDuoAppliedMicro APM82181800256121x 2.0
MyBook LiveSingleAppliedMicro APM8218180025611-

Installation

Warning: By installing OpenWrt, you will lose all existing data on your disk(s). Their MBR (master boot record) containing the partition table will be overwritten. In addition, the original Western Digital firmware's disk format uses a nonstandard 64 kB block size, rendering the data inaccessible to OpenWrt and most other systems. Back up your data to another drive before installing OpenWrt.

Builds for the MBL Duo prior to 18.06 (or snapshot r7526 dated 2018-07-16) contain a bug that prevents proper operation if two disks were used and either contained anything other or more than the default OpenWrt partitions. Although an official 17.04 build exists, for all intents and purposes, MBL Duo support started with OpenWrt 18.06. Please see also the notes for MBL Duo below.

Remove the disk from their enclosure (easy on MBL Duo, a bit more elaborated on MBL Single) and connect it to a host computer running Linux. Download the OpenWrt firmware image to your host computer.

Note: Up to OpenWrt 18.06, firmware images existed in two flavors, duo for the Duo and “not-duo” for the Single. In 19.07 and later there is only one firmware image that works with both Single and Duo variants – use the factory image for an initial installation and the sysupgrade image for updates.

gunzip the downloaded .img.gz file to receive the image file ending in .img. Write this image file to the MBL disk using

# dd if=<image>.img of=/dev/sdx bs=64k

This usually requires root privileges on your system. Replace /dev/sdx with the actual device the MBL disk is attached to. Warning: This overwrites the target disk with a new MBR (master boot record) and a new partition table. You will lose all existing data on the target disk. If you choose the wrong device, you may accidentally overwrite your system disk or another disk you may care about, so double and triple check to make sure you are writing to the correct disk.

Re-insert the disk into their enclosure. Like with other single-port OpenWrt devices, the ethernet port will by default be assigned to the LAN interface with static IP 192.168.1.1 and serving DHCP. You can now proceed to configure OpenWrt to your liking, add further partitions to the disk and install additional packages.

Additional disk partitions

Writing OpenWrt to a disk creates two default partitions:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192           24575   8.0 MiB     8300  Linux filesystem
   2           32768          557055   256.0 MiB   8300  Linux filesystem
   

or in Snapshots after 2019/06/25:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            8192           24575   8.0 MiB     8300  Linux filesystem
   2           32768          294911   128.0 MiB   8300  Linux filesystem

The My Book Live being a NAS, you will probably want to use the rest of your significantly larger disk. It is tempting to simply enlarge the second (“rootfs”) partition to the end of the disk, but you would lose the ability to sysupgrade later – sysupgrade would reset the partition to its default size and you would lose all additional data. The correct way is to create one or more additional partitions using fdisk (MBR) or gdisk (GPT for disks larger than 2TB) and, using fstab, mount them into the file system where needed.

The recent change in the default rootfs partition size suggests that the size of the default partitions should be considered somewhat variable. For this reason it is sensible to start additional partitions not completely flush to the default partitions but rather with a bit of buffer inbetween (for example, starting the 3rd partition at sector 2097152, 1GB into the disk). This allows default partitions in future versions to expand without the danger of overwriting the beginning of an additional partition.

Notes for My Book Live Duo

Drive enumeration

Contrary to Western Digital documentation and nomenclature, the MBL Duo hardware enumerates its SATA ports beginning from the right: When viewed from the front, SATA port 0 is located in the right bay (“Drive B” in the manual), SATA port 1 in the left bay (“Drive A” in the manual). If disks are inserted in both bays, the disk in the right bay is assigned /dev/sda, the disk in the left bay /dev/sdb. OpenWrt will mount its root on /dev/sda2, consequently boot will fail if the disk in the right bay does not contain OpenWrt. If both disks contain OpenWrt, all changes to its configuration will be made to the disk in the right bay.

When used with two disks, the MBL Duo requires the disk in the right bay (“Drive B” in the manual) to contain OpenWrt.

If only one disk is inserted it will be assigned /dev/sda regardless of the drive bay it is in. It is actually possible to hot-plug a disk into the other drive bay on a running system, but keep in mind that if you hotplug to the right drive bay, device enumeration will change after a reboot.

Older nonfunctional builds

OpenWrt builds prior to 18.06 or snapshot r7526 (dated 2018-07-16) do not work correctly on an MBL Duo. It will fail to boot (boot loop) if two disks are used and either contains anything other than the two default OpenWrt partitions.

OpenWrt builds prior to 18.06.2 or snapshots dated 2018-08-30 would, if both inserted drives contain OpenWrt, load kernel and dtb from SATA 1:1 (the disk in the left bay) while mounting the rootfs on SATA 0:1 (the disk in the right bay). This leads to problems if the version of OpenWrt differs between the two drives, for example after a sysupgrade; The kernel would mismatch and the system will, at best, not work properly.

Both issues have since been remedied, it is advisable to only use or upgrade to a version newer than the ones affected (i.e., 18.06.2 or later).

Upgrading

Before upgrading

Before upgrading, always take down the data of your current partition table layout!

Use the command

fdisk -l /dev/sda  

to print your current partition layout, and save a copy of the data for safekeeping. (Note: fdisk can display GPT partitions, you can also substitute gdisk -l /dev/sda here.) Take particularly good note of the partition data for any additional partitions you created on your drive (begin sector, end sector, type code.) There is a reasonable chance you might have to recreate the additional partitions after upgrading.

The reason to do this is that the partition table will be reset to the default MBR partition table if

  • you upgrade on a disk with GPT partition table
  • you upgrade from OpenWrt 17.01 or a snapshot dated before 2017-12-14
  • the default partition sizes differ between your old and the new OpenWrt version (for example, the second “rootfs” partition changed size from 256MB to 128MB in snapshot builds after 2019-06-25), sysupgrade will notice that the partition layout has changed and write a full image to disk, indiscriminately overwriting the current partition table.

In any of these cases you will have to recreate the partition table with the exact same parameters after upgrading.

Upgrading

OpenWrt on the MBL can be upgraded using the LuCI web interface and sysupgrade on the shell. Both directly take a gzipped image file ending in .img.gz which does not have to (and due to memory constraints probably shouldn't) be unzipped. Newer snapshot builds come with factory and sysupgrade images, the latter should be used to upgrade.

Recreating missing partitions

After sysupgrading, again use

fdisk -l /dev/sda

to print the current partition table layout and compare with your previously saved partition layout data. Ideally, if your disk is using MBR and the default partition sizes did not change, sysupgrade will have retained your additional partitions and you are good to go.

However, you might only see the two default partitions. In this case you will have to recreate the additional partitions in the partition table. First, compare the size of /dev/sda2 to see if it has changed after a sysupgrade:

If the size of the default partitions has changed (MBR and GPT)

Use fdisk (on MBR disks) or gdisk (on GPT disks) and recreate your additional partitions with the exact same begin sector, end sector, and type code (usually 83 for “Linux filesystem), just like you did when you originally created your partitions.

With an MBR disk and fdisk you can simply append the missing partition data with the exact same parameters. After re-creating additional partitions, fdisk will recognize that the new partitions already contain a file system and ask you if you want to reset it – which you should decline.

With GPT, gdisk will ask you beforehand:

Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.)
   1 - MBR
   2 - GPT
   3 - Create blank GPT

You should answer 1 here to carry over the parameters of the new default partition sizes from MBR, and then proceed to create a GPT partition table with your additional partitions.

When you're done, write the partition table to disk and reboot. Your missing partitions should be restored with all of the data

On a GPT disk, if the default partitions are unchanged

If you previously used GPT on your disk, and the two default partitions did not change (compare carefully!), you can simply restore your old GPT partition table.

gdisk will ask you:

Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.)
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Here you can choose 2 to restore the backup GPT, write the partition table to disk, and reboot.

Tags

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
toh/wd/mybooklive.txt · Last modified: 2019/11/20 00:06 by takimata