Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / gist:df1a3adde29d9d0d64b8
Last active August 29, 2015 14:15
Converting from gmirror to zfs
CPU: Intel(R) Atom(TM) CPU D525 @ 1.80GHz (1800.04-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x106ca Family = 0x6 Model = 0x1c Stepping = 10
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0x40e31d<SSE3,DTES64,MON,DS_CPL,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE>
AMD Features=0x20100800<SYSCALL,NX,LM>
AMD Features2=0x1<LAHF>
TSC: P-state invariant, performance statistics
real memory = 4294967296 (4096 MB)
avail memory = 4081803264 (3892 MB)
@dlangille
dlangille / btape
Last active August 29, 2015 14:16
FreeBSD 11 - new sa(4) code
[root@cuppy:/usr/home/dan] # btape -c /usr/local/etc/bacula/bacula-sd.conf /dev/nsa1
Tape block granularity is 1024 bytes.
btape: butil.c:287-0 Using device: "/dev/nsa1" for writing.
btape: btape.c:469-0 open device "DLT" (/dev/nsa1): OK
*test
=== Write, rewind, and re-read test ===
I'm going to write 10000 records and an EOF
then write 10000 records and an EOF, then rewind,
@dlangille
dlangille / poudriere-builds.sh
Created March 5, 2015 20:19
daily poudriere builds
#!/bin/sh
POUDRIERE="/usr/local/bin/poudriere"
TREES="default testing"
AMD64_SETS="master-list master-list-php5"
I386_SETS="master-list-i386"
@dlangille
dlangille / gist:191c7dc1b29bab8cfefd
Created March 27, 2015 14:07
zfs destroy -r FS@snapshot example
An example of how zfs destroy -r will remove snapshots on child datasets.
[root@slocum:~] # zfs create system/SnapShotTesting
[root@slocum:~] # zfs create system/SnapShotTesting/A
[root@slocum:~] # zfs create system/SnapShotTesting/B
[root@slocum:~] # zfs create system/SnapShotTesting/B
cannot create 'system/SnapShotTesting/B': dataset already exists
[root@slocum:~] # zfs create system/SnapShotTesting/C
[root@slocum:~] # zfs create system/SnapShotTesting/C/CC
[root@slocum:~] # zfs snapshot -r system/SnapShotTesting@TEST
@dlangille
dlangille / check_host_vs_jails.sh
Last active August 29, 2015 14:17
Compare iocage jail version against the host - nagios check
#!/bin/sh
HOSTVERSION=`/usr/bin/file /bin/sh`
JAILS=`/usr/local/sbin/iocage list | /usr/bin/egrep -v '^JID' | /usr/bin/cut -f 2 -w`
ERRORS=''
for jail in ${JAILS}
do
JAILVERSION=`/usr/local/sbin/iocage chroot ${jail} 'file /bin/sh'`
if [ "${JAILVERSION}" != "${HOSTVERSION}" ]
@dlangille
dlangille / wget
Created April 12, 2015 01:03
T-mobile tethering not working in Canada
$ wget -S http://www.google.com/
--2015-04-11 15:40:52-- http://www.google.com/
Resolving www.google.com (www.google.com)... 64.233.168.147, 64.233.168.106, 64.233.168.104, ...
Connecting to www.google.com (www.google.com)|64.233.168.147|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Location: http://t-mo.co/IntSMH
Content-Type: text/html; charset=iso-8859-1
Proxy-Connection: close
Location: http://t-mo.co/IntSMH [following]
[dan@knew:~] $ zfs list
NAME USED AVAIL REFER MOUNTPOINT
system 16.6T 3.67T 329K /
system/backups-by-snapshot 10.2G 3.67T 384K /usr/home/ansel/snapshots
system/backups-by-snapshot/mailjail 10.2G 3.67T 9.46G /usr/home/ansel/snapshots/mailjail
system/backups-by-snapshot/mounted 329K 3.67T 329K /usr/home/ansel/snapshots/mounted
system/backups-by-snapshot/testing 329K 3.67T 329K /usr/home/ansel/snapshots/testing
system/root 1.76M 3.67T 567K /root
system/rootfs 4.54G 3.67T 3.01G legacy
system/tmp 7.78G 3.67T 7.69G /tmp
This says 2.6TB used, but only 416GB referred. My conclusion: I could free up 416G
by removing the snapshots.
$ zfs list -r -t all -o name,used,refer,written system/usr/jails/dbclone.backups
NAME USED REFER WRITTEN
system/usr/jails/dbclone.backups 2.61T 416G 0
system/usr/jails/dbclone.backups@2015-02-01_06.21.00--3m 0 389G 389G
system/usr/jails/dbclone.backups@2015-02-01_07.21.00--3m 0 389G 0
system/usr/jails/dbclone.backups@2015-02-01_08.21.00--3m 0 389G 0
system/usr/jails/dbclone.backups@2015-02-01_09.21.00--3m 0 389G 0
Based on this:
$ zfs get usedbysnapshots system/usr/local/bacula
NAME PROPERTY VALUE SOURCE
system/usr/local/bacula usedbysnapshots 3.26T -
... removing all snapshots should free up 3.26T.
But looking below, I found it difficult to see that.
@dlangille
dlangille / diff
Created May 2, 2015 21:13
Changing bacula client from being backed up over VPN to being backed up over internet
$ diff -uN $D/client-zuul.conf client-zuul.conf
+++ /.zfs/snapshot/2015-05-01_05.21.00--3m/usr/local/etc/bacula/client-zuul.conf 2015-03-04 20:03:11.271133766 +0000
--- client-zuul.conf 2015-05-02 19:57:35.949442304 +0000
@@ -1,13 +1,11 @@
# Client (File Services) to backup
Client {
Name = zuul-fd
+ Address = zuul.example.org
- Address = zuul.vpn.example.org
FDPort = 9102