Skip to content

Instantly share code, notes, and snippets.

View dasjoe's full-sized avatar

Hajo Möller dasjoe

  • Hamburg, Germany
View GitHub Profile
. /etc/os-release
cat > /etc/apt/apt.conf.d/01norecommend <<'EOF'
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
cat > /etc/apt/apt.conf.d/99AutomaticClean <<'EOF'
DSELECT::Clean "always";
EOF
@dasjoe
dasjoe / keybase.md
Created September 24, 2017 20:40
keybase.md

Keybase proof

I hereby claim:

  • I am dasjoe on github.
  • I am dasjoe (https://keybase.io/dasjoe) on keybase.
  • I have a public key ASDi4qMKAgChZZM62sxPcPVu6eq4_suF-VrqPNtuK6zKOAo

To claim this, I am signing this object:

@dasjoe
dasjoe / hpa.sh
Created May 29, 2016 17:19
Set up custom over-provisioning of 25% by setting the host-protected area
# Samsung 850 Pro 256 GB: 2 * 8 * 86 Gibit + 2 * 4 * 86 Gibit
# 541065216 - actual 512B sectors
# 500118192 - visible sectors, rest is hidden even to hdparm
# 405798912 - 25% OP, mod 8 = 0 for ashift=12
#
hdparm -Np405798912 --yes-i-know-what-i-am-doing /dev/disk/by-id/ata-Samsung_SSD_850_PRO_256GB_S251NX0H441956W
hdparm --user-master u --security-set-pass Eins /dev/disk/by-id/ata-Samsung_SSD_850_PRO_256GB_S251NX0H441956W
time hdparm --user-master u --security-erase Eins /dev/disk/by-id/ata-Samsung_SSD_850_PRO_256GB_S251NX0H441956W
# Disable automatic installation of recommended or suggested packages
cat > /etc/apt/apt.conf.d/01norecommend <<EOF
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF
# Get required tools, i.e. debootstrap and ZFS userspace tools
apt-get --quiet update
apt-get --yes --quiet install debootstrap zfsutils-linux dosfstools
@dasjoe
dasjoe / xenial-on-zfs.sh
Last active April 24, 2016 16:41
A small HOWTO about installing Ubuntu 16.04 LTS on ZFS
# Boot Ubuntu 16.04 LTS from a ZFS rpool
#
#
# We boot the remote server to its (Debian or Ubuntu based) rescue mode
# then ssh into it with forwarded ports for the VM's SSH and VNC servers
#
# Shell here documents that are not passed to a command are used for
# documentation and copy and paste sources.
# "<<'LOCAL'" denotes commands to be run on the local machine, 'RESCUE'
# and 'VM' should be run in the rescue system or the VM, respectively.
# apt-add-repository ppa:zfs-native/stable
# apt-get update
# apt-get install ubuntu-zfs
# apt-get install debootstrap
HOST=vm1
DISKS="/dev/disk/by-id/ata-Samsung_SSD_850_EVO_120GB_S21UNSAG310692M"
zpool create \
-f \
@dasjoe
dasjoe / zfs
Created September 18, 2015 21:34
Ubuntu 15.04's /usr/share/initramfs-tools/scripts/zfs (via ppa:zfs-native/stable)
# ZFS boot stub for initramfs-tools.
#
# In the initramfs environment, the /init script sources this stub to
# override the default functions in the /scripts/local script.
#
# Enable this by passing boot=zfs on the kernel command line.
#
pre_mountroot()
@dasjoe
dasjoe / microbench.fio
Last active October 2, 2015 04:59
Useful fio microbenchmarks
; global parameters
[global]
fallocate=none
directory=/tank/bench
bs=4k-128k
size=16g
end_fsync=1
loops=1
rwmixread=70
;buffer_compress_percentage=0
@dasjoe
dasjoe / check_smart.sh
Last active November 20, 2018 09:53
Check SMART values for ata-* disks
#!/bin/bash
DIR='/dev/disk/by-id/'
#DIR='/dev/disk/by-vdev/'
#DIR='/dev/disk/by-path/'
PREFIX='ata-*'
#PREFIX='pci-*'
#PREFIX='*'
@dasjoe
dasjoe / memtest.sh
Created October 31, 2014 15:13
Efficient, multithreaded RAM stress tester, using md5sum
#!/bin/bash
# source: https://groups.google.com/a/zfsonlinux.org/d/msg/zfs-discuss/i09_VBXAyig/UWjPa23cQ0YJ
pids=""
tdir=/tmp/memtest.$$
function cleanup()
{
[[ -n "${pids}" ]] && kill -9 ${pids} &> /dev/null || true