December 08, 2014

ZFS Notes

   28  zpool create -f 2TB-RAIDZ raidz /dev/sdc /dev/sdh /dev/sdi
   29  zpool status datastore
   30  mkdir /media/zfs
   31  zfs create -o mountpoint=/media/zfs/ datastore/zfs
   32  zfs list

Scan for new Hard Disks

ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done


zpool status -x datastore
  647  zpool status -v datastore
  667  zpool status -f datastore
  833  zpool health
  834  zpool list
  835  zpool history
 zfs get compressration
 zfs list

August 25, 2014

Raspberry Pi SeedBox

Installed Deluge 1.3.6 as per this post:

http://www.onepitwopi.com/raspberry-pi/installing-deluge-1-3-6-on-a-raspberry-pi/

Find External Hard Drive:

  •  dmesg | grep sd
  • [    4.487833] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)

Delete existing partitions with cfdisk 
  • cfdisk /dev/sda
and create a single primary partition. Then format:
  • mkfs.ext4 /dev/sda1
Mount it and setup automount:
  1. mkdir /media/usbhdd
  2. mount /dev/sda1 /media/usbhdd/
  3. echo "/dev/sda1       /media/usbhdd   ext4    defaults     0       0" >>/etc/fstab
Move /var/log to external HDD

  1.  /etc/init.d/rsyslog stop
  2. mv log /media/usbhdd/
  3. ln -s /media/usbhdd/log
  4.  /etc/init.d/rsyslog start
Script to update Deluge Interface IP (/etc/network/if-up.d):

#! /bin/sh
/etc/init.d/deluge-daemon stop
oldIP=`cat /etc/network/eth0.ip`
newIP=$(ip -f inet -o addr show eth0|cut -d\  -f 7 | cut -d/ -f 1)
logger "DELUGE Updating Deluge IP Address, $oldIP -> $newIP"
sed -i -e 's/listen_interface": "'$oldIP'"/listen_interface": "'$newIP'"/g'  /root/.config/deluge/core.conf
if [ $? = 0 ]; then
    echo $newIP >/etc/network/eth0.ip
    logger "DELUGE IP BINDING SUCCESS"
    /etc/init.d/deluge-daemon start
else
    logger "DELUGE IP BINDING FAILUE"
fi
Setup folder for Deluge stuff:
  1. mkdir /media/usbhdd/media
  2. ln -s /media/usbhdd/media/
Install FlexGet

  1. apt-get install python-pip
  2. pip install flexget

July 02, 2014

Rasplex - Restricting section access at certain times

In case anyone is interested, as this is rasplex and I want to keep the auto updates, I wrote a script that runs on a different box:

sshpass -p 'rasplex' ssh -v root@192.168.1.120 'sed -i -e s/OLDTOKEN/NEWTOKEN/g /storage/.plexht/userdata/guisettings.xml' 
sshpass -p 'rasplex' ssh -v root@192.168.1.120 'sed -i -e "s/Signed in (OLDUSERNAME)/Signed in (NEWUSERNAME)/g" /storage/.plexht/userdata/guisettings.xml'
sshpass -p 'rasplex' ssh -v root@192.168.1.120 'reboot'


I have enabled 'Require authentication on local networks" on the local media server. Would be nice to restart services instead of reboot, but will work on that later.

GPS on Pi

AdaFruit Ultimate GPS Module v3
Wiring:
GPS   RPi GIOP
VIN   5V
GND   GND
RX       TX
TX       RX
——-
nano /boot/cmdline.txt
# Remove these in cmdline.txt:
# `console=ttyAMA0,115200`
# and `kgdboc=ttyAMA0,115200`.
# Mine looks like this:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
—–
Comment out the line “T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100″ at the end of /etc/inittab
nano /etc/inittab
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
—-
apt-get install gpsd gpsd-clients
gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock
cgps