Page not found – ShopingServer Wiki http://wiki.shopingserver.com Tutorials and Articles About Technology and Gadgets Fri, 05 Jan 2018 14:18:17 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.14 http://wiki.shopingserver.com/wp-content/uploads/2018/07/cropped-favicon-150x150.png Page not found – ShopingServer Wiki http://wiki.shopingserver.com 32 32 How To FreeNAS Install And Configure APC UPS For Power Management http://wiki.shopingserver.com/freenas-install-configure-apc-ups-power-management/ http://wiki.shopingserver.com/freenas-install-configure-apc-ups-power-management/#respond Fri, 05 Jan 2018 14:18:17 +0000 http://wiki.shopingserver.com/?p=18236 I

have an APC SUA1500i smart ups, and want to configure power option from my FreeNAS using this ups. How can I install an appropriate APC UPS USB driver on my FreeNAS server, and use it to control power options?

 

FreeNAS is nothing but a FOSS network-attached storage (NAS) system based on FreeBSD Unix and the OpenZFS file system. It comes with a dedicated management web interface for managing and configuring your NAS box. In this tutorial you will learn how to configure the APC (or any other supported brand) UPS service then start it in FreeNAS to protect your server from power failures. This tutorial shows how to configure and use UPS on a FreeNAS based server.

UPS monitoring on FreeNAS

An uninterruptible power supply/uninterruptible power source (UPS) is an electrical apparatus that provides emergency power to a load when the input power source, typically mains power, fails. A UPS is useful start a standby power source such as generator or properly shut down the FreeNAS box.

FreeNAS and NUT

FreeNAS comes with NUT (Network UPS Tools) software to provide support for Power Devices such as UPS.

Configuration

First connect the APC ups to your FreeNAS based server using the serial or USB port the UPS is plugged into.

Finding out the APC USB port name

Login to your FreeNAS server using ssh and type the following command:

dmesg | grep -i –color  american power conversion

 

Or

dmesg | grep -i usbus | grep -i –color  american power conversion

 

Sample outputs:

Fig.01: FreeNAS/FreeBSD Find Out APC UPS USB Device Name

How do I configure UPS monitoring service on FreeNAS server?

To configure the UPS service login to your FreeNAS web-gui. Navigate as follows:

Services > Control Services

Fig.02: FreeNAS UPS service

 

You need to set the following options:

Fig.03 FreeNAS UPS service configuration options

Set UPS Mode to Master.

Set Identifier to ups.

Set Driver as per your USP model. In this example, I set it to “APC ups 2 Back-UPS USB USB (usbhid-ups)“.

Set Port to /dev/ugen0.3 (again set this as per your setup).

Set Shutdown mode to “UPS reaches low battery“.

Set Monitor password “passwordHere” (again replace passwordHere with actual password).

Set email to “you@nixcraft.com” (replace you@nixcraft.com with actual email id).

Finally click on “Ok” button to save changes.

Next make sure you start UPS service on boot by clicking “Start on boot” and Start Now button from Services right panel:

Fig.04: Starting UPS service on FreeNAS

How do I test UPS connectivity and configuration on FreeNAS?

Login using ssh and simply type the following command to poll the status of a UPS server on FreeNAS:

upsc ups@localhost

Sample outputs:

Gif.01: upsc demo on FreeNAS

And, there you have it, the APC ups installed and working correctly on the latest version of FreeNAS.

References

FreeNAS project

Network UPS Tools project.

 

 

]]>
http://wiki.shopingserver.com/freenas-install-configure-apc-ups-power-management/feed/ 0
How to install and configure Jails on FreeNAS Corral 10 http://wiki.shopingserver.com/install-configure-jails-freenas-corral-10/ http://wiki.shopingserver.com/install-configure-jails-freenas-corral-10/#respond Wed, 03 Jan 2018 14:41:49 +0000 http://wiki.shopingserver.com/?p=17904 I

recently installed or upgraded to FreeNAS Corral (version 10). However, I noticed that there is no support for FreeBSD jails as of 26/March/2017. How do I install and configure traditional FreeBSD jails on FreeNAS Corral (version 10)?

 

FreeNAS Corral now supports Docker containers for doing all of its “application hosting” and existing jails/plugins data will simply continue to live in the jails/dataset in the ZFS volume but will be inactive, since jails are no longer used in Corral. This tutorial shows you how to create and configure FreeBSD jail on FreeNAS Corral 10 from command line.

What is FreeBSD jail?

The FreeBSD jail is nothing but an implementation of operating system-level virtualization that allows you to partition a FreeBSD-based server into several independent, secure mini-systems called jails.

Preparing FreeNAS

First you need to create the ZFS dataset, run:

# zfs create nixcraft/.my_jails_cache

# zfs list nixcraft/.my_jails_cache

 

Sample outputs:

NAME                       USED  AVAIL  REFER  MOUNTPOINT

nixcraft/.my_jails_cache   128K  10.2T   128K  /mnt/nixcraft/.my_jails_cache

Now grab FreeBSD 11 files for your jail:

# cd /mnt/nixcraft/.my_jails_cache/

# wget http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/base.txz

# wget http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/lib32.txz

# wget http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txz

# wget http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/ports.txz

 

OR use the lftp command as follows:

# lftp

lftp :~> pget -n 10 http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/base.txz

lftp :~> pget -n 10 http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/lib32.txz

lftp :~> pget -n 10 http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/src.txz

lftp :~> pget -n 10 http://ftp1.us.freebsd.org/pub/FreeBSD/releases/amd64/11.0-RELEASE/ports.txz

 

Sample outputs:

Fig.01: Fetch and extract the FreeBSD 11.0-AMD64 dist files

 

Extract tar ball using the tar command:

*** extract files *** ###

# cd /mnt/nixcraft/.my_jails_cache/

# tar -jxf base.txz

# tar -jxf ib32.txz

# tar -jxf src.txz

# tar -jxf ports.txz

 

Make some basic configuration of the base jail and update it to the latest patch using freebsd-update command:

*** Configure the dns, timezone and hosts *** ###

# cp /etc/resolv.conf /mnt/nixcraft/.my_jails_cache/etc/

# cp /etc/localtime /mnt/nixcraft/.my_jails_cache/etc/

# cp /etc/hosts /mnt/nixcraft/.my_jails_cache/etc/

*** chroot into the filesystem *** ###

# chroot /mnt/nixcraft/.my_jails_cache /bin/sh

*** set the password for root in the jail *** ###

# passwd

*** Create needed dirs *** ###

# mkdir /usr/home

# ln -s /usr/home /home

*** Basic config in the jail *** ###

# cd /etc/mail

# make aliases

# echo  ENV=$HOME/.shrc ; export ENV  >> /root/.profile

# echo  sendmail_enable= NONE   >> /etc/rc.conf

# echo  syslogd_flags= -ss   >> /etc/rc.conf

# echo  rpcbind_enable= NO   >> /etc/rc.conf

# exit

 

At this stage you should run freebsd-update:

*** Run freebsd-update *** ###

# env D=/mnt/nixcraft/.my_jails_cache/

# $D/usr/sbin/freebsd-update -f $D/etc/freebsd-update.conf -b $D -d $D/var/db/freebsd-update/ –currently-running 11.0-RELEASE fetch install

 

Unfortuntaly above command failed on my system to download files. So I had created a /etc/jail.conf as follows:

exec.start =  /bin/sh /etc/rc ;

exec.stop =  /bin/sh /etc/rc.shutdown ;

exec.clean;

mount.devfs;

# The jail definition for basejail

basejail {

host.hostname =  basejail.nixcraft.in ;

path =  /mnt/nixcraft/.my_jails_cache ;

interface =  igb0 ;

ip4.addr = 192.168.2.29;

allow.chflags;

allow.raw_sockets;

osrelease =  11.0-RELEASE ;

}

Start it as follows:

# jail -c basejail

# jls

JID IP Address Hostname Path

1 192.168.2.30 basejail /mnt/nixcraft/.my_jails_cache

# jexec basejail

 

Now I can run freebsd-update:

root@basejail:/ # freebsd-update fetch install

 

Sample outputs:

Looking up update.FreeBSD.org mirrors… 4 mirrors found.

Fetching metadata signature for 11.0-RELEASE from update4.freebsd.org… done.

Fetching metadata index… done.

Inspecting system… done.

Preparing to download files… done.

Fetching 1338 patches…..10….20….30….40….50….60….70

….

..

….

…..1310….1320….1330…. done.

Applying patches… done.

Fetching 22 files… done.

Installing updates…done.

Install any packages the jail environment requires

At this stage you can run pkg command to install needed packages inside the jail:

# pkg install bash

 

Sample outputs:

Fig.02: Install bash shell

 

Now I have a fully up to date basejail template created using zfs. I can now create a snapshot as follows:

# zfs snapshot nixcraft/.my_jails_cache@template

 

Next, clone the snapshot to a new jail named backup, enter:

# zfs clone nixcraft/.my_jails_cache@template nixcraft/backup

 

Configure the jail hostname, enter:

# echo  hostname= backup   >> /mnt/nixcraft/backup/etc/rc.conf

 

Update /etc/jail.conf:

backup {

host.hostname =  backup.nixcraft.in ;

path =  /mnt/nixcraft/backup ;

interface =  igb0 ;

ip4.addr = 192.168.2.30;

allow.chflags;

allow.raw_sockets;

osrelease =  11.0-RELEASE ;

}

Make sure jails start when FreeNAS reboots:

# echo  jail_enable= YES   >> /etc/rc.conf

 

You can start all jails as follows:

# /etc/rc.d/jail start

 

Sample outputs:

Starting jails: basejail backup.

You can now update and install all jails as per your needs. To create a new jail always use nixcraft/.my_jails_cache@template as follows:

# zfs clone nixcraft/.my_jails_cache@template nixcraft/apache

# zfs clone nixcraft/.my_jails_cache@template nixcraft/pgsql

 

And update /etc/jail.conf file.

List jails

# jls

 

Sample outputs:

JID  IP Address      Hostname                      Path

10  192.168.2.29    basejail.nixcraft.in          /mnt/nixcraft/.my_jails_cache

11  192.168.2.30    backup                        /mnt/nixcraft/backup

To show parameters in “name=value” format, where each parameter is preceded by its name:

# jls -n

# jls -j basejail -n

devfs_ruleset=0 nodying enforce_statfs=2 host=new ip4=disable ip6=disable jid=10 name=basejail osreldate=1100509 osrelease=11.0-RELEASE parent=0 path=/mnt/nixcraft/.my_jails_cache nopersist securelevel=-1 sysvmsg=disable sysvsem=disable sysvshm=disable allow.chflags allow.nomount allow.mount.nodevfs allow.mount.nofdescfs allow.mount.nolinprocfs allow.mount.nolinsysfs allow.mount.nonullfs allow.mount.noprocfs allow.mount.notmpfs allow.mount.nozfs allow.noquotas allow.raw_sockets allow.set_hostname allow.nosocket_af allow.nosysvipc children.cur=0 children.max=0 cpuset.id=10 host.domainname=   host.hostid=0 host.hostname=basejail.nixcraft.in host.hostuuid=00000000-0000-0000-0000-000000000000 ip4.addr=192.168.2.29 ip4.saddrsel ip6.addr= ip6.saddrsel

How to execute a command inside an existing jail

The syntax is:

# jexec jail command

# jexec basejail bash

# jexex basejail /bin/tcsh

# jexex -U vivek basejail /home/vivek/.bin/updatesite.py

How do I stop the jail?

# jail -r jail

# jail -r basejail

 

To stop all jails

# service jail stop

 

OR

# /etc/rc.d/jail stop

How do I start the jail?

# jail -c jail

# jail -c basejail

 

To start all jails:

# service jail start

 

OR

# /etc/rc.d/jail start

How do I restart the jail?

# jail -rc jail

# jail -rc basejail

 

To start all jails:

# service jail restart

 

OR

# /etc/rc.d/jail restart

A note about config file

I noticed that when FreeNAS get updated it erased my /etc/jail.conf file. So keep file somewhere else safe:

# cp /etc/jail.conf /root/

# cp /etc/jail.conf /mnt/nixcraft/

 

After FreeNAS update or reboot you need to run the following command manually:

# jail -c -f /mnt/nixcraft/jail.conf

 

Another option is to create file as follows (not tested but should work):

# cat /etc/rc.conf.d/jail

jail_enable= YES

jail_conf= /mnt/nixcraft/jail.conf

jail_parallel_start= YES

 

For more info see jail(8), jail.conf(5), and rc.conf(5) man pages.

 

 

]]>
http://wiki.shopingserver.com/install-configure-jails-freenas-corral-10/feed/ 0
How to add ZIL write and L2ARC read cache SSD devices in FreeNAS http://wiki.shopingserver.com/add-zil-write-l2arc-read-cache-ssd-devices-freenas/ http://wiki.shopingserver.com/add-zil-write-l2arc-read-cache-ssd-devices-freenas/#respond Wed, 03 Jan 2018 13:17:06 +0000 http://wiki.shopingserver.com/?p=17798 H

ow do I add the write cache called the ZIL and read cache called L2ARC to my my zroot volume? How do I extend my existing zroot volume with ZIL and L2ARC ssd disks of FreNSA server?

 

ZFS is a file system and logical volume manager originally designed by Sun Microsystems. ZFS used by Solaris, FreeBSD, FreeNAS, Linux and other FOSS based projects. To improve performance of ZFS you can configure ZFS to use read and write caching devices. Usually SSD are used as effective caching devices on production Network-attached storage (NAS) or production Unix/Linux/FreeBSD servers.

More on ZIL

The ZIL is an acronym for ZFS Intent Log. A ZIL act as a write cache. It stores all of the data and later flushed as a transnational write. You can see benefit of a ZIL with a database server such as Oracle, MariaDB/MySQL, PostgreSQL. File server such as NFS and block-level access to storage devices such as iSCSI. If possible configure ZILs using a mirrored disk. Otherwise use some sort of power protection such as APC UPS for FreeNAS server.

More on L2ARC

The L2ARC is an acronym for Level 2 Adjustable Replacement Cache. A L2ARC act as a read cache. You can frequently cache accessed data in RAM using ARC caches. The idea is basic. You must access data from RAM instead of going to your software RAID. As you store more and more data on your server, the percent of data that can store in the cache gets less and less. To solve this problem, one can use the L2ARC. Usually faster SSD used to improve performance. L2ARC act as an extension of the ARC cache.

Configure ZIP and L2ARC in FreeNAS

Open your web-admin panel by typing the URL in a web browser:

https://your-freenas-server-ip-here/

https://192.168.2.13/

 

Click on Storage > Volume Manger:

Fig.01: FreeNAS web interface

 

You must select: Volume to extend (such as nixcraft). Select SSD from available disks:

Fig.01: Write cache is 64GB and the read cache is 120GB

To add read cache is 120GB

Click on 120GB disk + icon from available disks > select cache (L2ARC) from Volume layout > And set size:

Fig.03: Setting L2ARC SSD

To add write cache is 64GB

Click on 64GB disk + icon from available disks > select Log (ZIL) from Volume layout > And set size:

Fig.04: Setting ZIL SSD

 

Finally click on the Extend Volume button.

 

 

]]>
http://wiki.shopingserver.com/add-zil-write-l2arc-read-cache-ssd-devices-freenas/feed/ 0