Skip to content

Instantly share code, notes, and snippets.

@senorsmile
senorsmile / zfs_introspect_file.md
Created January 8, 2021 18:52 — forked from mbarczak/zfs_introspect_file.md
ZFS: Introspect a File (Acquiring Creation Time... etc)

Introspecting a file on ZFS

Derived from: http://www.c0t0d0s0.org/archives/7485-Find-out-in-depth-information-about-a-file-in-ZFS.html

Sometimes you need to acquire in-depth information about a file that isn't exposed by other commands like stat.

ZFS allows you to do this with zdb. However there's a confusing problem. If you're just trying to access a file on your root pool that doesn't have any nested datasets, you need use rpool/ instead of just rpool (assuming "rpool" is the name of your root pool).

Here's 3 examples of acquiring information on /filepath.

@senorsmile
senorsmile / filters.py
Last active September 17, 2015 20:04 — forked from viesti/filters.py
Ansible filter plugin to create rules fo ec2_group
def make_rules(hosts, ports, proto):
return [{"proto": proto,
"from_port": port,
"to_port": port,
"cidr_ip": host} for host in hosts for port in map(int, ports.split(","))]
class FilterModule(object):
def filters(self):
return {'make_rules': make_rules}