Skip to content

Instantly share code, notes, and snippets.

@ProjectInitiative
ProjectInitiative / hookscript-pci.py
Last active May 23, 2022 02:09
A proxmox hookscript for prepping and validation of bound vfio-pci drivers for PCI devices before starting and stopping a VM with physical hardware passthrough.
#!/usr/bin/env python3
#Copyright 2022 Kyle Petryszak
# Exmple hook script for PVE guests (hookscript config option)
# You can set this via pct/qm with
# pct set <vmid> -hookscript <volume-id>
# qm set <vmid> -hookscript <volume-id>
# where <volume-id> has to be an executable file in the snippets folder
# of any storage with directories e.g.:
# qm set 100 -hookscript local:snippets/hookscript-pci.py
@ProjectInitiative
ProjectInitiative / init.vim
Created July 21, 2022 19:41
my personal nvim configuration as it matures and grows
syntax enable
filetype plugin indent on
call plug#begin(stdpath("data") . '/plugged')
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
Bcachefs Read FUA Test Results - 2025-03-26 18:28:31.403309
==================================================
Filesystem UUID: 27cac550-3836-765c-d107-51d27ab4a6e1
--------------------------------------------------
Device 0:
Device: nvme0n1
Model: TEAM TM8FPD002T
Serial: TPBF2310170080202273
@ProjectInitiative
ProjectInitiative / dmesg.md
Last active May 14, 2025 18:16
Mounted fsck for home directory

Kernel: Linux thinkpad 6.14.5 #1-NixOS SMP PREEMPT_DYNAMIC Fri May 2 06:02:16 UTC 2025 x86_64 GNU/Linux bcachefs version v1.25.2 (but when it runs, it finds extents with 1.20, even though I formatted with 1.25.2 tool chain)

Got asked multiple times for (y,n, or Y,N for all errors of this type) Y => captial Y didn't seem to be working? I got asked for each occurance after. I have two volumes, a home directory and an extra data volume. Both use snapshots. dm-3 is home directory and dm-4 is the extra volume.

When booting (boot failed even with "fsck" as a mount option)

An interesting issue came up. I noticed a few days ago that there was some data that had 1/1 even though the options are set to min 1 but desired 2. I tried bcachefs data rereplicate but that did not seem to change anything. Upon trying to boot the system and mount the FS, it seems to be failing because that replica isn't present? Not sure why since all disks are present.

I guess there are 2 potential things going on: 1 rereplicate is not replicating all data to match desired options, and fsck fails if there are missing replicas (I think this is expected).

~ sudo bcachefs fsck -k /dev/nvme0n1
Running in-kernel offline fsck
bcachefs (27cac550-3836-765c-d107-51d27ab4a6e1): starting version 1.28: inode_has_case_insensitive opts=metadata_replicas=2,data_replicas=2,background_compression=zstd:15,foreground_target=cache.nvme1,background_target=hdd,promote_target=cache,degraded=yes,fsck,fix_errors=ask,noratelimit_errors,read_only
@ProjectInitiative
ProjectInitiative / setup.md
Last active August 16, 2025 13:01
Bcachefs 6.17 RC Current Setup

Bcachefs Usage Report – 3-Node Kubernetes Cluster on NixOS

Setup Overview

I run a 3-node Kubernetes cluster on NixOS, with bcachefs as the primary storage pool.
Bcachefs handles auto re-replication, scrubbing, and integrated stats/notifications get sent to telegram (and eventually grafana).


Underlying Storage Layout