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

Cisco Callmanager Custom Ringtone

I’ve verified the steps work (with some deviation required) for CM 4.x through 8.x

As I have access to both Windows and Linux, I have directions that may utilize either one of these platforms.

Save your file as a .wav. I ended up using VLC Player to convert/stream to a .wav file.

On linux (with sox installed)
sox -t wav MYWAVEFILE.wav -t raw -r 8000 -U -b 8 -c 1 NEWFILE.raw resample -ql

Next steps are not well described, but I may expand them later.

Open your callmanager web page
Login on the OS Administration portal
Grab the ringtone.xml file (mine was in the / dir) (TFTP files)
Edit this based on your current ring tone files (follow along like a template)
Upload both the newly edited ringtone.xml and the ringtone.raw
Login on the Unified Serviceability portal
Tools > Services Feature
Restart the TFTP service

Check your phone and verify you can see the new ringtone. I found that certain models (7940) didn’t like ringtones longer than ~5 seconds whereas others (7945) were totally fine.

Chrome Resolving Host Slow Loading

Running Windows 7 Ent x64 fully patched. I noticed that chrome would take a while to open pages – even pages that I had already visited during the day – and I figured there was a problem with my system.

Windows updates had recently patched the system
McCrappy had been removed in favor of Kaspersky
Chrome had been updated to the latest version
Java/Flash/etc were already all up to date

Long story short, I disabled the Built-in Asynchronous DNS functionality of Chrome and noticed a substantial speed difference (gain).

Open a chrome window
navigate to chrome://flags
Find Built-in Asynchronous DNS (about halfway down the page)
Change to disable, and then restart the browser

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

Add PBZIP2 to Nas4Free

I had been using bzip2 for compressing items. It was great – averaging a 9:1 compression of huge database exports. However, running 1 file at a time was taking way too long. Enter pbzip2 (parallelized)!

Since nas4free/freenas is based upon the freebsd platform, we can run the pkg_add to add this package. If you’re using the embedded version of nas4free, you may lose this install after a reboot or upgrade.

SSH to your nas4free box
pkg_add -r pbzip2

Make a symlink for ease of use
ln -s /usr/local/bin/pbzip2 /usr/sbin/pbzip2

Profit.

Now you can run “pbzip2” from anywhere in the shell.

Ramblings Of An IT Person