Skip to content

Instantly share code, notes, and snippets.

View rlaager's full-sized avatar

Richard Laager rlaager

View GitHub Profile
@rlaager
rlaager / zfs-initramfs-slow-drives.patch
Created January 16, 2012 04:39
zfs-initramfs-slow-drives
--- zfs-linux-0.6.0.44/debian/tree/usr/share/initramfs-tools/scripts/zfs 2011-01-12 19:30:38.000000000 -0600
+++ zfs-linux-0.6.0.44/debian/tree/usr/share/initramfs-tools/scripts/zfs 2012-01-15 18:34:53.985778000 -0600
@@ -64,15 +64,22 @@
# environment and doing a full import in the regular system instead.
[ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool $ZFS_RPOOL"
- if [ -f /etc/zfs/zpool.cache ]
- then
- ZFS_STDERR=$(zpool list "$ZFS_RPOOL" 1>/dev/null 2>&1 \
- || zpool import -f -N "$ZFS_RPOOL" 2>&1)
commit 837f51c82ca25a3a570114c2f308398e04caee11
Author: Richard Laager <[email protected]>
Date: Sat Feb 25 20:22:44 2012 -0600
raw-posix: Discard using fallocate() or BLKDISCARD
The fallocate(fd, FALLOC_FL_PUNCH_HOLE) call is used for regular files,
while ioctl(fd, BLKDISCARD) is used for devices. Thus, discard is no
longer XFS-only.
@rlaager
rlaager / test.c
Created February 23, 2012 17:13
Hole Punch Test
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/falloc.h>
int main()
@rlaager
rlaager / zvol-size-16k.log
Created March 8, 2012 23:14
zvol size utilization
ashift=9 vdev=raidz1 disks=3
tank/foo 102M 1.84G 101M -
ashift=9 vdev=raidz1 disks=4
tank/foo 103M 2.80G 103M -
ashift=9 vdev=raidz1 disks=5
tank/foo 102M 3.76G 101M -
ashift=9 vdev=raidz1 disks=6
ZFS on Linux Improvements
1. `zpool status` can output disk names which are under /dev/disk.
2. `zpool status` outputs the whole disk device for wholedisk pools,
but GRUB needs the partition device.
Before this can be accepted upstream, I am to merge it into the
existing /dev scanning code.
Index: grub/util/getroot.c
diff -r 10ae2f408c94 dice/dice.c
--- a/dice/dice.c Wed Jan 18 22:20:42 2012 -0600
+++ b/dice/dice.c Sun Jun 10 16:17:12 2012 -0500
@@ -30,6 +30,10 @@
#include <debug.h>
#include <plugin.h>
+#define PLUGIN_ID "core-plugin_pack-dice"
+#define PREFS_PREFIX "/plugins/core/" PLUGIN_ID
+#define PREFS_REMOTE_CMD PREFS_PREFIX "/remote_cmd"
@rlaager
rlaager / gist:4111654
Created November 19, 2012 16:31
ZFS Resilvering Errors
For the c2t5000C5002623694Bd0 disk, we received a SMART predictive failure
(fault.io.disk.predictive-failure) warning as well as
fault.io.scsi.cmd.disk.dev.rqs.derr from fmadm.
We then set out to replace the disk.
Here is the zpool status before the replacement:
# zpool status data
pool: data
$ xdpyinfo
name of display: :0.0
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 11103000
X.Org version: 1.11.3
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
hdparm -I /dev/sda
# Note that it is "not locked" and security is "not enabled".
# Set a password:
hdparm --user-master u --security-set-pass password /dev/sda
# From this point, until after the security erase, if something goes wrong,
# you must remove the password before rebooting.
hdparm -I /dev/sda'
@rlaager
rlaager / gist:4361027
Created December 22, 2012 20:54
Add c7t1d0 to an existing root pool named "rpool" created using the OpenIndiana installer on c7t0d0.
# Add a default partition map on the new drive.
fdisk -B c7t1d0p0
# Copy the disk label from the first disk to the second:
prtvtoc /dev/rdsk/c7t0d0s0 | fmthard -s - /dev/rdsk/c7t1d0s0
# Attach the second disk to the root pool:
zpool attach rpool c7t0d0s0 c7t1d0s0
# You will get an error about overlapping. If you get another error, stop. Otherwise:
zpool attach -f rpool c7t0d0s0 c7t1d0s0