Skip to content

Instantly share code, notes, and snippets.

@b333z
b333z / gist:1048400
Created June 27, 2011 06:35 — forked from maxsum-corin/gist:1044165
Multiple windows in vim
:split filename
ctrl-w w split window and load another file
:vsplit filename
ctrl-w v vertical split
:hide
ctrl-w q close current window
ctrl-w arrow move cursor up/down/left/right a window
ctrl-w ctrl-w move cursor to another window (cycle)
@b333z
b333z / dev_zfs_hang
Created December 14, 2011 09:22
dev_zfs_hang
b15 ~ # strace zfs diff data@empty
execve("/sbin/zfs", ["zfs", "diff", "data@empty"], [/* 22 vars */]) = 0
brk(0) = 0x1e78000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc9a7674000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=38828, ...}) = 0
mmap(NULL, 38828, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc9a766a000
close(3) = 0
open("/lib64/libspl.so.1", O_RDONLY) = 3
@b333z
b333z / gist:4069201
Created November 13, 2012 23:45
shell replacment for watch
while true ; do clear ; <foo command here> ; sleep 5 ; done
@b333z
b333z / gist:4290844
Last active October 14, 2015 02:07 — forked from anonymous/gist:4290841
git add .gitkeep to working dir tree to preserve empty dirs
find . -type d -empty -exec touch {}/.gitkeep \;
@b333z
b333z / gist:4416090
Created December 30, 2012 23:48
git list ignored files
git ls-files -o -i --exclude-standard
@b333z
b333z / ebuild_switch_source_control..txt
Created May 19, 2013 04:13
Switching source control details on 9999 gentoo ebuilds using /etc/portage/env
# cd /etc/portage/env
# find . -ls
1040459 4 drwxr-xr-x 4 root root 4096 May 17 20:57 .
1040460 4 drwxr-xr-x 2 root root 4096 May 17 21:00 ./sys-fs
1044487 4 -rw-r--r-- 1 root root 501 May 17 21:00 ./sys-fs/zfs
1044262 0 lrwxrwxrwx 1 root root 3 Oct 10 2012 ./sys-fs/zfs-kmod -> zfs
1043259 4 drwxr-xr-x 2 root root 4096 Jan 30 22:40 ./sys-kernel
1044264 4 -rw-r--r-- 1 root root 223 Sep 1 2012 ./sys-kernel/spl
# cat ./sys-fs/zfs-kmod # This allows me to jump around people's repos and branches
#!/bin/bash
@b333z
b333z / issue-1803.txt
Last active December 28, 2015 07:19
zfs issue-1803 test results
Test started: 2013-11-14_13-21-20
pre_pkg_setup() {
EGIT_REPO_URI="file:///zfs/zfs"
EGIT_BRANCH="issue-1803"
}
pre_pkg_setup() {
EGIT_REPO_URI="https://github.com/zfsonlinux/spl.git"
EGIT_BRANCH="master"
}
@b333z
b333z / zfs_slog_zero_vsalloc_inline.patch
Last active January 2, 2016 07:18
This Systemtap script is to provide a workaround with removal of slog device that fails due to vs_alloc for the device != 0. As a safely precaution ZFS refuses to remove the device. It basically implements a linux version of a workaround described here: http://zpool.org/2012/01/10/how-to-fix-a-stuck-zfs-log-device.
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 4c8f8bf..6b4ca40 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -5250,6 +5250,13 @@ spa_vdev_remove_from_namespace(spa_t *spa, vdev_t *vd)
ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL);
ASSERT(vd == vd->vdev_top);
+ // slog stuck hack - barnes333@gmail.com - https://github.com/zfsonlinux/zfs/issues/1422
+ if (vd->vdev_islog == 1 && vd->vdev_removing == 1
@b333z
b333z / issue-1208-r1.patch
Last active August 29, 2015 14:02
zfs - issue-1208
Info for issue-1208
@b333z
b333z / gentoo-chroot
Last active August 29, 2015 14:19
gentoo scripts
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
function chroot()
{
CHROOT_ROOT=$1
echo "Chrooting to $CHROOT_ROOT"