Thursday, May 16, 2013

GitHub private repository with Coda2

Coda2 does not ask for a username when adding a Git repository; if you use a private repository on GitHub, you must add it to the URL. Copy your repo's HTTPS URL from GitHub, and add 'username@' between 'https://' and 'github.com'. Example:

URL:  https://coty@github.com/coty/coolreponame.git

Wednesday, May 8, 2013

lvm saved my media organization

I had decent media organization until all my drives got full. Now finding a new TV show episode requires looking in 4 potential places, and my fstab is looking convoluted. Upgrading my server gave me the right opportunity to switch to lvm. Current server is 'stolen' and new server is 'Jupiter'.

On Jupiter:
coty@Jupiter:~$ sudo -i
root@Jupiter:~# apt-get install lvm2
root@Jupiter:~# mkdir /mnt/media
root@Jupiter:~# lvm
lvm> pvcreate /dev/sdb1 /dev/sdc1
lvm> vgcreate vg /dev/sdb1 /dev/sdc1
lvm> lvcreate -l 100%FREE -n media vg
lvm> exit
root@Jupiter:~# mkfs.ext4 /dev/vg/media
root@Jupiter:~# mount /dev/vg/media /mnt/media
//root@Jupiter:~# echo '/mnt/media 10.10.10.0/24(rw,async,subtree_check,wdelay)' >> /etc/exports
//root@Jupiter:~# mkdir /etc/exports.d
//root@Jupiter:~# service nfs-kernel-server restart
vi /etc/default/rsync
set RSYNC_ENABLE=true
vi /etc/rsyncd.conf

#motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[media]
path = /mnt/media
#comment = My Very Own Rsync Server
#uid = nobody
#gid = nobody
read only = no
list = yes
#auth users = username
#secrets file = /etc/rsyncd.scrt


On stolen:
//mount 10.10.10.115:/mnt/media /mnt/Jupiter

Adding drives to LVM and resizing volume

/dev/sdg1, /dev/sdf1 are 1.5TB drives. /dev/sdf1 is full, /dev/sdg1 is almost full. Move a bunch of stuff off of /dev/sdg1, resize it, make a partiton, add it to the lvm pool, move more stuff off...

Resize /dev/sdg1 to the minimum partition size:
resize2fs -M /dev/sdg1

Make the new partition from free space:
cfdisk /dev/sdg1

Add it to the pool:
pvcreate /dev/sdg2
vgextend /dev/sdg2
lvextend -l 100%vg /dev/vg/media

Increase the pool partition size to maximum:
resize2fs /dev/vg/media

Cisco IOS break sequence on Mac OS X using USB to serial adapter

I'm using a USB-to-serial adapter with a Prolific 2303 chipset on my Mac with Mountain Lion to reset a Cisco router.

open source Prolific 2303 USB driver
OEM Prolific 2303 USB driver

After you install either of the drivers on your Mac, it will show up as a device in '/dev/'. Search for it:
ls /dev/tty.*

Mine was '/dev/tty.usbserial'. Connect to that device using 'screen' with 9600 serial port speed:
screen /dev/tty.usbserial 9600

Your terminal should now be connected to the serial port.

Boot your Cisco router into ROMMON by power cycling it and then entering the break sequence before it starts to boot IOS - this is usually within the first 20 or 30 seconds of booting. Some newer Cisco routers don't display anything to the serial console until after this time window. So, enter the break sequence after you turn your router on and before IOS loads. Press it multiple times as soon as power is applied to the router to try to catch it at the right time. There are two good methods:

1. For the 'screen' program that comes with OS X: CTRL-A, CTRL-B
That is, CTRL-a followed by CTRL-b. Shift is not required. CTRL-A breaks the keyboard control out of what screen is showing you, allowing you to then enter a keyboard command that screen will process instead of sending it to your serial connection. CTRL-B is a screen command to send the serial break sequence to your serial connection.

2. Reconnect screen with a serial port speed of 1200, power on the router, then press and hold the space bar for 20-30 second (or up to a minute to be safe). screen's output will not be normal while connected at this speed, and this is normal. Reconnect screen with the correct speed (the default is 9600) and press enter - you should be looking at a Rommon 2> prompt.

If you made it into ROMMON, you can change the way that the router boots up with the 'confreg' command. Run it without arguments to get a question-answer style menu you can step through, or if you just want it to boot without reading the config file (factory reset):
confreg 2142

Power cycle the router again and you should be looking at the factory IOS bootup. When you get to the prompt, use 'enable', then 'configure terminal', then 'config-register 0x2102'. This will make the router boot normally, using the config file. You will need to 'write memory' if you want the new factory default config you have to be there when you reboot.

Terminal to Serial/USB Devices From a Mac
Cisco's Break Sequence List
Send break sequence on a Cisco reverse terminal server

Wednesday, May 1, 2013

'no relaying allowed' email errors on OS X - mDNSResponder

Today I'm receiving mail delivery failures when I send email to some domains from Outlook on my Mac. It was mDNSResponder's fault.

Email:

Reporting-MTA: dns; rcdn-iport-6.cisco.com

Final-Recipient: rfc822;recipient@domain.com
Action: failed
Status: 5.0.0 (permanent failure)
Remote-MTA: dns; [123.12.34.56]
Diagnostic-Code: smtp; 5.1.0 - Unknown address error 554-'No relaying allowed - psmtp' (delivery attempts: 0)


And the solution - restart mDNSResponder from the command line (Terminal):

sudo killall mDNSResponder