Category Archives: Linux

The Linux Category actually encompasses *BSD, RH, Fedora, Ubuntu, and the like.

BYOBU Infinite Scroll Fix

Installed BYOBU (easier for me to use than screen) on my security-onion
(http://blog.securityonion.net/2012/02/byobu-and-security-onion.html)
apt-get install byobu

Execute byobu
byobu
F9 and set Byobu to launch automatically

Configuration (Pre-12.04 Ubuntu)
byobu-config
Toggle status notifications
Scroll down space bar to disable the logo
Tab to apply and then exit

Configuration (12.04 and later Ubuntu)
byobu-select-backend
Select Screen

Using BYOBU
Control + a = start of menu (F9 for more settings)
Control + a, c = create a new screen
Control + a + a = last screen used
Control + a, 0 = screen 0
Control + a, 3 = screen 3

Weblog Super Cache Issue

On this site I run weblog with automatic updates enabled. I noticed, about a week or so ago, that I saw the following at the top of all of my pages:

define( ‘WPCACHEHOME’, ‘/home/bsdman/it.thelibrarie.com/weblog/wp-content/plugins/wp-super-cache/’ ); //Added by WP-Cache Manager

Well that’s less than fun, but I don’t really care enough to fix it. Unless that’s also screwing with the CSS and making it difficult to see the entire article under the theme I use… The scroll bar was present, but the bottom of the page cut off a lot of the instructions. Awesome.

Lots of searching and I find out that member “stealingsand” is very helpful. http://wordpress.org/support/topic/warning-wp-super-cache-caching-broken-the-script-advanced-cachephp-could-not

I performed the following:
SSH into your box
nano /weblog/wp-config.php

define( ‘WPCACHEHOME’, ‘/home/bsdman/it.thelibrarie.com/weblog/wp-content/plugins/wp-super-cache/’ ); //Added by WP-Cache Manager

This was listed at the top instead of after the ?php section. I just moved it down with the other defines, saved, and exited. Fixed!

iSCSI and iSCSIadm

On a development Oracle environment we were running Oracle (RHEL 6.x) on a Dell PowerEdge R510 server and connected via iSCSI to a SuperMicro NAS (Nas4Free 9.1.x) on a bonded 1Gb ethernet switch (LACP on Cisco). We then changed out the one SuperMicro NAS for an updated and larger NAS and reconnected to the Oracle environment. Unfortunately we also saw attempts to contact the old/retired NAS on iSCSI.

View all iSCSI sessions
iscsiadm -m session

tcp: [2] 10.10.0.137:3260,1 iqn.2013.us.temp.zfs.freenas1:disk0
tcp: [3] 10.10.0.138:3260,1 iqn.2014.us.temp.zfs.freenas2:disk0

Logout of an iSCSI connection
iscsiadm -m node --targetname "iqn.2014.us.temp.zfs.freenas2:disk0" --logout

Logging out of session successful

Discover all available iSCSI on a host
iscsiadm -m discovery -t st -p IPADDRESSOFHOST_ORGROUP

Login to all discovered iSCSI
iscsiadm -m node --loginall=all

Login to specific iSCSI target
iscsiadm -m node -T FQN_IQN:DISK_NUMBER -l -p IPADDRESSOFHOST_ORGROUP

Linux Copy Changed Files

I had a CentOS box that needed to backup files to another NAS system.

So I ran the following:
cp -rufT /source/dir/ /mnt/nas/dest/dir/
Everything copied without a hitch. I then edited one of the files and ran the copy command again. I was greeted with:

cp: overwrite ‘/mnt/nas/dest/dir/file’?

I forgot that CentOS, among other major providers, has an alias for the ‘cp’ command when running as root.

nano /root/.bashrc
Comment out the cp line
Rerun the copy command

Block IP Linux Blackhole

I used to always write up iptables to block certain IP addresses, or use hosts.allow and hosts.deny entries, but Benjamin Cane showed me the light.

Blackhole that IP with a null route!

Add the route
ip route add blackhole IPADDRESSOFOFFENDER

Show the routes
ip route show

Remove the route
ip route del IPADDRESSOFOFFENDER
ip route show

Verify the null route
ssh: connect to host IP port 22: No route to host.

Add ZIL to Nas4Free

I added a ZIL device (120GB SSD) to 2 different pools – if you only have 1 pool (or more) obviously change the directions below. AND my SSD showed up as da0, yours may be different!

Destroy the current file system on your SSD (if this command fails, move onto the next):
gpart destroy -F da0

Create GPT filesystem (if this command fails, try the previous command):
gpart create -s GPT da0

Add a partition
gpart add -s 64G -t freebsd-zfs da0
(da0p1 added)

Add a second partition (optional)
gpart add -s 32G -t freebsd-zfs da0
(da0p2 added)

Verify the partitions
gpart show da0

Add the ZIL to the appropriate pool
zpool add POOLNAME log da0p1
zpool add POOLNAME2 log da0p1

Optional: Remove the pool device
zpool remove POOLNAME DEVICENAME

Check ZIL Usage
zpool list -v
zpool iostat -v 2 300
gstat -a

***EDIT 7/25/14***
I also wanted to add a RAID10 array to my ZFS. I have a supermicro 4U chassis with 24x 3.5″ hot swap sata/sas drives with an Areca 1882i controller. I have 2x SSD in bay 0 and 1 for the ZIL, then 22x 3.5″ 3TB SATA drives. I wanted to have 2 hot spares.

zpool create -m /mnt/zfs zfs mirror da3 da4 mirror da5 da6 mirror da7 da8 mirror da9 da10 mirror da11 da12 mirror da13 da14 mirror da15 da16 mirror da17 da18 mirror da19 da20 spare da21 da22

zpool status

On nas4free I had to go to Disks|zfs|configuration|sync to have it show up in my disks to manage.

zpool set autoreplace=on POOLNAME