This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

persistently install zrep in N4F embedded using unionfs above and below

XigmaNAS Scripts and shell tips
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

persistently install zrep in N4F embedded using unionfs above and below

Post by karlandtanya »

If you mount on top of /usr/local as I did, you run into a problem when you upgrade embedded
Leftovers from the previous version of n4f get stuck in the unionfs "above" fileystem, and pollute the new version.

Mounting above, installing, then remounting below is also unreliable; there's often other stuff that sneaks in while you've got it mounted above.
Do it this way instead:
**********************************************************************************
***See post "How to persistently install packages in N4f Embedded"****
**********************************************************************************



tell zrep that ksh is in /usr/local/bin
nano is a text editor; see the help on the bottom row for how to use it

Code: Select all

nano zrep
the "shebang" line tells the script which shell to use
you have to tell it where the Korn shell lives
change it from:
#!/bin/ksh -p
to:
#!/usr/local/bin/ksh -p

Now you can start using zrep
First initialize each filesystem you plan to replicate
refer to the documentation here:
http://www.bolthole.com/solaris/zrep/zr ... .html#init
host1# zrep -i pool1/prodfs host2 pool

For example, if you have following zfs filesystems in host "gizmonas" you want to replicate to host "gizmobutt":
data/backups
data/library
data/media
data/scripts

Assuming host gizmobutt has a pool "data" and does NOT have the filesystems to be replicated in it
Then, issue the following commands to initialize the filesystems

gizmonas: ~ # zrep -i data/scripts gizmobutt data
gizmonas: ~ # zrep -i data/backups gizmobutt data
gizmonas: ~ # zrep -i data/library gizmobutt data
gizmonas: ~ # zrep -i data/media gizmobutt data

Note: These can take a long time!

After that, zrep sync all does the update
gizmonas: ~ # zrep sync all
Last edited by karlandtanya on 02 Oct 2016 22:37, edited 10 times in total.

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Thanks for this post.

I am novice and I would like to know the difference with HAST solution. Is there advantages in comparison with HaST ?

I am searching a solution in order to avoid failover.

Thanks
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

Re: zrep in NAS4Free embedded

Post by karlandtanya »

I'm a noob, too and being very conservative about it, so take this with that in mind:

briefly, my understanding is that I can't do upgrades/conversion to carp/hast unless I have another place to put my data.
with zrep, I can definitely upgrade 1 server while the other is powered off, then transfer the data and repeat in the other direction.

Here's what I've done so far:

Started out with raidz1 total 4 drives in each of 2 servers.
1. Decide raidz2 is safer (google "raid5 is dead" for many discussions on reasons).
2. Sync the servers and power off one, then destroy & rebuild the other as raidz2
3. Sync again, then repeat with the other one.
4. Works great!
Next, I am running out of space, so upgrade to 6 drives total, still raidz2 each server. Same steps. Worked great again.

One day maybe I want 11 drives, raidz3? distant future (I and my bank account hope so!!). But same steps again.

From reading the CARP/HAST setup instructions, there's a point at which you create the new configuration using the HAST devices (virtual devices that represent pairs of read drives in each server), and at that point any data on those devices is completely gone.
I would need a safe place to put the data during this procedure. Servers are cheap, but drives are *NOT*

For now I stick with zrep to maintain the backup.

FWIW, I have turned on CARP and using the virtual IP address and begun editing the CARP/HAST switchover scripts for eventual failover.

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Hello

Next Tuesday I will install zrep. I have some questions:
- you need to install it on both nas. I think yes but thanks for confirming me.
- does the destination nas need only on empty pool or you can have data in other folders than folders of zrep ?
- if I create a dataset on my pool, can I install zrep in the dataset ? Or is it necessary folders ?
- I have jails with the brig. How can we manage this for the destination nas ?

I have own cloud in a jail, and in case of failover, I would like that the other nas plays the role of master nas.

Thanks for your help
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

Re: zrep in NAS4Free embedded

Post by karlandtanya »

ernie wrote: - you need to install it on both nas. I think yes but thanks for confirming me.
Yes you install it in both NAS. The script expires old snapshots in the backup side; it needs to be there, too.
ernie wrote: - does the destination nas need only on empty pool or you can have data in other folders than folders of zrep ?
Replication is by dataset. So other datasets can exist in the target; it doesn't matter. For example:

Primary-server
....zpool_mypool1
........ImportantData1
........ImportantData2
........temporaryData

Backup-server
....zpool_myotherpool
........junkData
........someOtherJunkData

Code: Select all

Primary-Server: ~#  zrep init zpool_mypool1/ImportantData1 Backup-Server/zpool_myotherpool
Primary-Server: ~#  zrep init zpool_mypool1/ImportantData1 Backup-Server/zpool_myotherpool
Primary-server
....zpool_mypool1
........ImportantData1 <-zrep knows about this one
........ImportantData2 <-zrep knows about this one
........temporaryData

Backup-server
....zpool_myotherpool
........junkData
........someOtherJunkData
........ImportantData1 <-zrep knows about this one
........ImportantData2 <-zrep knows about this one
ernie wrote: - if I create a dataset on my pool, can I install zrep in the dataset ? Or is it necessary folders ?
As long as nas4free can find zrep, put it where you like.
ernie wrote: - I have jails with the brig. How can we manage this for the destination nas ?
I tried this with mysql in a jail using thebrig and it "works" (works defined by the test below) :
1. Install thebrig in both servers, configure identical jails on both
2. On the primary server, create and populate a jail with mysql in it, configure it to start automatically, use it & make sure it works OK.
3. On the backup server, configure the jail NOT to start on boot.
Note: In my case the pool is called "data" (in both servers) mounted at /mnt/data, and the separate dataset for thebrig, "data/thebrig" so:
4. In the backup server, delete the dataset containing thebrig:
This will of course break all the jails in the backup server, but that's OK--all you need in the backup is the part stored in the N4F configuration. The rest will be replicated by zrep from the primary; that's why they need to be identical configs except the start-on-boot.
Do NOT start the jail in the backup server even if the service can run in both places. The backup dataset will be read-only!

Code: Select all

     cd /mnt/data/thebrig
     chflags -R noschg *
     rm -rf *
     cd /
     zfs destroy data/thebrig
5. Now, initialize the dataset

Code: Select all

Primary-Server: ~#  zrep init data/thebrig Backup-Server/data
Note: At this point, the dataset in the secondary server will be read-only!
The next steps are where I verified that the backup sql server could become active
6. Power Down the Primary Server
7. Tell thebrig in the secondary server to become active:

Code: Select all

Secondary-Server: ~#  zrep takeover data/thebrig
8. in the backup server, use your normal method (e.g. gui) to start the jail with mysql in it.
you can also configure it to start on boot now.
9. Try to access mysql from various computers in the house. It works.
ernie wrote: I have own cloud in a jail, and in case of failover, I would like that the other nas plays the role of master nas.
You need to write a script to automate some things--if you want a hands-off failover.
I haven't got that far yet, so if you please post!

CARP is appealing as part of that solution, but please note I've had trouble accessing smb shares or sql sever using the CARP address from android devices. If you try to ping the CARP virtual address from android terminal window it complains that it's a broadcast address.
I don't know why or what the workaround is--but if you figure it out, please say something!!

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Thanks it is helpful.

I will look for owncloud and will tell you.

For Carp I haven t experience.
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

New question :
for service as bittorrent or cifs/smb,... of nas4free, how do you manage the failover ?

Example : the nas1 has the bitorrent service. If there is failover, I would like that nas 2 manages the service.

Script also ?

After installation of zrep, I will think about script, and will share with you and the community of course.

Concerning installation I have an error for perl15:

Code: Select all

nas4free2: opt # pkg install -R perl5
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
	perl5: 5.18.4_11

The process will require 49 MiB more space.
13 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching perl5-5.18.4_11.txz: 100%   13 MiB 248.1kB/s    00:56    
Checking integrity... done (0 conflicting)
[1/1] Installing perl5-5.18.4_11...
[1/1] Extracting perl5-5.18.4_11: 100%
makewhatis: not found
makewhatis: not found
pkg: POST-INSTALL script failed
Is it fine or do I have an issue ?

Thanks

Edit : I continue the installation as makewhatis seems to be for man information.

After installation on both nas, after deletion of repertory of thebrig on backup nas, I launch initialisation:
nas4free1: ~ # zrep -i pool1/jail nas4free2 pool2
/usr/local/sbin/zrep: line 1070: syntax error at line 1231: `_refreshpull' unexpected

Any idea ? Is it because of error with perl15 installation ?

Thanks
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

Re: zrep in NAS4Free embedded

Post by karlandtanya »

Post install script fails for me too in 4 different n4f servers; I have seen no problems in my use case over past few months.

For failover script you need to make one. I have not automated that part yet; if you get to it first please share.
nas4free1: ~ # zrep -i pool1/jail nas4free2 pool2
/usr/local/sbin/zrep: line 1070: syntax error at line 1231: `_refreshpull' unexpected
I never saw this one before. Sounds like zrep scripd is missing something. Verify...
ksh installed & ln and path ok (i think this is ok you would not make it that far ir not)
perl5 installed
Did you #rehash after pkg add?
ssh keys e.g. /root/.ssh/... set up in both servers

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

I done the command 'rehash' but do we see something in the console ?

pkg add ? it is pkg install, isn't it ?

ssh keys ? I don t see this in your 1st post.

Thanks

PS : sorry for my noob questions.

Edit:

On nas1 :
- content of opt/usr_local:
nas4free1: usr_local # ls
.snap bin etc lib libexec man sbin share www

- content of opt/var_db:
nas4free1: var_db # ls
fontconfig pkg updatenotify.db

On nas 2:
- content of opt/usr_local:
nas4free2: usr_local # ls
bin etc lib man sbin share www

- content of op/var_db:
nas4free2: var_db # ls
pkg updatenotify.db


The contents are not the same between both nas. Nas 1 is Nayla 1310 and Nas 2 is Nayla 1349.
The opt folder is in pool1/sup/ for nas1 and for nas 2 it is in pool2/gestion. sup and gestion are datasets.

I follow all you command. Is there an issue with 'pkg install' command for 1310 or 1349 ?
Do I need to use 'pk-add command' ?

If I delete the postinit script mountunion, can I delete the otp folder ? Or do I need to break the symbolic link ('ls' command) ?

Thanks for your help
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

Re: zrep in NAS4Free embedded

Post by karlandtanya »

Rehash is silent when it works.
you are correct; pkg_install is old; the current one is pkg install. sorry about that; I was typing from memory not copypaste as above!

regarding .ssh, (and dns while we're at it...), there's some things you need to do to make sure your servers can talk to each other.

SSH
you have 2 servers, nas4free1 and nas4free2. Presumably you will run these scripts while logged in as root, so...
root@nas4free1 will try to gain access to files over at nas4free2...
NAS4Free won't just let anybody do that--there has to be a secure method. There are, of course several ways to do this...
Here's a couple links to the ssh method:
Howto: Setting up public key password-less 'ssh' access
Enable SSH Key Authorization on FreeNAS
How to Connect to Your FreeNAS Server via SSH Without A Password; Password Free Logins via Public Key Authentication

Note you may prefer to do this in both directions--that is let the primary and secondary both have access to each other.
The files are plaintext and you can edit them with a text editor. If you're using windows, try notepad++ (not notepad that comes with win!!)

Once you get it working, you will need to make it persist through boots. Keep the credentials in a safe place where you can copy them over manually until you get things working. It's a PITA at first but you will get the hang of it ;).


Anyhow, here's how I got it to persist through boots.
(note I've changed the names of my servers...)

With the credentials in place so you can ssh from one server to the other...
First, I put the credentials in these directories:

Code: Select all

gizmonas-pri: ~ # cp -R /root/.ssh/* /mnt/data/backups/server_configs/gizmonas-pri/root/.ssh
gizmonas-sec: ~ # scp -r /root/.ssh/* root@gizmonas:'/mnt/data/backups/server_configs/gizmonas-sec/root/.ssh'
Note this data is was being backed up from the primary to the secondary server by rsync when i first did it, and now it's being backed up every 60s by zrep. So... the credentials to be used by either server must be first located in the correct place on the primary; they will propagate naturally to the backup.
In this case that both servers have all the credentials of each! In this case both servers are have the same physical access, so the security risk is not increased by this method. You would NEVER EVER DO THIS IF ONE SERVER IS LESS SECURE!

Next I added some lines to my postinit script...
Note in this case I've made all my scripts generic so they are replicated identically in both servers.
Yes, I know N4F can call specific scripts, but I found I was making each edit in 2 places and sometimes I forget!
So...the generic script has to figure out where it's running.

Code: Select all

#!/bin/sh

#figure out which host is running 
this_host=`hostname | sed 's/\..*$//g'`

#copy credentials for ssh
mkdir -p /root/.ssh
chmod 700 /root/.ssh
cp -f /mnt/data/backups/server_configs/$this_host/root/.ssh/* /root/.ssh/
chown -R root:wheel /root/.ssh  
chmod  600 /root/.ssh/authorized_keys /root/.ssh/id_rsa /root/.ssh/known_hosts
DNS
Also, you will need a dns server or use the HOSTS file because when you say
nas4free1: ~ # zrep -i pool1/jail nas4free2 pool2
nas4free1 needs to knows how to find nas4free2

Once you have all this setup, reboot both servers just to prove this will survive a reboot...
then try it...

gizmonas-pri: .ssh # ssh gizmonas-sec
Last login: Sun Mar 22 10:09:00 2015 from 10.10.137.13
Welcome to gizmonas-sec at Tanya's housegizmonas-sec: ~ #

(sorry--I need to put a newline in the motd...)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Thanks. I will look this but I don't know very well public/private key.

One point that I test :
you can use also the ip adress :
nas4free1: ~ # ssh 192.168.xxx.yyy
The authenticity of host '192.168.xxx.yyy (192.168.xxx.yyy)' can't be established.
DSA key fingerprint is zzzzzzzzzzzzzzzzzzzzzzzzzzzzz.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.xxx.yyy' (DSA) to the list of known hosts.
root@192.168.xxx.yyy's password:

And I tested also with zrep:
nas4free1: ~ # zrep -i pool1/jail 192.168.xxx.yyy pool2
/usr/local/sbin/zrep: line 1070: syntax error at line 1231: `_refreshpull' unexpected

So DNS is not necessary for me on the nas4free. It is manged by my adsl box.
But sure on the nas1, if I write ssh host_name_nas2, it doesn't work.

I will delete the installation (deletion the folders) and try again the installation as there is a problem with zrep script.

B.R.
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Eureka
It works.

I don't solve the secured ssh with private/public key at this moment, but it works (I need to fill in the password for the user, but it works).

Thanks for your help.
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

I have one small issue. For initialization I have the following error for 1 dataset:

cannot open 'Could': dataset does not exist

see hereafter:

Code: Select all

nas4free1: ~ # zrep -i pool1/musiques 192.168.150.25 pool2
Setting properties on pool1/musiques
Ancient local version of ZFS detected.
Creating destination filesystem as separate step
root@192.168.150.25's password: 
Creating snapshot pool1/musiques@zrep_000000
Sending initial replication stream to 192.168.150.25:pool2/musiques
root@192.168.150.25's password: 
Debug: Because you have old zfs support, setting remote properties by hand
root@192.168.150.25's password: 
Connection closed by 192.168.150.25
cannot open 'Could': dataset does not exist
cannot open 'Could': dataset does not exist
WARNING: Removing all zrep configs and snapshots from Could
Continuing in 10 seconds
Destroying any zrep-related snapshots from Could
cannot open 'Could': dataset does not exist
Removing zrep-related properties from Could
cannot open 'Could': dataset does not exist
Error: not set readonly for 192.168.150.25:pool2/musiques
nas4free1: ~ # 
I don't have folder or file with this name.

Any idea ?

Edit:

I use 'zrep clear' and try again the zrep -i. It works now.

Edit2:
The ip adress works for zrep -i but not for takeover command.
The Network/host menu of nas4free allows to identify hostname versus IP. For nas1 we put host/ip information of nas2, and for nas2, we put information of nas1.
Now it works. I will test the takeover command.
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Hello,

New issue:
nas4free2: ~ # zrep takeover pool2/jail
starting failover from remote side nas4free1
ssh: connect to host nas4free1 port 22: Operation timed out

But it is normal as I shutdown the nas4free1 in order to test the command.

In fact the command is :
nas4free2: ~ # zrep takeover -L pool2/jail

Then I activate jails (owncloud, plex) ; it works.

Good news....

I will think now about scripts. I will send you when available.

Edit:

Here the french tutorial based on your inputs: viewtopic.php?f=94&t=8606
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

problem with unionfs mount on top of /usr/local

Post by karlandtanya »

If you mount on top of /usr/local as I did, you run into a problem when you upgrade embedded
Leftovers from the previous version of n4f get stuck in the unionfs "above" fileystem, and pollute the new version.

Definitely need a different way to install aftermarket packages.

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

OK thanks. I see your discussion on the post of the new version. I am keeping the 1349 version.
I am reinstalling the master nas with a new support for nas4free :)
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

User avatar
ernie
Forum Moderator
Forum Moderator
Posts: 1458
Joined: 26 Aug 2012 19:09
Location: France - Val d'Oise
Status: Offline

Re: zrep in NAS4Free embedded

Post by ernie »

Hello again,

You written:
Started out with raidz1 total 4 drives in each of 2 servers.
1. Decide raidz2 is safer (google "raid5 is dead" for many discussions on reasons).
2. Sync the servers and power off one, then destroy & rebuild the other as raidz2
3. Sync again, then repeat with the other one.
4. Works great!

what do you mean with sync ? just a zrep -S or you used failover command ?

I am asking this because I think that I don't use correctly failover command or takeover command.

For me :
1) failover allows to change the direction between both nas : we change the source and the destination.
So I understood that we launch the command on the source nas.
When we need to change, I go on destination nas in order to use the same command.

2) Takeover : I didn't catch the use of this command.
For me, we use it if master nas has problem. So we go on destination nas and we use the command. Destination nas becomes the master.
But after reparation of the initial master nas, how do we manage the initial situation (the initial master becomes the master) ?

I think that my problem of snapshot comes from this missunderstanding of failover and takeover function.

Thanks
NAS 1&2:
System: GA-6LXGH(BIOS: R01 04/30/2014) / 16 Go ECC
XigmaNAS 12.1.0.4 - Ingva (revision 7743) embedded
NAS1: Xeon E3 1241@3.5GHz, 2HDD@8To/mirror, 1SSD cache, Zlog on mirror, 1 UFS 300 Go
NAS2: G3220@3GHz, 2x3HDD@2To/strip+raidz1, 1SSD cache, Zlog on mirror
UPS: APC Back-UPS RS 900G
Case : Fractal Design XL R2

Extensions & services:
NAS1: OBI (Plex, BTSync, zrep, rclone, themes), nfs, smb, UPS,
NAS2: OBI (zrep (backup mode), themes)

karlandtanya
Starter
Starter
Posts: 49
Joined: 23 Jan 2014 15:31
Location: nelson twp, OH, USA
Status: Offline

Re: persistently install zrep in N4F embedded using unionfs above and below

Post by karlandtanya »

2. Sync the servers and power off one, then destroy & rebuild the other as raidz2
ok more detail...
2.0 destroy all zfs in server 2; only pool remains
2.1 server 1: ~ # zrep -i zpool/zfs server2 zpool
2.2 now they are synced
2.3 let it run a couple days make sure all is ok. make sure server 2 has complete data
2.3 server 1: ~ #zrep sync all
2.4 power off server 1.
2.5 destroy & rebuild zpool in server 2 - as raidz2
2.6 repeat 2.1-2.3

some steps could hav been combined. But first time i did it so only change / try 1 new thing at a time.


3. Sync again, then repeat with the other one.

Now server 2 is raidz2.

3.0 power off server 1
3.1 server2: ~ # zrep clear zpool/zfs
3.2 with server 1 powered off do normal operations for 1 week using server 2 only
Because server 1 is the 'original' must be sure all is backed up before destroy it
3.3 power on server 1 and destroy zpool in server 1 then create raidz2 pool in server 1
Now both servers have raidz2 all data is in server 2; server 1 has no data no zfs only zpool
You see now failover/takeover is not appropriate here
3.4 server 2: ~ # zrep init zpool/zfs server 1 zpool
Now server 2 is primary; server 1 is backup; both are raidz2

Later by similar procedure added hdds to both arrays with no data loss.


Some steps left out for brevity but you see the sequence related to zpools & use of zrep to replicate zfs during a risky upgrade. Risky only that at certain moments there was only 1 copy of the data.

Post Reply

Return to “Scripts and shell tips”