ZFS zpool Expansion…

WARNING: The example scripts and commands used here are destructive and will destroy your drive/s unless you know what you are doing. For proper interpretation, I am running:

  • six SATA HDDs, which appear in my bare-metal Ubuntu LTS environment as /dev/sd[a-f] (meaning sda, sdb, ..., sdf)
  • there was only one partition on each of these HDDs i.e. /dev/sd[a-f]1, and each was (and still is) the RAIDZ2 raidz=type vdev (i.e. part of the RAIDZ2 pool)
  • there was (and still is) one SLOG using partition #5 on my NVMe drive

Having moved my entire RAIDZ2 cluster to a bigger drives quite a while ago, I never had the need to expand the entire volume size (yet). But since I was to embark on creating a new RAIDZ3 for some other reason, I decided to first expand the part1s across all six disks (where by RAIDZ2 was sitting astride):

Gather all “before” data:

  • zpool get autoexpand <POOL NAME>
  • zpool list <POOL NAME>
  • sfdisk -l /dev/sd[a-f]

Export the zpool:

  • zfs export <POOL NAME>

Backup the GPT tables:

mkdir -p /root/gpt-backup

for d in /dev/sd[a-f]; do
    sgdisk --backup="/root/gpt-backup/$(basename "$d").gpt" "$d";
done

Then resize part1 across all 6 disks, based on your expanded ending sector (use ‘0‘ if you want to extend to maximum allowable, leaving correct end-disk spacing for backup GPT and the like):

for d in /dev/sd[a-f]; do
    sgdisk --delete=1 "$d";
    sgdisk --new=1:2048:20835092399 "$d";
    sgdisk --typecode=1:BF01 "$d";
    sgdisk --change-name=1:<POOL NAME> "$d";
done

Don’t worry: sgdisk re-creating the partition 1 information with the same starting sector and later ending sector simply means your data is still there, but the partition is expanded.

You can now check the “new” boundaries:

  • sfdisk -l /dev/sd[a-f]

And you can also check that the ZFS labels still exist:

for d in /dev/sd[a-f]1; do
    echo "===== $d ====="
    zdb -l "$d" | grep -E 'name:|pool_guid:|top_guid:|guid:|txg:'
done

You can then proceed to re-import the pool, either with a blanket command below, or using specific IDs:

  • zpool import -d /dev/disk/by-id <POOL NAME>

Then check:

  • zpool status -P <POOL NAME>

Ensure the pool is set to auto-expand:

  • zpool set autoexpand=on <POOL NAME>

And then explicitly  set each member vdev to expand:

# P.S. READ TO THE END BEFORE YOU TRY THIS
for d in /dev/sd[a-f]1; do
    zpool online -e <POOL NAME> "$d"
done

And this where all the trouble started…

No matter how many times I did that last two commands, or even exported and reimported, ZFS refused to expand the individual vdevs, despite the “extra space” being acknowledged (by the EXDPANDSZ parameter showing as such)…

# zpool sync
# zpool list <POOL>
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
<POOL>   32.5T  30.7T  1.85T        -     25.2T    18%    94%  1.00x    ONLINE  -
# zpool list -v <POOL>
NAME                                                  SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
<POOL>                                               32.5T  30.7T  1.85T        -     25.2T    18%    94%  1.00x    ONLINE  -
  raidz2-0                                           32.5T  30.7T  1.85T        -     25.2T    18%  94.3%      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
    ata-<redacted>-part1                             9.70T      -      -        -         -      -      -      -    ONLINE
logs                                                     -      -      -        -         -      -      -      -         -
  nvme-<redacted>-part5                                 4G   536K  3.97G        -         -     0%  0.01%      -    ONLINE

Continue reading →

ZFS Importing /dev/disk/by-id…

I had the dubious pleasure of having to (re-)import a ZFS pool by disk ID… i.e. zpool import -d /dev/disk/by-id <POOL NAME>, unfortunately, on my system, everything appeared as WWNs, like “wwn-0x5111c500c8708981-part1” – instead of my expected “ata-<MODEL>-<BUILD>_<HDD SERIAL>-part1” where I could easily determine which disk a specific zpool/zvol was on.

So the fix, given I know I had all my SATA drives’ “part1” as part of my zpool, and that my log was on my NVMe drive, the following commands imported the individual vdevs according to my desired tags/handles:

d_devices=()
for dev in /dev/disk/by-id/ata-*-part1; do
    d_devices+=(-d "$dev")
done
# Include the NVMe SLOG explicitly
d_devices+=(-d /dev/disk/by-id/nvme-<MODEL>_<BUILD>_<SERIAL>-part5)

Doing a last check:

  • printf '%s\n' "${d_devices[@]}"

Then check the import:

  • zpool import "${d_devices[@]}"

And finally, assuming all is good, import!

  • zpool import "${d_devices[@]}" <POOL NAME>

Lastly, verify the vdev paths:

  • zpool status -P <POOL NAME>

ZFS Partition IDs…

WARNING: The example scripts and commands used here are destructive and will destroy your drive/s unless you know what you are doing. For proper interpretation, I am running:

  • six SATA HDDs, which appear in my bare-metal Ubuntu LTS environment as /dev/sd[a-f] (meaning sda, sdb, ..., sdf)
  • there was only one partition on each of these HDDs i.e. /dev/sd[a-f]1, and each was (and still is) the RAIDZ2 raidz=type vdev (i.e. part of the RAIDZ2 pool)
  • there was (and still is) one SLOG using partition #5 on my NVMe drive

While doing some maintenance, I ran: sudo sfdisk -l /dev/sd[a-z] in attempt to list all partitions on my 6x 16TB of spinning rust i.e. /dev/sd*, which produced:

Disk /dev/sda: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sda1   2048 11721043967 11721041920  5.5T Linux filesystem


Disk /dev/sdb: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sdb1   2048 11721043967 11721041920  5.5T Linux filesystem


Disk /dev/sdc: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sdc1   2048 11721043967 11721041920  5.5T Linux filesystem


Disk /dev/sdd: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sdd1   2048 11721043967 11721041920  5.5T Linux filesystem


Disk /dev/sde: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sde1   2048 11721043967 11721041920  5.5T Linux filesystem


Disk /dev/sdf: 14.55 TiB, 16000900661248 bytes, 31251759104 sectors
Disk model: <redacted>
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: <redacted>

Device     Start         End     Sectors  Size Type
/dev/sdf1   2048 11721043967 11721041920  5.5T Solaris /usr & Apple ZFS

 

That was odd, considering all these partitions are ZFS type (i.e. blue highlights are correct, red highlights are incorrect).

Continue reading →

QEMU libvirt VM Migration/Backup…

Attempting to backup a VM was a mess – the Windows 11 activation was broken upon copying, so I got AI to help me code a migration script…

After a huge amount of my own time (largely because I am a cheap-ass and was attempting to do things locally on a Qwen 3.8 27B on an AMD 395+ Strix Halo w/128gB RAM), a huge amount of repetitions across free Google AI Mode (sucks) and free ChatGPT (good enough), I finally got a working script…

It took about a month, an hour or so on and off whenever I had “spare” time, with some 32 iterations before I had a script that didn’t have script errors and I was sure the logic and technicals were sound (yes, I ran through the code manually). Then another 4 iterations to address run-time issues and figure out what broke Windows 11 activation…

Have fun!

Email OAuth2 Proxy

Microsoft Screws Their Users… Again…

 

Desktop Outlook Banned From Outlook.com and Hotmail.com POP3

Microsoft had stopped allowing users of their premium Outlook desktop product (versus the useless, neutered “Outlook” wannabe bloatware “Outlook for Windows” included force installed in Windows 11) to access their “free” @hotmail.com and @outlook.com emails via POP3 and SMTP (secured or not), forcing everyone to effectively use IMAP mode (links here and here, backup here).

Leaving discussions over any reasons (e.g. financial greed trying to force clueless desktop Outlook + “free” MS email-using people to pay for more storage) and the sheer stupidity of forcing this down full-fat, existing Outlook customers’ collective throats (against, say, everyone else like those using Thunderbird or other third-party email clients) aside, I had simply left this aside, relying on my trusty K-9 Mail on Android to access any emails on these “throw-away” accounts…

Unfortunately, there were a few emails (mainly shopping-related receipts) that I wanted to keep – so once again, I had to roll-up my sleeves and fix shit Microsoft breaks get things working…

Google search basically found me Email OAUTH2 Proxy nearly immediately… Attempts at simply using the Docker image did not go so smoothly, so I ended up using pipx and did a “bare metal” install..

Continue reading →

Nested Partitions grub-update Mess…

Having imaged an old MBR-based partitioned disk to a VHD and back to bare metal on a now UEFI, GPT-based NVME SSD, update-grup was complaining every time:

# update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos1).
grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos2).
grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos3).
grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos4).

<above 4 lines repeats 11 times>

/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos1).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos2).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos3).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos4).

<above 4 lines repeats 29 times>

Found linux image: /boot/vmlinuz-6.17.0-22-generic
Found initrd image: /boot/initrd.img-6.17.0-22-generic
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos1).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos2).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos3).
/usr/sbin/grub-probe: warning: Discarding improperly nested partition (hostdisk//dev/nvme0n1,gpt2,msdos4).

<above 4 lines repeats 23 times>

And so on… and so forth…

The great, wise ChatGPT was convinced that this was the work of the devil and that the “Microsoft Reserved Partition” partition was without a “soul” (file system) and would need to be “cast out” (excluded) by grub-prober… And then went on to instruct me to “add the file system UUID” to my /etc/default/grub via the GRUB_OS_PROBER_SKIP_LIST="<UUID>@/dev/nvme0n1p2" line… Never mind it just told me there is no file system for the MSR partition (and therefore no file system UUID)…

Continue reading →

Upgrading WSL2 Ubuntu LTS 22.04 to LTS 24.04…

After fixing WSL networking issues, I had to upgrade the Ubuntu LTS instance… The sequence should have been:

  • apt update
  • apt upgrade -y
  • apt dist-update
  • lsb_release -a   # to confirm version before upgrade
  • do-release-upgrade
  • lsb_release -a   # to confirm version after upgrade

But, as per usual, I hit another issue attempting to upgrade (i.e. while running do-release-upgrade):

error: cannot list snaps: cannot communicate with server: Get "http://localhost/v2/snaps": dial unix /run/snapd.socket: connect: no such file or directory

A quick ‘net search brought up the point that snapd was not running…

Continue reading →

Windows 11 Host Network Service (HNS) and Windows Subsystem for Linux (WSL)…

For the longest time, my Ubuntu LTS 22.04 on my (forced-to-be-updated-to) Windows 11 (replete with other networking horrors) was not working properly – I could only access the Internet from within the WSL2 container when Windows Firewall was disabled.

Despite shenanigans like attempting to whitelist a whole plethora of executables:

  • C:\Windows\System32\vmcompute.exe
  • C:\Windows\System32\vmms.exe
  • C:\Windows\System32\vmwp.exe
  • C:\Windows\System32\wsl.exe
  • C:\Program Files\WSL\wsl.exe
  • C:\Program Files\WSL\wslservice.exe

Even attempting to whitelist the usual services suspects via C:\Windows\System32\svchost.exe like the following:

  • Host Network Service
  • Internet Connection Sharing (ICS)

All were to no avail. I could resolve domain names, but no traffic went out unless the host’s Windows Firewall was disabled.

I could not even see any blocked traffic from the logs, despite having the correct set up (tip: just use WFC‘s logging interface).

Searching ChatGPT and Perplexity sent me on various wild-goose chases, from changing WSL networking modes (NAT vs. “mirrored” in %USERPROFILE%/.wslconfig), to setting up dubious firewall rules referencing InterfaceAlias using New-NetFirewallRule (but which actual interface UUIDs change every boot). Continue reading →

Making the Intel X710-DA4 Work…

Apparently, making this 4x SFP+ card work is not as straight forwards as I thought…

  • LACP (aka Link Aggregation aka 802.3ad) would not work properly under Linux, Windows, VMware or FreeBSD unless a “private flag” was disabled using ethtool (source #1, #2)

Sigh, so much for “plug and play pray”…

As per the source/s instructions, I created a /etc/networkd-dispatcher/configuring.d/90-disable-on-chip-LLDP.sh:

#!/bin/sh
if expr "$IFACE" : <interface prefix> >/dev/null; then /sbin/ethtool --set-priv-flags "$IFACE" disable-fw-lldp on fi

WARNING: Make sure your <interface prefix> is able to only address the X710 interfaces, or you will likely get errors or, worse, brick your NIC. As an example, my X710 interfaces are all named enp1s0fN so I use the <interface prefix> of “enp1s0f”

To check, simply give the command ethtool --show-priv-flags <interface prefix>.

 

2026/04/21 Update:

After recently rebuilding and using passthrough of the X710-DA4 ports to pfSense in an attempt to boot performance, the instructions have to change since FreeBSD (and pfSense in turn) do not have ethtool. Instead, set the System Tunable “dev.ixl.n.fw_lldp” to “0“, where n is the 0-based port number (0 to 3 in my case of a four-port card).

netplan Not Going To Plan…

With a /etc/netplan/00-global.yaml having the following contents:

network:
  version: 2
  renderer: networkd

And all other .yaml files in the /etc/netplan directory not having an explicit renderer, the system should default to networkd… Just netplan apply and done! Simple, right?

Yeah, right.

Seems like netplan apply still thinks to use NetworkManager even when no single .yaml file declares its use; and since I disabled and masked the service, netplan apply was complaining NetworkManager was masked.

The secret sauce?

Continue reading →