diff --git a/hosts/nas/STORAGE.md b/hosts/nas/STORAGE.md new file mode 100644 index 0000000..3268032 --- /dev/null +++ b/hosts/nas/STORAGE.md @@ -0,0 +1,60 @@ +# NAS Storage Notes + +## Current Issue: XFS Metadata Overhead + +The XFS filesystem on `/var/lib/multimedia` uses ~100GB more than the actual file data due to metadata overhead. + +### Root Cause + +The filesystem was created with advanced features enabled: + +``` +rmapbt=1 # Reverse mapping btree - tracks block ownership +reflink=1 # Copy-on-write support +``` + +These features add metadata that scales with **filesystem size**, not file count. On a 5TB filesystem with 700GB of data, this results in ~100GB (~2%) overhead. + +### Diagnostic Commands + +```bash +# Compare file data vs filesystem usage +du -sh /var/lib/multimedia # Actual file data +df -h /var/lib/multimedia # Filesystem reports + +# Check XFS features +xfs_info /var/lib/multimedia + +# Verify block allocation +xfs_db -r -c "freesp -s" /dev/mapper/vg--data-lv--multimedia +``` + +## Recommendation: LVM + ext4 + +For media storage (write-once, read-many), ext4 with minimal reserved space offers the lowest overhead: + +```bash +# Create filesystem with 0% reserved blocks +mkfs.ext4 -m 0 /dev/vg/lv + +# Or adjust existing ext4 +tune2fs -m 0 /dev/vg/lv +``` + +### Why ext4 over XFS for this use case + +| Consideration | ext4 | XFS (current) | +|---------------|------|---------------| +| Reserved space | 0% with `-m 0` | N/A | +| Metadata overhead | ~0.5% | ~2% (with rmapbt) | +| Shrink support | Yes | No | +| Performance for 4K stream | Identical | Identical | + +A single 4K remux stream requires ~12 MB/s. Any filesystem handles this trivially. + +## Migration Path + +1. Backup data from XFS volumes +2. Recreate LVs with ext4 (`mkfs.ext4 -m 0`) +3. Restore data +4. Update `/etc/fstab` or NixOS `fileSystems` config diff --git a/hosts/nas/channel b/hosts/nas/channel new file mode 100644 index 0000000..57f31e7 --- /dev/null +++ b/hosts/nas/channel @@ -0,0 +1 @@ +https://channels.nixos.org/nixos-25.11 diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index 5e594c2..7ee98c9 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -9,6 +9,7 @@ in { "${impermanence}/nixos.nix" ./utils/bento.nix ./utils/modules/sops.nix + ./utils/modules/set-nix-channel.nix ./utils/modules/victoriametrics ./utils/modules/promtail @@ -76,6 +77,12 @@ in { ]; }; + # System packages + environment.systemPackages = with pkgs; [ + vim + screen + ]; + # Nix settings nix = { settings = {