Skip to content

Instantly share code, notes, and snippets.

@evansus
evansus / 1_create_etherstub_and_vnics.bash
Created November 28, 2012 14:24 — forked from jfqd/1_create_etherstub_and_vnics.bash
Crossbow - Network in a Box - Samples build for OpenIndiana 151a
#!/bin/bash
# create a virtual switch
dladm create-etherstub vswitch0
# create a virtual nic connected to a physical nic
dladm create-vnic -l e1000g0 vnic_ext0 # dns
# create virtual nics connected to a virtual switch
dladm create-vnic -l vswitch0 vnic_int0 # dns

Run VMware Fusion headless at Mac OS system startup.

I heard you like headless VMs on your Mac so I wrote this script for your launchds.

Assumptions

  • Tested on Mac OS X 10.6.4 with VMware Fusion 2.0.5 and 3.1.1.
  • A interactive user automatically logs into the system at startup. I had some issues trying to get this running without an interactive user logged in. I automatically log in for Airfoil Speakers anyway.
  • Your virtual machines live in /Virtual Machines
@evansus
evansus / clonezfs.sh
Last active December 16, 2015 02:09
CloneZFS - clonezfs.sh to recursively clone a snapshot or dataset
#!/bin/sh
#-----------------------------------------
#
# CloneZFS - sh shell script to recursively create a zfs clone of a dataset
#
# Copyright 2013 Evan Susarret evansus@gmail.com
#
#-----------------------------------------
@evansus
evansus / zfsadm
Created November 30, 2013 15:20 — forked from ilovezfs/.gitignore
#!/bin/bash
set -e
#defaults:
export DEV_DIR="/Users/$SUDO_USER/Developer"
export INSTALL_DIR="/osxzfs"
export OWNER="$SUDO_USER"
export BRANCH="master"
export ZFS_BRANCH="default"
export SPL_BRANCH="default"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.openzfsonosx.zfs.zed</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/zedlaunchd</string>
</array>
@evansus
evansus / zvol-blocksize.patch
Last active August 29, 2015 14:02
Adds a new property com.apple.blocksize to zvols
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index b220a41..a461c9a 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -145,6 +145,7 @@ typedef enum {
#ifdef __APPLE__
ZFS_PROP_APPLE_BROWSE,
ZFS_PROP_APPLE_IGNOREOWNER,
+ ZFS_PROP_APPLE_BLOCKSIZE,
#endif
@evansus
evansus / off-cpu-vdev-iokit.d
Last active August 29, 2015 14:02
dtrace probe for OpenZFS on OS X vdev-iokit branch
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option stackframes=100
#pragma D option ustackframes=100
fbt::vdev_iokit_io_start:entry, fbt::vdev_iokit_strategy:entry,
fbt::vdev_iokit_io_done:entry, fbt::vdev_iokit_sync:entry,
fbt::vdev_iokit_alloc:entry, fbt::vdev_iokit_free:entry,
fbt::vdev_iokit_physio:entry, fbt::vdev_iokit_strategy:entry
@evansus
evansus / off-cpu-zfs.svg
Created June 4, 2014 00:55
Off-CPU flame graph for vdev-iokit, zvol_unmap, and more...
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evansus
evansus / off-cpu.out
Created June 4, 2014 01:17
Results from dtrace off-cpu profiling
zfs`vdev_iokit_strategy+0x217
zfs`vdev_iokit_io_start+0x1b2
zfs`zio_vdev_io_start+0x3e8
zfs`__zio_execute+0x12a
zfs`zio_nowait+0x5b
zfs`vdev_mirror_io_start+0x265
zfs`zio_vdev_io_start+0x7c
zfs`__zio_execute+0x12a
zfs`zio_nowait+0x5b
@evansus
evansus / spindump-vdev-taskq.txt
Created June 4, 2014 04:07
spindump while running iozone on a zvol using vdev-taskq topic branch
This file has been truncated, but you can view the full file.
Date/Time: 2014-05-29 02:46:07 -0400
OS Version: 10.9.2 (Build 13C64)
Architecture: x86_64
Report Version: 18
Command: No Target
Path: No Target
Version: ??? (???)
Parent: UNKNOWN PROCESS [0]