How to check the raid controller on Linux:

# lspci | grep -i raid
01:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 05)

Monitoring Tools

/proc/mdstat
You should get to know /proc/mdstat, looking at it often. This will tell you the state of your arrays, and very importantly it will tell you whether any drives have failed, and whether any arrays are degraded. Check, and check regularly!

xosview
xosview is a venerable utility, and one of the author’s favourites. It is capable of displaying the state of raid arrays, but unfortunately currently the code is broken – it reads mdstat, and doesn’t understand the current output. It is currently (2016) being updated to read the status directly from /sys, and should hopefully soon be able to display raid status correctly. The author leaves xosview running permanently on his desktop to provide an overview of system performance.

mdadm
mdadm –monitor –scan –mail a@b.co.uk
This will fire up mdadm to keep an eye on your arrays. It will daemonize and run in the background, sending an email to the specified address if it detects any problems related to a disk failure. This is good for remote monitoring BUT. It won’t tell you if anything goes wrong with the monitoring! You cannot assume – even if you put this in your boot-up sequence as you should – that you will be notified about important events. It’s not unknown for the daemon to fail.

Don’t rely on this! Check regularly on a manual basis!

smartctl
This tool tells you all sorts of information about your drives. When you read the “When things go wrogn” section, you will see that smartctl is a very important diagnostic tool, but it also provides a lot of proactive information to help you anticipate a drive failure.

There are various S.M.A.R.T. stats that can be looked at which will provide clues:

Attribute | Description |
SMART 5 | Reallocated Sectors Count |
SMART 187 | Reported Uncorrectable Errors |
SMART 188 | Command Timeout |
SMART 197 | Current Pending Sector Timeout |
SMART 198 | Uncorrectable Sector Count |
Backblaze.com (who run huge raid arrays) have a lot of interesting information on their site. They point out that maybe a quarter of their drives fail when all these statistics are 0, so a healthy SMART report does not necessarily mean a healthy drive, but almost none of their drives survive having errors on all five counts.

smartctl also reports on things like drive temperature, how long the drive has been powered on, how many times it has been started and shut down etc. It’s no surprise that drives that get too hot or are otherwise stressed beyond normal limits tend to fail early.

Smartmontools for RAID

https://www.smartmontools.org/wiki/Supported_RAID-Controllers

Recently I encountered a server that had an Apache configuration file that was over 500,000 lines. Changes needed to make were to comment out the CustomLog line for each domain in /etc/httpd/httpd.conf. For this command, I used SED.

NAME
sed – stream editor for filtering and transforming text

SYNOPSIS
sed [OPTION]… {script-only-if-no-other-script} [input-file]…

DESCRIPTION

Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distinguishes it from other types of editors.

Change directory to the log file location. Use below to see what the command will do before doing it.

# sed -n 's|CustomLog|#CustomLog|gp' /etc/apache2/conf/httpd.conf

Use this to alter the file directly.

# sed -i 's|CustomLog|#CustomLog|g' /etc/apache2/conf/httpd.conf

CIFS stands for Common Internet File System. This is application-level network protocol mainly used to provide shared access to files, printers, serial ports, and miscellaneous communications between nodes. You can access CIFS share from Linux and mount them as a regular filesystem. This is handy if there is a backup service like Infrascale where you set up a windows computer to be backed up. As there is no linux application for infrascale.

The following example values will be used in this example:

IP address for the server: 192.168.1.104
Share name on Windows Server: C:\backuptemp
User name: testuser
Domain: testdomain
Mount point on Linux Server: /mnt/winmount

The environment is a Windows Domain with Active Directory. There is a file share set up as C:\backuptemp

Make the local mount point on the linux server:

# mkdir mnt/winmount

To mount the network share, use the following command and enter the password of the user:

# mount -t cifs //192.168.1.104/backuptemp /mnt/winmount -o user=testuser

How do I display a list of all network cards under Linux operating systems?

You can use any one of the following command to list network cards installed under Linux operating systems. Please note that the ifconfig and ip commands will also display interfaces information about vpn, loopback, and other configured interfaces.

  • lspci command : List all PCI devices.
  • lshw command : List all hardware.
  • dmidecode command : List all hardware data from BIOS.
  • ifconfig command : Outdated network config utility.
  • ip command : Recommended new network config utility.
  • lspci command

Type the following command:

# lspci | egrep -i --color 'network|ethernet'

Sample outputs:

09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5761e Gigabit Ethernet PCIe (rev 10)
0c:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300

lshw command

The lshw command can extract detailed information on the hardware configuration of the machine including network cards. Type the following command:

# lshw -class network

Sample outputs:

  *-network DISABLED      
       description: Wireless interface
       product: Ultimate N WiFi Link 5300
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:0c:00.0
       logical name: wlan0
       version: 00
       serial: 00:21:6a:ca:9b:10
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=3.2.0-0.bpo.1-amd64 firmware=8.83.5.1 build 33692 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn
       resources: irq:46 memory:f1ffe000-f1ffffff
  *-network
       description: Ethernet interface
       product: NetXtreme BCM5761e Gigabit Ethernet PCIe
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:09:00.0
       logical name: eth0
       version: 10
       serial: b8:ac:6f:65:31:e5
       size: 1GB/s
       capacity: 1GB/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.121 duplex=full firmware=5761e-v3.71 ip=192.168.1.5 latency=0 link=yes multicast=yes port=twisted pair speed=1GB/s
       resources: irq:48 memory:f1be0000-f1beffff memory:f1bf0000-f1bfffff

ifconfig and ip command

To see all configured network devices, enter:

# ifconfig -a

OR

# ip link show

OR

# ip a

Sample outputs:

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.5/24 brd 192.168.1.255 scope global eth0
    inet6 fe80::baac:6fff:fe65:31e5/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0:  mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:21:6a:ca:9b:10 brd ff:ff:ff:ff:ff:ff
4: pan0:  mtu 1500 qdisc noop state DOWN 
    link/ether 92:0a:e7:31:e0:83 brd ff:ff:ff:ff:ff:ff
5: vmnet1:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.121.1/24 brd 192.168.121.255 scope global vmnet1
    inet6 fe80::250:56ff:fec0:1/64 scope link 
       valid_lft forever preferred_lft forever
6: vmnet8:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.179.1/24 brd 192.168.179.255 scope global vmnet8
    inet6 fe80::250:56ff:fec0:8/64 scope link 
       valid_lft forever preferred_lft forever

/proc/net/dev

The dev pseudo-file contains network device status information. This gives the number of received and sent packets, the number of errors and collisions and other basic statistics.

$ cat /proc/net/dev

Sample outputs:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:   20097     179    0    0    0     0          0         0    20097     179    0    0    0     0       0          0
vmnet8:       0       0    0    0    0     0          0         0        0      33    0    0    0     0       0          0
  pan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
 wlan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0: 592509534  623058    0    0    0     0          0      1053 122269656  401567    0    0    0     0       0          0
vmnet1:       0       0    0    0    0     0          0         0    

Using a text editor, create a file in which to store your private key. This example uses the file private_key.txt.
To edit the file in nano, type the following command


# nano deployment_key.txt

Paste the private key into the file. Be sure to include the BEGIN and END lines.

-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAx9ODcgSZFhPnZmW/VGWy/bXLKFBhOoTP9k4dhcJq17ZuG9KB
...
-----END RSA PRIVATE KEY-----

Run the following command to change the file permissions to 600 to secure the key. You can also set them to 400. This step is required:


# chmod 600 deployment_key.txt

Use the key to log in to the SSH client as shown in the following example, which loads the key in file private_key.txt, and logs in as user demo,to IP 192.237.248.66:


# ssh -i deployment_key.txt demo@192.237.248.66

When the prompt to confirm the connection request is displayed, type yes and then press Enter.

If your SSH key requires a password, enter it when prompted to complete the connection.

Sysstat

For disk I/O trending there are a few options. the sar command from sysstat. By default, it gives output like this:

# sar
Linux 2.6.32-642.11.1.el6.x86_64 (test.geekdecoder.com)    01/26/2017      _x86_64_        (2 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all      0.03      0.00      0.03      0.09      0.00     99.85
12:20:01 AM     all      0.27      0.00      0.04      0.00      0.00     99.69
12:30:01 AM     all      0.33      0.00      0.05      0.00      0.00     99.62
12:40:01 AM     all      1.01      0.00      0.18      1.18      0.00     97.63
12:50:01 AM     all      0.15      0.00      0.04      0.00      0.00     99.80
01:00:01 AM     all      0.16      0.00      0.03      0.00      0.00     99.80
01:10:01 AM     all      0.22      0.00      0.04      0.00      0.00     99.74
01:20:01 AM     all      0.36      0.00      0.05      0.00      0.00     99.59
01:30:01 AM     all      0.23      0.00      0.04      0.00      0.00     99.74
01:40:01 AM     all      0.70      0.00      0.25      6.23      0.00     92.82
01:50:01 AM     all      0.13      0.00      0.03      0.00      0.00     99.83
02:00:01 AM     all      0.16      0.00      0.04      0.00      0.00     99.80
02:10:01 AM     all      0.21      0.00      0.04      0.00      0.00     99.75
02:20:01 AM     all      0.30      0.00      0.04      0.00      0.00     99.66
02:30:01 AM     all      0.14      0.00      0.03      0.00      0.00     99.83
02:40:01 AM     all      0.20      0.00      0.03      0.00      0.00     99.76
02:50:01 AM     all      0.32      0.00      0.05      0.00      0.00     99.63
03:00:01 AM     all      0.21      0.00      0.03      0.00      0.00     99.76
03:10:01 AM     all      0.19      0.00      0.04      0.00      0.00     99.77
03:20:01 AM     all      0.12      8.44      2.69     10.79      0.00     77.96
03:30:01 AM     all      0.13      4.52      8.36      0.30      0.00     86.69
03:40:01 AM     all      0.48      0.00      0.05      0.02      0.00     99.45
03:50:01 AM     all      0.15      0.00      0.04      0.01      0.00     99.80
04:00:01 AM     all      0.13      0.00      0.03      0.00      0.00     99.84
04:10:01 AM     all      0.48      0.00      0.06      0.04      0.00     99.43
04:20:01 AM     all      0.17      0.00      0.05      0.11      0.00     99.67
04:30:01 AM     all      0.22      0.00      0.04      0.00      0.00     99.74
04:40:01 AM     all      0.89      0.00      0.08      0.16      0.00     98.87
04:50:01 AM     all      0.55      0.00      0.07      0.05      0.00     99.34
05:00:01 AM     all      0.11      0.00      0.04      0.01      0.00     99.85
05:10:01 AM     all      0.09      0.00      0.03      0.00      0.00     99.87
05:20:01 AM     all      0.17      0.00      0.04      0.00      0.00     99.80
05:30:01 AM     all      0.27      0.00      0.05      0.08      0.00     99.60

Read More

Find your drives

# fdisk -l

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2089    16264192   8e  Linux LVM

Disk /dev/mapper/vg_backup-lv_root: 14.9 GB, 14935916544 bytes
255 heads, 63 sectors/track, 1815 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_backup-lv_swap: 1715 MB, 1715470336 bytes
255 heads, 63 sectors/track, 208 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

SDA is the primary

hdparm Command

Open the terminal and type the following


# hdparm -I /dev/sda

OR


$ sudo hdparm -I /dev/sda

The ‘neighbor table overflow’ is a VERY common linux issue on large networks. Some network trigger this with default linux settings (because the previous network regime put so many IP address subnets on a single vlan , it creates large ARP tables – which is not normal / default settings). It is not an indication of anything wrong. It is a trigger of linux default.

Here is how to adjust:
If you see this….

__ratelimit: 20 callbacks suppressed
Neighbour table overflow.

For busy networks increase the kernel’s internal ARP cache size. The following kernel variables are used:


net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh2
net.ipv4.neigh.default.gc_thresh3
To see current values, type:

Run this…


# sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 128

# sysctl net.ipv4.neigh.default.gc_thresh2
net.ipv4.neigh.default.gc_thresh2 = 512

# sysctl net.ipv4.neigh.default.gc_thresh3
net.ipv4.neigh.default.gc_thresh3 = 1024

You need to make sure that the arp table to become bigger than the above defaults. The above limitations are good for small network or a single server. This will also affect your DNS traffic.

How Do I Fix “Neighbour Table Overflow” Error?


# vi /etc/sysctl.conf

Append the following:

## works best with <= 500 client computers ## # Force gc to clean-up quickly net.ipv4.neigh.default.gc_interval = 3600 # Set ARP cache entry timeout net.ipv4.neigh.default.gc_stale_time = 3600 # Setup DNS threshold for arp net.ipv4.neigh.default.gc_thresh3 = 4096 net.ipv4.neigh.default.gc_thresh2 = 2048 net.ipv4.neigh.default.gc_thresh1 = 1024 [/bash] To load new changes type the following command:[bash] # sysctl -p [/bash]