OpenWrt on Zyxel NSA325v2

Did you install kmod-md-raid0 and/or kmod-md-raid1?

1 Like

I now also installed the 4, 5, 6. But I had the others installed already.

They are loaded?

lsmod

I think so :fearful:

root@NSA325v2_2:~# lsmod
async_memcpy           12288  1 raid456
async_pq               12288  1 raid456
async_raid6_recov      12288  1 raid456
async_tx               12288  5 raid456,async_raid6_recov,async_pq,async_xor,async_memcpy
async_xor              12288  2 raid456,async_pq
crc_ccitt              12288  1 ppp_async
crc32_generic           8192  0 
exfat                  98304  0 
f2fs                  262144  0 
fat                    53248  2 msdos,vfat
fuse                   73728  0 
gpio_button_hotplug    12288  0 
ip_tables              20480  4 iptable_nat,iptable_mangle,iptable_filter
ip6_tables             20480 24 ip6table_mangle,ip6table_filter
ip6t_REJECT            12288  2 
ip6table_filter        12288  1 
ip6table_mangle        12288  0 
ipt_MASQUERADE         12288  1 
ipt_REJECT             12288  2 
iptable_filter         12288  1 
iptable_mangle         12288  0 
iptable_nat            12288  1 
libcrc32c              12288  1 raid456
md_mod                110592  4 raid456,raid10,raid1,raid0
msdos                  16384  0 
nf_conntrack           61440 13 nf_conntrack_ipv6,ipt_MASQUERADE,xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_CT,nf_nat_masquerade_ipv4,nf_conntrack_ipv4,nf_nat_ipv4,nf_nat,nf_flow_table,nf_conntrack_rtcache
nf_conntrack_ipv4      12288 10 
nf_conntrack_ipv6      12288  4 
nf_conntrack_rtcache   12288  0 
nf_defrag_ipv4         12288  1 nf_conntrack_ipv4
nf_defrag_ipv6         12288  1 nf_conntrack_ipv6
nf_flow_table          20480  2 xt_FLOWOFFLOAD,nf_flow_table_hw
nf_flow_table_hw       12288  1 
nf_log_common          12288  2 nf_log_ipv4,nf_log_ipv6
nf_log_ipv4            12288  0 
nf_log_ipv6            12288  0 
nf_nat                 16384  4 xt_nat,nf_nat_redirect,nf_nat_masquerade_ipv4,nf_nat_ipv4
nf_nat_ipv4            12288  1 iptable_nat
nf_nat_masquerade_ipv4   12288  1 ipt_MASQUERADE
nf_nat_redirect        12288  1 xt_REDIRECT
nf_reject_ipv4         12288  1 ipt_REJECT
nf_reject_ipv6         12288  1 ip6t_REJECT
nls_cp437              12288  0 
nls_iso8859_1          12288  0 
nls_utf8               12288  0 
ntfs                   98304  0 
ppp_async              16384  0 
ppp_generic            28672  3 pppoe,ppp_async,pppox
pppoe                  16384  0 
pppox                  12288  1 pppoe
raid0                  16384  0 
raid1                  36864  0 
raid10                 49152  0 
raid456               118784  0 
raid6_pq               94208  3 raid456,async_raid6_recov,async_pq
reiserfs              208896  0 
rtc_pcf8563            12288  0 
slhc                   12288  1 ppp_generic
vfat                   16384  0 
x_tables               20480 24 ipt_REJECT,ipt_MASQUERADE,xt_time,xt_tcpudp,xt_state,xt_nat,xt_multiport,xt_mark,xt_mac,xt_limit,xt_conntrack,xt_comment,xt_TCPMSS,xt_REDIRECT,xt_LOG,xt_FLOWOFFLOAD,xt_CT,iptable_mangle,iptable_filter,ip_tables,ip6table_mangle,ip6table_filter,ip6_tables,ip6t_REJECT
xhci_hcd               90112  2 xhci_plat_hcd,xhci_pci
xhci_pci               12288  0 
xhci_plat_hcd          12288  0 
xor                    12288  1 async_xor
xt_CT                  12288  0 
xt_FLOWOFFLOAD          8192  0 
xt_LOG                 12288  0 
xt_REDIRECT            12288  0 
xt_TCPMSS              12288  0 
xt_comment              8192107 
xt_conntrack           12288 12 
xt_limit               12288 20 
xt_mac                  8192  0 
xt_mark                 8192  0 
xt_multiport            8192  0 
xt_nat                 12288  0 
xt_state               12288  0 
xt_tcpudp               8192  8 
xt_time                12288  0 
root@NSA325v2_2:~# 

If you haven't done it already, try to reboot.

:joy: :joy:

tried multiple times

Some googling brought me this: Nexx WT3020 - problem with mdadm
Unfortunately, I can't find the kernel config of the current release. (Which version do you use?)

Can you mount any blockdevice? USB stick, or something like that? Can you post the output of


mdadm --examine /dev/sda2

On your Pi, (assuming sda is one of your ZyXEL disks). As you have single disk volumes, it is possible to mount them without assembling the array, and so without mdadm, by using a loop device. But you'll have to know the offset.

So, right now I am trying NAS OpenWRT only. Not the RPi because I have had problems with the RAID discs connected via USB-to-SATA converters in the past.

Output without USB devices (NSA325v2)

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2021.05.14 18:55:19 =~=~=~=~=~=~=~=~=~=~=~=
login as: root
root@192.168.0.101's password: 


BusyBox v1.30.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 19.07.7, r11306-c4a6851c72
 -----------------------------------------------------
root@NSA325v2_1:~# mdadm --examine /dev/sda2
/dev/sda2:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : c2100065:6c25d53d:99d2bd16:cf507a36
           Name : NSA325-v2-102:0
  Creation Time : Tue Oct 11 21:46:00 2016
     Raid Level : linear
   Raid Devices : 1

 Avail Dev Size : 7813033984 (3725.54 GiB 4000.27 GB)
  Used Dev Size : 0
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
   Unused Space : before=1968 sectors, after=0 sectors
          State : clean
    Device UUID : 169b9179:4e31937d:d7dc82b6:0363b014

    Update Time : Tue Oct 11 21:46:00 2016
       Checksum : b70ba135 - correct
         Events : 0

       Rounding : 0K

   Device Role : Active device 0
   Array State : A ('A' == active, '.' == missing, 'R' == replacing)
root@NSA325v2_1:~# 

I now enabled "Mount filesystems not specifically configured" and only then was the USB stick actually mounted.
The system then also mounted sda1 again (I think it recognizes it as SWAP and wnats to use it for that).

Commands afterwards:

root@NSA325v2_2:~# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_2 on /overlay type ubifs (rw,noatime,ubi=0,vol=2)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt/sda1 type ext2 (rw,relatime)
/dev/sdc1 on /mnt/sdc1 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
root@NSA325v2_2:~# cd /mnt/sdc1
root@NSA325v2_2:/mnt/sdc1# ls
18.bin
System Volume Information
The Mandalorian.S02E06.Chapter 14. The Tragedy.mkv
The Mandalorian.S02E07.Chapter 15. The Believer.mkv
The Mandalorian.S02E08.Chapter 16. The Rescue.mkv
u-boot.bin
u-boot.img
u-boot.kwb
root@NSA325v2_2:/mnt/sdc1# cd ..
root@NSA325v2_2:/mnt# cd sda1
root@NSA325v2_2:/mnt/sda1# ls
lost+found    swap_ul6545p  sysdisk.img
root@NSA325v2_2:/mnt/sda1# cd ..
root@NSA325v2_2:/mnt# cd sda2
root@NSA325v2_2:/mnt/sda2# ls
root@NSA325v2_2:/mnt/sda2# cd ..
root@NSA325v2_2:/mnt# 
root@NSA325v2_2:/mnt# cd ..
root@NSA325v2_2:/# mdadm --examine /dev/sda2
/dev/sda2:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : c7d796b4:77026922:767dbef5:993ebce2
           Name : NSA325-v2:1
  Creation Time : Sat Oct 31 13:30:17 2015
     Raid Level : linear
   Raid Devices : 1

 Avail Dev Size : 3905993857 (1862.52 GiB 1999.87 GB)
  Used Dev Size : 0
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
   Unused Space : before=1968 sectors, after=0 sectors
          State : clean
    Device UUID : 985c3859:b90398c8:1536d81c:ca4ee10b

    Update Time : Sat Oct 31 13:30:17 2015
       Checksum : e208bbef - correct
         Events : 0

       Rounding : 0K

   Device Role : Active device 0
   Array State : A ('A' == active, '.' == missing, 'R' == replacing)
root@NSA325v2_2:/# mdadm --examine /dev/sda21
mdadm: No md superblock detected on /dev/sda1.
root@NSA325v2_2:/# 

I flashed openwrt-18.06.9-kirkwood-zyxel_nsa325 u-boot and then as firmware I flashed openwrt-19.07.7-kirkwood-zyxel_nsa325-squashfs-factory.bin

Ok. Install losetup, and try

losetup -o 1048576 /dev/loop0 /dev/sda2
mount /dev/loop0 /mnt/sda2

(1048576 is 2048 sectors in bytes). This command generates a new blockdevice, mapped on /dev/sda2, at offset 2048 bytes.

Good morning everyone,
last night before seeing your response, I went through the other possible packages and found also blockd and mount-utils.
Now I would assume it was maybe blockd that led to this:

root@NSA325v2_2:~# mdadm --assemble /dev/md0 /dev/sda2 --run
mdadm: /dev/md0 has been started with 1 drive.
root@NSA325v2_2:~# mdadm --assemble /dev/md1 /dev/sdb2 --run
mdadm: /dev/md1 has been started with 1 drive.

So finally my drives are there! And I can access the data! I will try with the other drives next as I only tried the first one.

So I think maybe blockd was missing.

Quick question as I am now very cautious with these discs :smiley:
What would be the correct command to delete the second disc (sdb) and all partitions and make a one-partition drive out of it that any Linux device can read without any RAID? So e.g. a really normal ext2 or ext4 drive? (p.s.: which filesystem would you experts recommend for OpenWRT and overall integrity?)

The disk is amaller than 2TB, so you can use fdisk to create a new partition table with one partition.
fdisk /dev/sdb
When I'm not mistaken the key sequence is o (new empty partition table) n (new partition) p (primary) (default start en end sector) w (write)
Then the filesystem
mke2fs -t ext4 /dev/sdb1
is in e2fstools, I think.

1 Like

Ah, unfortunately the second NAS has two 4 TB discs, so I won't be able to use fdisk.
Maybe parted?

generic fdisk have support for GPT, openwrt might use a stripped down version, but I doubt it.
You should try, before you use other tools.

Command (m for help): p
Disk /dev/sdc: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: WDC WD120EMFZ-11
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E1A40524-767B-4315-B91E-ABCDEFABCDEF

.......

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table

Edited for accuracy. This is how I understand the situation, but the nomenclature is confusing, and I may be completely off here. Please someone correcting me if I'm wrong.

As far as I understand it, one needs to distinguish between linux-util fdisk and GPT fdisk. linux-util fdisk as supplied by OpenWrt's f2fs-tools is aware of GPT partition tables, i.e. it can recognize and print GPT partition tables but it cannot create or modify them. For that one would need GPT fdisk proper, available as package named, and used with the command, gdisk

yeah, it might be that openwrt keeps the functionality apart.

Yes, I ended up using gdisk now. Worked like a charm. I am currently using luci-app-commands to clone the two discs to their feshly ext4 formatted counterparts. Once that is done, I will format the original ones and clone everything back :slight_smile:

There is a more efficient strategy. Apparently you have two 2TB disks (A2 and B2), which you want to keep their content, but on a fresh filesystem. And now you copy the content to a 4TB disk (A4), to copy it back later:
A2+B2 => A4 ; A4 => A2+B2
If you do
A2 => A4; B2 => A2; A4 => B2
you copy around half the amount of bytes. In half of the time.

Actually I have two 4 TB and two 2 TB discs. Each pair being a copy of each other.
So I have to copy a total of 6 TB. Easiest to copy 2 -> 2 and 4 -> 4. That way each "new" drive has only one write and one read cycle.

I'd like to thank you all once again! I am very grateful for all your help :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.