How to add a new hard disk or partition using UUID and ext4 filesystem

Adding a additional hard disk to your workstation or server is easy and often required. Here’s we’ll step through the process of identifing the newly attached drive, prepare and mount it by referencing UUID which is a preferred method today.

If you have just added a virtual disk to a virtual machine, make sure you restart the virtual machine before mounting the new disk.

1. Figure out the device name for the new device

fdisk -l

This will give you output similar to this:

Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders, total 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000299d1

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 32088063 16043008 83 Linux
/dev/sda2 32090110 33552383 731137 5 Extended
/dev/sda5 32090112 33552383 731136 82 Linux swap / Solaris

Disk /dev/sdb: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders, total 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table

2. Next we’ll partion the new disk using the following command:

cfdisk /dev/sdb

> New -> Primary -> Specify size in MB
> Write -> yes
> Quit

3. Format the new disk using the ext4 filessystem

mkfs.ext4 /dev/sdb1

4. You need to create a new directory where the disk will be mounted in the filesystem

mkdir /disk2

You can name the folder whatever your want and place it in a subfolder of another mounting point, for example /var/disk2

5. It’s preferred to use the device UUID (Universally Unique Identifier) instead of directly linking to the device path because while UUID always stays the same, the device path may change. This is how we find the UUID:

blkid

Which shows a list of all partitions and the assigned UUID. The list should look similar to this:

/dev/sda5: UUID="180cab2a-300a-4e3d-8c8e-0e1df46b9bf7" TYPE="swap"
/dev/sda1: UUID="cd0c7b2c-bf50-4557-bc01-0048764a41d2" TYPE="ext4"
/dev/sdb1: UUID="359d90df-f17a-42f6-ab13-df13bf356de7" TYPE="ext4"

6. Add the new disk/partition to fstab to automatically mount it on boot

echo "UUID=359d90df-f17a-42f6-ab13-df13bf356de7 /disk2 ext4 errors=remount-ro 0 1" >> /etc/fstab

Replace the UDID value to the UDID displayed in step 5 for the new disk and replace /disk2 with the path where you want to mount the disk in the filesystem as specified in step 4

7. Manually mount the disk (you can also reboot the machine and it will be automatically mounted)

mount /disk2

/disk2 is the directory created in step 4

Now your new hard disk is mounted and ready to use.

Source: http://www.debiantutorials.com/how-to-add-a-new-hard-disk-or-partition-using-uuid-and-ext4-filesystem/

How To Install Zabbix Agent on Ubuntu 16.04/14.04 LTS and Debian 8/7

Zabbix Agent is required to install on all remote systems needs to monitor through Zabbix server. The Zabbix Agent collects resource utilization and applications data on client system and provide such information to Zabbix server on their requests.

There are two types of checks can be configured between Zabbix Server and Client.

  • Passive Check : Zabbix Agent only sent data to server on their request.
  • Active Check : Zabbix Agent sends data periodically to Server.

After installing zabbix server on your server, this article will help you to install zabbix agent on Ubuntu 14.04 LTS and 12.04 LTS systems. After completing this below steps go to next article add host in zabbix server.

Install Zabbix Agent on Ubuntu & Debian

Follow the below instructions to install Zabbix agent on Ubuntu 14.04 LTS, 12.04 LTS and Debian systems.

Step 1 – Add Apt Repository

Zabbix apt repositories are available on zabbix official website. Add repository to install required packages for zabbix agent using following command. Ubuntu 12.04 LTS have zabbix agent version 2.2.

For Ubuntu 16.04 LTS:
$ wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+xenial_all.deb
$ sudo dpkg -i zabbix-release_3.0-1+xenial_all.deb
$ sudo apt update

For Ubuntu 14.04 LTS:

$ wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb
$ sudo dpkg -i zabbix-release_3.0-1+trusty_all.deb
$ sudo apt-get update

For Ubuntu 12.04 LTS:

$ wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.2-1+precise_all.deb
$ sudo dpkg -i zabbix-release_2.2-1+precise_all.deb
$ sudo apt-get update

For Debian 8:

$ wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_3.0-1+jessie_all.deb
$ sudo dpkg -i zabbix-release_3.0-1+jessie_all.deb
$ sudo apt-get update


For Debian 7:

$ http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix-release/zabbix-release_3.0-1+wheezy_all.deb
$ sudo dpkg -i zabbix-release_3.0-1+wheezy_all.deb
$ sudo apt-get update

Step 2 – Install Zabbix Agent

As we have successfully added zabbix apt repositories in our system let’s use following command to install Zabbix agent using following command

$ sudo apt-get install zabbix-agent

Step 3 – Edit Zabbix Agent Configuration

After installing completed of Zabbix aget. Edit zabbix agent configuration file /etc/zabbix/zabbix_agentd.conf and update Zabbix server ip

#Server=[zabbix server ip]
#Hostname=[Hostname of client system ]

Server=192.168.1.11
Hostname=Server2

Step 4 – Restarting Zabbix Agent

After adding zabbix server ip in configuration file, now restart agent service using below command.

# /etc/init.d/zabbix-agent restart

To start and stop zabbix-agent service anytime use following commands.

# /etc/init.d/zabbix-agent start
# /etc/init.d/zabbix-agent stop

Congratulation’s! You have successfully installed Zabbix Agent. Lets Add Host in Zabbix Serverto be monitory.

Source: http://tecadmin.net/install-zabbix-agent-on-ubuntu-and-debian/#

How to Install Zabbix Agent on CentOS/RHEL 7/6/5

Zabbix Agent is required to install on all remote systems needs to be monitor through Zabbix server. The Zabbix Agent collects resource utilization data and applications data on client system and provide such information to Zabbix server on their requests.

There are two types of checks between Zabbix Server and Client.

  • Passive Check : Zabbix Agent sent data to server on their request.
  • Active Check : Zabbix Agent sends data periodically to Server.

After installing zabbix server on your server, Now we are moving to install agent on remote system’s. This article will help you to install zabbix agent on CentOS/RHEL 7/6/5 systems. After completing this step go to next article add Host in Zabbix Server.

Installing Zabbix Agent

Follow the below instructions to install Zabbix Agent on CentOS, RHEL 7/6/5 systems.

Step 1 – Add Required Repository

Before installing Zabbix Agent first configure zabbix yum repository using following commands as per your required version and operating system.

CentOS/RHEL 7:
# rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

CentOS/RHEL 6:
# rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

CentOS/RHEL 5:
# rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/5/x86_64/zabbix-release-3.0-1.el5.noarch.rpm

Step 2 – Install Zabbix Agent

After installing yum repository packages in our system. Now use following command to install Zabbix agent on your Linux system.

# yum install zabbix zabbix-agent

Step 3 – Edit Zabbix Agent Configuration

As zabbix agent has been successfully installed on our remote system. Now we just need to configure zabbix agent by adding zabbix server ip in its configuration file /etc/zabbix/zabbix_agentd.conf

#Server=[zabbix server ip]
#Hostname=[ Hostname of client system ]

Server=192.168.1.11
Hostname=Server1

Step 4 – Restarting Zabbix Agent

After adding zabbix server ip in configuration file, now restart agent service using below command.

# /etc/init.d/zabbix-agent restart

To start and stop zabbix-agent service anytime use following commands.

# /etc/init.d/zabbix-agent start
# /etc/init.d/zabbix-agent stop

Congratulation’s! You have successfully installed Zabbix Agent. Lets add host in zabbix serverto be monitory.

Source: http://tecadmin.net/install-zabbix-agent-on-centos-rhel/

Why can’t I access forwarded ports on my WAN IP from my LAN/OPTx networks?

By default, pfSense does not allow LAN/OPTx connected PCs to reach forwarded ports on the WAN interface. This is a technical limitation of how the underlying PF functions, it cannot « reflect » in and out the same Interface; it only works when passing « through » the router. NAT Reflection employs some simple bouncing daemons to redirect the connections, which works but isn’t always desirable, or even functional for some scenarios. Usually, split DNS is the better way if it is possible on your network. Both are explained here.

Method 1: NAT Reflection

In order to access ports forwarded on your WAN interface from internal networks, you need to enable NAT reflection.

In order to do this, you must go to System > Advanced, and from there uncheck « Disable NAT Reflection ». Click save, and it should work. This will only work with single port forwards or ranges of less than 500 ports. If you’re using 1:1 NAT, you can’t use NAT Reflection.

Example of system with NAT Reflection enabled. (Disable choice is unchecked).

Method 2: Split DNS

The more elegant solution to this problem involves using Split DNS. Basically this means that internal and external clients resolve your hostnames differently.

Your internal clients would access your resources by hostname, not IP, and clients on your local network would resolve that hostname to your LAN IP, and not the WAN IP as others outside your network would see.

In order for this to work using the DNS forwarder in pfSense, your clients will need to have the IP Address of the pfSense router as their primary DNS server.

Example:

Some screenshots that show the above in practice:

Split DNS Example, adding DNS Override

Split DNS Example, what your screen should look like with http://www.example.com overridden as 192.168.1.5

 

Method 3: Experimental Routing Tricks

This should be considered experimental, and could possibly cause bad things to happen!

If you’re using 1:1 NAT, you can’t use NAT Reflection. If you’re a service provider (a web host, say), you may not have all relevant DNS entries under your control, so « Method 2: Split DNS » may be difficult to implement.

If you have a CIDR network block allocated to you which is all behind your pfSense firewall, you might be better off using public addresses on your internal network, or using a mix of public and private addresses.

If you have only a portion of your CIDR block behind pfSense, and you’re using 1:1 NAT, you may have a difficult situation. Here’s a possible approach you can consider. This may not work, or may work in only some situations. Be careful: don’t try this if you’re remote or don’t have console access to your devices.

1. Make the external IP address an alias on your loopback interface (the interface with localhost/127.0.0.1 on it). In FreeBSD, that’s something like this on the command line:

Used in <shellcmd> tags in pfSense, as described here.

2. Cause every other internal host to route traffic destined to your external IP to your internal IP. There may be 3 ways to do this:

a) Add a static route on every other host with something like route add -host 1.2.3.4 10.0.0.4 but you have to run that on every other host. This option can quickly become administratively difficult as the number of internal hosts goes up, but this can be mitigated if you have centralized administration (via something like cfagent, say).

b) Run a routing protocol – routed for example – on your internal network, and publish routes reflecting the external/internal 1:1 NAT mapping. This might be the most complicated choice, but might scale better than the other alternatives.

c) This seems to not work, presumably because pfSense already knows a route to the external network: Add static routes on the LAN interface of your pfSense firewall with a destination of the external address (1.2.3.4/32) and a gateway of the internal address (10.0.0.4/32). This alternative worries me a little bit, as I’m afraid it might confuse the firewall – I don’t think so, but please be careful.

Source: http://dablog.informafix.net/204