RAID setup on Zyxel NSA320/NSA325

Ask questions about Arch Linux ARM. Please search before making a new topic.

RAID setup on Zyxel NSA320/NSA325

Postby psychokiller » Thu Mar 19, 2020 5:03 pm

Hi all!
I know there is an old thread treating the set up of a RAID1 on these NASes here https://archlinuxarm.org/forum/viewtopic.php?f=53&t=7873 but it is quite old and not totally clear to me.

Has anyone ever else ever tried setting up any RAID1 configuration after installation of ALARM?
Any advice on how to repartition after install and how to setup mdadm for the array to work fine?

TIA for any advice.
Paolo.
psychokiller
 
Posts: 17
Joined: Tue Sep 15, 2015 5:39 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby Kabbone » Thu Mar 19, 2020 5:37 pm

what should be different to any other RAID1 under linux/stock arch?
Kabbone
 
Posts: 116
Joined: Thu Jul 25, 2013 9:20 am

Re: RAID setup on Zyxel NSA320/NSA325

Postby psychokiller » Thu Mar 19, 2020 6:37 pm

Well, ALARM installation process isn't like stock Arch, nor the devices it supports.
To begin with you have little choice over partitioning when using the ALARM supplied script for installation, so you have to change thing later: this is my first point, how to repartition?
Paolo
psychokiller
 
Posts: 17
Joined: Tue Sep 15, 2015 5:39 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby Kabbone » Thu Mar 19, 2020 7:53 pm

but it uses mostly the same software and kernel as stock Arch, just recompiled for ARM, so basically you nearly always can set things up like stock.
At first you should probably describe what your goal setup is.
Kabbone
 
Posts: 116
Joined: Thu Jul 25, 2013 9:20 am

Re: RAID setup on Zyxel NSA320/NSA325

Postby psychokiller » Thu Mar 19, 2020 11:32 pm

My goal setups would be:
1) two hard drives in RAID1 both with boot partition, rootfs and data partition, everything mirrored. Hardest configuration to do and probably harder to recover from with no hardware raid controller
2) one hard drive with boot partition, rootfs and data partition, data with just data partition mirrored. Simpler but less effective if one drive fails you have to work more to recover a working system but data will be safe and you can mount on another system to save them
3) open to suggestion for any configuration, and how to set it up, that whoever who consider it good for a seedbox (that has little vital data but need a short RTO=recovery time objective) will be willing to describe.
TIA
Paolo
psychokiller
 
Posts: 17
Joined: Tue Sep 15, 2015 5:39 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby summers » Fri Mar 20, 2020 3:29 pm

I use btrfs, which can do raid like configurations.

My root fs is on just one partition, /home is bfrfs formatted and split across two disks, meta data is mirrored, the main data just on one. All of it is compressed:
Code: Select all
sudo btrfs device usage /home
/dev/sda4, ID: 1
   Device size:           928.66GiB
   Device slack:            2.00KiB
   Metadata,RAID1:         18.00GiB
   System,RAID1:           32.00MiB
   Unallocated:           910.63GiB

/dev/sdb, ID: 2
   Device size:             3.64TiB
   Device slack:              0.00B
   Data,single:           806.00GiB
   Metadata,RAID1:         18.00GiB
   System,RAID1:           32.00MiB
   Unallocated:             2.83TiB

To do (1) so root on raid, you'll probably need an intramfs that knows the modules to load. Uboot would need to be able to access what it needs, so suggests /boot as separate partition so uboot can access it. I though about making my root btrfs formatted, but it seemed like more difficulty than it was worth.

Guess I should explain how I set this up. After the initial install on the NSA, I powered down the machine, pulled the HDD, as I wanted to give the disk format I wanted. As I had installed the updated uboot that understands ext4 file systems, I wanted a single root partition, so boot is part of root. Also at same time set up my /home partition, that was btrfs formatted, and in /etc/fstab I set up that it was mounted, and had compression (zlib). Now when I wanted to extend /home, I just bought a new 4TB disks, and plugged it into the NSA. Then I used the btrfs command to add the *whole* disk to the /home partition, finally ran a "btrfs balance" which balanced everything with the new disk configuration - that took several days to run, as all data was moved to the 4TB partition, machine though was still usuable whilst the balance ran in the background.

btrfs advanatage, and disadvantage, is its hyper modern. It has huge functionality built in, with raid, and compression, and snapshots, and cow. The creator of btrfs (Chris Mason?) is *very* well respected in the linux community - and his design of btrfs shows this. btrfs was huge project, but very well done.
summers
 
Posts: 777
Joined: Sat Sep 06, 2014 12:56 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby psychokiller » Thu Mar 26, 2020 9:48 am

OK, Thanx summers this description make a lot of sense and ideally what I am looking for.
Set aside that I need also to set up a linux desktop pc with 2 free SATA ports to connect the drives pulled from the NSA32x, I will give it a try.
Paolo.
psychokiller
 
Posts: 17
Joined: Tue Sep 15, 2015 5:39 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby summers » Thu Mar 26, 2020 3:54 pm

You may be able to do it without the external machine - I can't recall what the install does, e.g. if you can set up a separate home partition, than you then set up btrfs and raid on.

Advantage of plugging it into a desk top PC, is that once there is far more flexible, e.g. you can set up whatever file system you want. Whereas doing if from a live system, and its hard to actively change the file system you are running from ...

Actually checking the install script: usb_key_func.sh.2 from http://dk.mirror.archlinuxarm.org/os/nsa3x0/nsa325-alarm.tar.gz the fdisk sets the second partition up to be the rest of the disk, so you could tweak that file so it only created the root partition of a certain size, say 4GB. Then you could set up the rest of the disk as you choose ...

The second disk is most easily set up from an already running system, as you typically want to add it to a running btrfs set up ...
summers
 
Posts: 777
Joined: Sat Sep 06, 2014 12:56 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby psychokiller » Thu Mar 26, 2020 8:11 pm

So, summers, you are saying that I might change
Code: Select all
mkfs.ext4 -L "rootfs" /dev/sda2

to
Code: Select all
mkfs.btrfs -L "rootfs" /dev/sda2

and everything is done?

Might be a silly question, but can UBoot boot from btrfs?

Or you just mean tweaking fdisk options so that sda2 is still extf4 but smaller and then another sda3 partition with btrfs that is mirrored?
psychokiller
 
Posts: 17
Joined: Tue Sep 15, 2015 5:39 pm

Re: RAID setup on Zyxel NSA320/NSA325

Postby summers » Fri Mar 27, 2020 10:49 am

The uboot that comes on NSA32x devices can only read ext2 and *maybe* fat. Hence why you need a /boot ext2 formatted on the first install.

After installing arch, if you update uboot, it also understands ext4, but probably not btrfs (untested).

IIRC the source code for uboot, also has some code for btrfs. This said I've *never* heard of anyone booting from a btrfs partition, which doesn't mean it can't be done, but does need a *very* modern uboot, and be unusual.

So what I meant was your second option, change the install so it only creates a /boot and small root partition. By small say something like 4GB (mine is 2GB but fills regularly). Keep the rest of the disk unformatted.

Then after arch is installed, update it, make sure the btrfs-tools are installed. And then format your hard disks how you want them. You'll want to read: https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices

So set it up with whatever raid you want, on however many disks you want it set up on. Finally modify /etc/fstab to automatically mount it, note some options (e.g. compression) you can only set at this mount stage.

The code to change in usb_key_func.sh.2 is:
Code: Select all
fdisk /dev/sda <<EOF
o
n
p
1

+16M

n
p
2


p
w

EOF

Thing to note is the blank lines tell fdisk to take the defaults, so you'll want to change one of the blank lines to something like "+4G". Check you change the right one, as you won't be able to watch the nsa doing this during install ...
summers
 
Posts: 777
Joined: Sat Sep 06, 2014 12:56 pm

Next

Return to User Questions

Who is online

Users browsing this forum: Kabbone and 2 guests