My Book Live Duo + RAID

Hi All,

As far as I can tell the RAID function is broken on MyBook Live Duo firmware (17.01.4).
Steps taken:
opkg update
opkg install mdadm (which also installs kmod-md-mod, kmod-md-raid0, kmod-md-raid1, kmod-md-raid10)
mdadm -v --create /dev/md0 -l1 -n2 /dev/sda3 /dev/sda4

The answer:
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: size set to 52396032K
Continue creating array? yes
mdadm: unexpected failure opening /dev/md0

No matter how I try this error always shows up.
As suggested on another forum I tried "mount -o remount,dev /tmp"

Could you please help me to sort it out?

Here is an output with strace:

execve("/sbin/mdadm", ["mdadm", "-v", "--create", "/dev/md0", "-l1", "-n2", "/dev/sda3", "/dev/sda4"], [/* 12 vars */]) = 0
set_tid_address(0xb7b77084)             = 1352
open("/etc/ld-musl-powerpc.path", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=55280, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\0\"P\0\0\0004"..., 936) = 936
mmap2(NULL, 122880, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xb7ac7000
mmap2(0xb7ae4000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xd000) = 0xb7ae4000
close(3)                                = 0
mprotect(0x1005f000, 4096, PROT_READ)   = 0
clock_gettime(CLOCK_REALTIME, {tv_sec=1515004080, tv_nsec=905428949}) = 0
getpid()                                = 1352
open("/dev/md0", O_RDONLY|O_LARGEFILE)  = 3
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(9, 0), ...}) = 0
ioctl(3, RAID_VERSION, 0xbfa0731c)      = 0
close(3)                                = 0
open("/var/etc/mdadm.conf", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=109, ...}) = 0
readv(3, [{iov_base="", iov_len=0}, {iov_base="# Autogenerated from /etc/config"..., iov_len=1024}], 2) = 109
readv(3, [{iov_base="", iov_len=0}, {iov_base="", iov_len=1024}], 2) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=109, ...}) = 0
close(3)                                = 0
open("/var/etc/mdadm.conf.d", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
uname({sysname="Linux", nodename="TGyNAS", ...}) = 0
open("/lib/libdlm_lt.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libdlm_lt.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libdlm_lt.so.3", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/libcmap.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libcmap.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libcmap.so.4", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
geteuid()                               = 0
open("/dev/sda3", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
close(3)                                = 0
open("/dev/sda3", O_RDONLY|O_EXCL|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
close(3)                                = 0
open("/dev/sda3", O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 1024, [1024], SEEK_SET)      = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
_llseek(3, 65536, [65536], SEEK_SET)    = 0
read(3, "\20\200\0\0\20\200\1\0\20\200\2\0\20\200\3\0\20\200\4\0\20\200\f\0\20\200\r\0\20\200\30\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 53687025664, [53687025664], SEEK_SET) = 0
brk(NULL)                               = 0x1018b000
brk(0x1018f000)                         = 0x1018f000
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
ioctl(3, BLKSSZGET, [512])              = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 53687083008, [53687083008], SEEK_SET) = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [53687087104], SEEK_CUR)  = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [4096], SEEK_CUR)         = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 3), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 4096, [4096], SEEK_SET)      = 0
read(3, "\26\326\216\333 LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [8192], SEEK_CUR)         = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
brk(0x10195000)                         = 0x10195000
ioctl(3, BLKSSZGET, [512])              = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
ioctl(3, BLKSSZGET, [512])              = 0
writev(2, [{iov_base="mdadm", iov_len=5}, {iov_base=": Note: this array has metadata "..., iov_len=237}], 2) = 242
writev(2, [{iov_base="", iov_len=0}, {iov_base=NULL, iov_len=0}], 2) = 0
close(3)                                = 0
open("/dev/sda4", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
close(3)                                = 0
open("/dev/sda4", O_RDONLY|O_EXCL|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
close(3)                                = 0
open("/dev/sda4", O_RDONLY|O_LARGEFILE) = 3
_llseek(3, 1024, [1024], SEEK_SET)      = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
_llseek(3, 65536, [65536], SEEK_SET)    = 0
read(3, "\20\200\0\0\20\200\1\0\20\200\2\0\20\200\3\0\20\200\4\0\20\200\f\0\20\200\r\0\20\200\30\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 53687025664, [53687025664], SEEK_SET) = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
ioctl(3, BLKSSZGET, [512])              = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 53687083008, [53687083008], SEEK_SET) = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [53687087104], SEEK_CUR)  = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [4096], SEEK_CUR)         = 0
ioctl(3, BLKSSZGET, [512])              = 0
fstat64(3, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 4), ...}) = 0
ioctl(3, BLKGETSIZE64, [53687091200])   = 0
_llseek(3, 4096, [4096], SEEK_SET)      = 0
read(3, "\26\326\216\333 LVM2 x[5A%r0N*>\1\0\0\0\0\20\0\0\0\0\0\0"..., 4096) = 4096
_llseek(3, 0, [8192], SEEK_CUR)         = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
ioctl(3, BLKSSZGET, [512])              = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
ioctl(3, BLKSSZGET, [512])              = 0
close(3)                                = 0
writev(2, [{iov_base="mdadm: size set to 52396032K\n", iov_len=29}, {iov_base=NULL, iov_len=0}], 2) = 29
writev(2, [{iov_base="Continue creating array? ", iov_len=25}, {iov_base=NULL, iov_len=0}], 2) = 25
readv(0, [{iov_base="", iov_len=0}, {iov_base="yes\n", iov_len=1024}], 2) = 4
mkdir("/var/run/mdadm", 0755)           = -1 EEXIST (File exists)
open("/var/run/mdadm/map.lock", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0600) = 3
ioctl(3, TIOCGWINSZ, 0xbfa069f8)        = -1 ENOTTY (Not a tty)
flock(3, LOCK_EX)                       = 0
fstat64(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
open("/var/run/mdadm/map", O_RDONLY|O_LARGEFILE) = 4
readv(4, [{iov_base="", iov_len=0}, {iov_base="", iov_len=1024}], 2) = 0
close(4)                                = 0
open("/proc/mdstat", O_RDONLY|O_LARGEFILE) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
readv(4, [{iov_base="", iov_len=0}, {iov_base="Personalities : [raid0] [raid1] "..., iov_len=1024}], 2) = 65
readv(4, [{iov_base="", iov_len=0}, {iov_base="", iov_len=1024}], 2) = 0
close(4)                                = 0
stat64("/dev/.udev", 0xbfa06668)        = -1 ENOENT (No such file or directory)
stat64("/run/udev", 0xbfa06668)         = -1 ENOENT (No such file or directory)
lstat64("/dev/md0", {st_mode=S_IFBLK|0600, st_rdev=makedev(9, 0), ...}) = 0
open("/sys/block/md0/dev", O_RDONLY|O_LARGEFILE) = 4
read(4, "9:0\n", 20)                    = 4
close(4)                                = 0
open("/sys/block/md0/dev", O_RDONLY|O_LARGEFILE) = 4
read(4, "9:0\n", 20)                    = 4
close(4)                                = 0
getpid()                                = 1352
mknod("/dev/.tmp.md.1352:9:0", S_IFBLK|0600, makedev(9, 0)) = 0
open("/dev/.tmp.md.1352:9:0", O_RDWR|O_EXCL|O_DIRECT|O_LARGEFILE) = -1 EINVAL (Invalid argument)
unlink("/dev/.tmp.md.1352:9:0")         = 0
getpid()                                = 1352
mknod("/tmp/.tmp.md.1352:9:0", S_IFBLK|0600, makedev(9, 0)) = 0
open("/tmp/.tmp.md.1352:9:0", O_RDWR|O_EXCL|O_DIRECT|O_LARGEFILE) = -1 EINVAL (Invalid argument)
unlink("/tmp/.tmp.md.1352:9:0")         = 0
writev(2, [{iov_base="mdadm: unexpected failure openin"..., iov_len=43}, {iov_base=NULL, iov_len=0}], 2) = 43
unlink("/var/run/mdadm/map.lock")       = 0
close(3)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Yea, this has been fixed long ago. But it never upstreamed to the stable releases 17.01.x releases.

See this thread:
RAID not working after Update LEDE 17.01.0 final GoFlexNetRAID not working after Update LEDE 17.01.0 final GoFlexNet

If you want raid* use the current master branch or wait for the next openwrt release.

Thank you for the reply.
Sorry for the stupid question, but what does "use current master branch" mean?
Do I have to compile LEDE myself? I'm not sure I'm prepared to do this... :frowning:

Oh sorry different name / terminology. Look at the "Development Snapshot builds".

Be aware that a lot of stuff has changed from the 17.01.x. You should be able to just
download the wd_mybooklive-duo-ext4-rootfs.img.gz file and do the sysupgrade.
Be aware, this will basically repartition the HDD. If you have moved any valuable
data to the HDD make sure you have a backup. Note: The repartitioning stuff has
also been fixed in the dev branch. So a future openwrt release will no longer repartition
the device when upgrading.

When using snapshot builds from the server they are already compiled for you. So you don't have to compile but you do have to download all the packages you need, especially kmods, before the next daily build makes them obsolete.

Thank you all! I'll look into it...
Probably I'll try to extract the kernel and all the necessary files from the pre-built snapshot image, and do a manual upgrade (though I have nothing important on the HDD yet).

Success! :slight_smile:

It was enough to replace the kernel from the development snapshot build.

BTW, is there any reason to have separate boot and root partitions?

Just for the record: it was not that simple unfortunately. :frowning:
There was a lot of broken module dependencies, so finally I had to do a full re-install with the snapshot build...