[{"content":"NFS is a distributed file system protocol that allows clients to access files over a network as if they were local. It is commonly used for sharing files between servers and clients in a networked environment.\nIn this article, we will install and configure an NFS server in a VM running Debian GNU/Linux on a Proxmox VE cluster, optionally using our ZFS pool on HDD disks. The NFS server will be used to share files between multiple clients, such as web or application servers.\nThis is an alternative approach to using an S3 compatible object storage, such as MinIO, Garage or SeaweedFS. Both approaches have their own advantages and disadvantages, and the choice between them depends on the specific use case, requirements and limitations.\nISO download # Visit the Downloading Debian page and its linked SHA512SUMS page. You are for looking for latest Debian 12 Bookworm Netinst ISO and its SHA-512 checksum.\nClick on the node where you want to install the VM, go to the local storage, go to the ISO Images menu option and click the Download from URL button:\nPaste the URL of the latest Debian 12 Bookworm Netinst ISO into the URL field and click on Query URL. File size and MIME type will be filled in. Select the hash algorithm SHA-512 and paste the checksum for the image. The image will be downloaded and verified. Once the download is complete, you will notice the ISO image in the local storage on the node.\nAlternatively, if you want to use the terminal, these are the commands you have to execute at the node where you will be installing the VM:\nwget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.11.0-amd64-netinst.iso \\ --output-document=/var/lib/vz/template/iso/debian-12.11.0-amd64-netinst.iso For security, calculate its SHA 512 checksum and compare it with the one from the SHA512SUMS file:\nsha512sum /var/lib/vz/template/iso/debian-12.11.0-amd64-netinst.iso wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/SHA512SUMS -O- | grep debian-12.11.0-amd64-netinst.iso VM creation # We will be using three separate virtual disks for the VM:\nOS disk: A small disk on our local pool that will hold the operating system. Swap disk: A small disk on our local pool that will hold the swap space. Data disk: A larger disk on our ZFS pool that will hold the data to be shared via NFS. This is to simplify the setup and prevent us from running into issues with disk space management on multiple partitions. The OS disk will be formatted using EXT4 and the data disk will be formatted using XFS, which will allow us to extend them later, if needed.\nTherefore, we will be using manual partitioning during the OS installation to create a DOS partition table and a primary partition on the OS and swap disks.\nUsing the GUI # Select the node where you want to install the VM on, then click on the Create VM button on the top-right corner of the Proxmox VE WebGUI and follow the assistant.\nTab Attribute Value Note General Name nfs1 Usually, but not necessarily, its hostname General Resource pool databases Logical group of guests of your choice 1 General Start at boot No Will be switched to Yes once we are done OS Storage local OS ISO image debian-12.11.0-amd64-netinst System Processor type host To benefit from AES-NI, AVX, SSE4.2, etc. System Graphic card Default System Machine Default (i440fx) System BIOS Default (SeaBIOS) System SCSI controller VirtIO SCSI single Match with IO thread for performance 2 System Qemu agent Yes CPU Cores 4 Moderate concurrency Memory Memory (MiB) 8192 Moderate usage, matches ZFS ARC config Memory Min. memory (MiB) 4096 Moderate usage, matches ZFS ARC config Memory Ballooning device Yes Dynamically adjust the VM’s memorory usage Network Bridge vmbr4002 Proxmox guests private network Network Model VirtIO (paravirtualized) Best performance and low overhead for Linux Network MTU 1400 Matches the Proxmox host network MTU Using processor type host exposes modern CPU features such as AVX, AVX2, SSE4.2, BMI1/BMI2, and FMA. We trade better performance and compatibility with modern software for less portability, i.e., VM live migration between nodes may fail when using very different CPU architectures.\nOn the Disks tab, we will be creating three disks, as described above. Use the Add button on the bottom-left corner to add disks.\nOption OS disk Swap disk Data disk Notes Bus/Device SCSI 0 SCSI 1 SCSI 2 VirtIO SCSI driver works well with discard Storage local local zfspool Disk size (GiB) 3 1 100 Format qcow2 raw raw Snapshots enabled Cache No cache No cache No cache Avoid double caching with ZFS IO thread Yes No Yes Parallel NFS access Backup Yes No Yes Include disk in backup jobs Async IO io_uring io_uring io_uring Most compatible and reliable Discard Yes Yes Yes Enable TRIM/UNMAP Regarding the data disk, by choosing zfspool as storage, the assistant creates a ZFS volume (ZVOL) instead of a virtual disk.\nIncidentally, in the node where this VM is being provisioned we have allocated 4-8 GB for ZFS ARC via /etc/modprobe.d/zfs.conf:\noptions zfs zfs_arc_max=8589934592 options zfs zfs_arc_min=4294967296 This will allow the VM to use up to 8 GB of memory for caching, which is a good amount for a moderate usage NFS server. The Min. memory setting will ensure that the VM has at least 4 GB of memory available, which is enough for the OS and the NFS server.\nThe VM id will be automatically assigned by Proxmox, but you can change it to a specific number if you want. In this article, we will use 104 as the VM id.\nDo not forget to add the corresponding DNS records to your internal zone localdomain.com and to your reverse zone 168.192.in-addr.arpa.\nUsing the CLI # Alternatively, if you prefer using the terminal, follow these three steps to achieve the same results.\nJust in case it has not been done before, create the resource pool of your liking:\npvesh create /pools --poolid databases --comment \u0026#34;Database and file storage servers\u0026#34; If the pool already exists, the command will fail but do no harm.\nLet’s start by creating the VM:\nqm create 104 --name nfs1 --cores 4 --cpu host \\ --balloon 4096 --memory 8192 \\ --net0 virtio,bridge=vmbr4002,firewall=1,mtu=1400 \\ --scsihw virtio-scsi-single \\ --ostype l26 --bios seabios \\ --agent enabled=1,fstrim_cloned_disks=1,type=virtio \\ --ide2 local:iso/debian-12.11.0-amd64-netinst.iso,media=cdrom \\ --pool databases --description \u0026#34;NFS server\u0026#34; --onboot 0 Then, create and attach the OS, swap and data disks:\nqm set 104 --scsi0 local:3,format=qcow2,iothread=1,discard=on,serial=os qm set 104 --scsi1 local:1,format=raw,discard=on,backup=0,serial=swap qm set 104 --scsi2 zfspool:100,format=raw,iothread=1,discard=on,serial=data We are using the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume.\nProxmox names disks using the template vm-\u0026lt;vmid\u0026gt;-disk-\u0026lt;diskid\u0026gt;, where \u0026lt;diskid\u0026gt; is a zero-based index, per VM and storage. Therefore, disks will be named local:104/vm-104-disk-0.qcow2, local:104/vm-104-disk-1.raw and zfspool:vm-104-disk-0, respectively. We are using the serial option to make it easier to identify the disks later.\nFinally, configure the boot order:\nqm set 104 --boot order=scsi0 Optionally, check the block size volblocksize of our ZVOL:\nzfs get volblocksize zfspool/vm-104-disk-0 Optionally, verify the configuration:\nqm config 104 ZFS volumes # ZFS volumes (ZVOLs) are an alternative to traditional virtual disks for VM data storage in Proxmox. While the Proxmox VM creation wizard typically provisions disk images in formats like qcow2 (QEMU Copy On Write) or raw, these are still files sitting atop a filesystem. By contrast, ZVOLs offer native block-level storage managed directly by ZFS, eliminating the file layer entirely. This provides performance benefits, block-level snapshots, and more seamless resizing that are particularly relevant when exporting data over NFS.\nTo clarify, ZVOLs do not provide “raw image format”, like /var/lib/vz/images/104/vm-104-disk-1.raw, but rather the disk is a ZFS-managed block device, such as /dev/zvol/zfspool/vm-104-disk-0 (actually, /dev/zd0), i.e., no file, no virtual layer. Therefore, with a ZVOL, you avoid writing to a file sitting inside a ZFS dataset3 and QEMU going through file I/O layers and, instead, you get a native block device backed directly by ZFS. This means better synchronisation and performance, especially for workloads that require frequent writes.\nIt is important to emphasise that we are not using ZFS as a filesystem inside the VM. Instead, we are using ZFS to back a block device and, inside the VM, we will format it using EXT4 or XFS.\nIn our scenario, we chose to use a ZVOL for the data disk when we chose zfspool as storage during the VM creation process, which will allow us to take advantage of features such as snapshots and compression. It will behave exactly like a physical disk: no filesystem or partition table until we create one. Inside the VM, the ZVOL will appear as a new physical disk (e.g., /dev/sdc), and it will be completely blank until we format it.\nOS install # Once the VM has been created, click on its Console menu option and click the Start button. Once booted, the graphical installer will appear. Select the second option, Install, to change into the text mode.\nProceed with the configuration of the language and keyboard layout. Example options:\nLanguage: English Location: Europe, Spain Locale: United States (en_US.UTC-8) Keymap: Spanish Next, network configuration via DHCP auto configuration will be attempted. If you do not use HDCP, it will time out and display an error message. Select Continue and, in the next screen, select Configure network manually. Example options:\nIP address: 192.168.0.4/24 Gateway: Name server addresses: 192.168.0.239 192.168.0.241 Hostname: nfs1 Domain name: localdomain.com Root password: Full name for the new user: Systems Administrator Username for your account: devops Password for the new user: Time zone: Madrid The guests in the cluster use an HTTP proxy to access the Debian package repositories, therefore the gateway is left blank.\nPartitioning is next. Choose the “Manual” option and set up the OS and swap disks. Ignore the data disk for now.\nFirst disk (OS):\nSelect the SCSI (0,0,0) disk (e.g., sda). Accept creating a new empty partition table on the device. Select the pri/log free space UI placeholder showing the available unallocated space. Select Create a new partition. Use all available space (default option) and select Primary as the partition type. Set the following options: Use as: Ext4 journaling file system. Mount point: / Mount options: discard, noatime, nodiratime Label: os Reserved blocks: 1% Typical usage: standard Bootable flag: on Select Done setting up the partition. Second disk (swap):\nSelect the SCSI (0,0,1) disk (e.g., sdb). Accept creating a new empty partition table on the device. Select the pri/log free space UI placeholder showing the available unallocated space. Select Create a new partition. Use all available space (default option) and select Primary as the partition type. Set the following options: Use as: swap area. Bootable flag: off Select Done setting up the partition. Third disk (data):\nIgnore the third SCSI (0,0,2) disk (e.g., sdc) during the installation. Select the Finish partitioning and write changes to disk option and accept writing the changes to disk. The installer will install the base system.\nThe correspondence between SCSI disks and the /dev/sdX device names used above is not guaranteed. The installer will display the disk size, which can help you identify them.\nThe next step in the installer is to configure the package manager. When prompted Scan extra installation media?, select No. Then set the following options:\nDebian archive mirror country: Germany Debian archive mirror: deb.debian.org HTTP proxy information: http://apt.localdomain.com:8080/ Proxy detection will be followed up by packages index update. Then, the installer will upgrade the base system with new packages, if any. Once complete, decide whether you want to participate in the package usage survey, then choose SSH server and Standard system utilities (default values) in the software selection screen, and continue.\nThe final step is to install the GRUB boot loader. Choose to install the GRUB boot loader to the primary drive /dev/sda (scsi-0QEMU_QEMU_HARDDISK_drive-scsi0). Once its installation is complete, choose Continue to reboot.\nUse the WebGUI to stop the VM once it has rebooted, then visit the Options \u0026gt; Boot order menu option of the VM and make sure that the scsi0 disk is the first in the list and, optionally, the only one enabled. Then visit the Hardware \u0026gt; CD/DVD Drive (ide2) entry and select the Do not use any media option.\nYou can now start the VM.\nOS configuration # Some basic configuration of the OS.\nAdd your cluster public key to the ~/.ssh/authorized_keys file of the root user and check that you can connect from your Ansible Controller, through your bastion host, or equivalent.\nReduce swappiness to a minimum to save writes on the NVMe disk by setting vm.swappiness in the VM (swappiness is a kernel-level parameter controlled by the guest OS):\necho \u0026#34;vm.swappiness=1\u0026#34; | tee /etc/sysctl.d/99-swap.conf sysctl --load=/etc/sysctl.d/99-swap.conf Check that support for trimming is working:\nfstrim --verbose / Neither the VMs nor the LXCs in our cluster have a gateway, so they use an APT proxy to update packages. The information we provided during OS installation was saved in the /etc/apt/apt.conf file by the installer. Either edit such file or create the file /etc/apt/apt.conf.d/00aptproxy and add support for HTTPS:\nAcquire::http { Proxy \u0026#34;http://apt.localdomain.com:8080/\u0026#34;; }; Acquire::https { Proxy \u0026#34;http://apt.localdomain.com:8080/\u0026#34;; }; Some extra packages worth installing:\napt-get update apt-get install --yes ccze dnsutils jq net-tools nmap rsync tcpdump Configure the system hostname and related settings:\nhostnamectl set-hostname nfs1 hostnamectl set-deployment staging hostnamectl set-chassis \u0026#34;vm\u0026#34; hostnamectl set-location \u0026#34;Data Center Park Helsinki, Finland\u0026#34; Hetzner keeps a list of their data centres in their webpage.\nServers should always store UTC. Local time is a presentation layer issue that only humans need to see. You can check the time zone in your server using the timedatectl status command, then set the time zone to UTC, if needed:\ntimedatectl set-timezone Etc/UTC Format the data disk # As stated before, we are not using ZFS as a filesystem inside the VM. Instead, we are using ZFS to back a block device (our data disk) and, inside the VM, we will format it using XFS.\nFurthermore, if you create a partition inside the VM, like most OS installers do, then resizing later will still involve partition math (e.g., using parted, fdisk, or sfdisk to adjust size). If, instead, you use the whole device directly (i.e., format /dev/sdc without a partition table), then resizing becomes simpler.\nTherefore, inside the VM, all that is left is to format the data disk. As the root user, install the required packages:\napt-get install --yes xfsprogs Then, identify the disk using the lsblk command (e.g., sdc) , then format it:\nmkfs.xfs -b size=4096 /dev/sdc Unfortunately, when using Debian 12 Bookworm, we cannot align the block size of our XFS filesystem (4K) to the volblocksize of our ZVOL (8K) because the page size of the kernel is 4K (standard for most x86_64 Linux system), and XFS requires the block size to be less or equal than the page size.\nAlthough we could install kernel 6.12 from Debian Backports, which includes support for Large Block Sizes (LBS), we would still be lacking a recent-enough version of xfsprogs (at least 6.5) that understands LBS filesystems, and this package has not been backported. Our only option is to upgrade to Debian 13.\nHowever, even if our XFS block size is 4K, the ZVOL will still aggregate writes into 8K blocks on disk, which can improve performance on spinning disks and reduce fragmentation.\nAligning the block size of XFS with the block size of the ZVOL is always beneficial, no matter what value of ashift your ZFS storage pool has.\nTherefore, let’s wrap this up by creating the mount point, gettting the UUID of the new disk with the blkid command, and configuring the /etc/fstab file so it is automatically mounted at boot:\nmkdir /srv/nfs blkid /dev/sdc echo \u0026#39;UUID=333e6175[..] /srv/nfs xfs noatime 0 2\u0026#39; \u0026gt;\u0026gt; /etc/fstab systemctl daemon-reload mount /srv/nfs If you created the virtual disk using the terminal, then you can take advantage of the serial option to skip the blkid command and simplify the /etc/fstab entry:\n# /etc/fstab /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_data /srv/nfs xfs noatime 0 2 You may notice that the output of the blkid /dev/sdc command includes BLOCK_SIZE=\u0026quot;512\u0026quot;, or some other value different from the one you used when formatting the disk. This is because ZVOLs abstract physical blocks and present virtual 512-byte sectors to guests. This is hardcoded in ZFS and not configurable via volblocksize. Moreover, ashift and volblocksize optimise storage efficiency, but do not affect the sector size exposed to the guest.\nIn the future, use xfs_info /dev/sdc to check the arguments used when formatting.\nTo get better performance and control, we are not using the discard mount option. Instead, we will run fstrim periodically:\nsystemctl enable fstrim.timer NFS server # Install the required packages:\napt-get install --yes nfs-kernel-server NFS-mounted directories are not part of the system on which they are mounted. So, by default, the NFS server refuses to perform operations that require superuser privileges (e.g., reassign ownership).\nNFS can be configured to allow trusted users on the client system to perform superuser tasks, but this introduces an element of risk, as such a user could gain root access to the entire host system.\nIn our example, we will create a general purpose NFS mount that uses default NFS behaviour to store files that were uploaded using a content management system. Since NFS operates using the nobody:nogroup credentials, we will assign those to the subdirectory.\nmkdir --parents /srv/nfs/myapp chown nobody:nogroup /srv/nfs/myapp NFS will translate any root operations on the client to the nobody:nogroup credentials as a security measure. Therefore, we need to change the directory ownership to match those credentials.\nSupport for NFSv4 was standarized in 2003, so we will assume that all clients, as well as the server, will be using this version of the protocol. Certainly, nfs-kernel-server 2.6.2 on Debian 12 Bookworm does support NFSv4.\nNFSv4 exports typically under a common pseudo-root, /srv/nfs in our case. The host exports such top-level directory with fsid=0, and clients mount subpaths, e.g., /myapp.\nWe are now ready to export the share by editing the /etc/exports file:\n/srv/nfs \\ myapp1.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) \\ myapp1.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) /srv/nfs/myapp \\ myapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ myapp2.localdomain.com(rw,async,no_subtree_check,root_squash) Let us review each of the options:\nrw: Gives the client permission to read from and write to the volume. async: Instructs NFS to reply to write requests from clients as soon as the data is received, without waiting for the data to be written to disk. This leads to better performance but there is a trade-off with data integrity. no_subtree_check: Prevents the process where, for every request, the host must check whether a given file is actually still available in the exported tree, e.g., when a client requests renaming a file that is still open by another client. root_squash: Map client’s root user to nobody, for security (default behaviour). fsid=0: Defines the NFSv4 root export. If your workload is not sensitive to latency, it is recommended to use the default sync mode instead of async, so that NFS is forced to to write changes to disk before replying. This reduces the speed of operations but results in a more stable and consistent interaction.\nThe fsid=0 option is not required for root access, but to define the NFSv4 root export.\nNFS takes the seach domain of its host as its main domain. In our case, that is correct but, if you want to be explicit about it, edit the /etc/idmapd.conf file:\n[General] Domain = localdomain.com And restart the appropriate daemon:\nsystemctl restart nfs-idmapd Export the changes and, optionally, confirm the exported configuration:\nexportfs -ra exportfs -v Finally, verify the setup is working fine:\nshowmount -e nfs1.localdomain.com Depending on the expected workload, you may want to increase the number of NFS threads (nfsd) started by the kernel:\necho \u0026#34;RPCNFSDCOUNT=32\u0026#34; \u0026gt;\u0026gt; /etc/default/nfs-kernel-server And restart the appropriate daemon:\nsystemctl restart nfs-server Increasing this number can improve performance, especially under heavy load, by allowing the server to handle more concurrent NFS requests. However, excessive threads can introduce overhead and potentially lead to performance degradation.\nFirewall # Finally, we also need to adjust the firewall rules on the VM. At the moment you should already have aliases for both the client and the host, created via the Datacenter \u0026gt; Firewall \u0026gt; Alias menu option.\n# /etc/pve/firewall/cluster.fw [ALIASES] ipv4_private_ansible1 192.168.0.1 # Ansible Controller ipv4_private_nfs1 192.168.0.4 # NFS: Staging ipv4_private_myapp1 192.168.0.5 # My app: Staging ipv4_private_myapp2 1291.68.0.6 # My app: Staging And you should probably have an IP set for the two LXC running your app:\n# /etc/pve/firewall/cluster.fw [IPSET private_myapp_staging] # My App guests ipv4_private_myapp1 ipv4_private_myapp2 Therefore, you would create a security group for the NFS server host:\n# /etc/pve/firewall/cluster.fw [group nfs_staging] # Default rules for NFS servers IN ACCEPT -source +private_myapp_staging -p udp -dport 2049 -log nolog # Allow NFS traffic IN ACCEPT -source +private_myapp_staging -p tcp -dport 2049 -log nolog # Allow NFS traffic And, finally, add the security group to the nfs1 guest:\n# /etc/pve/firewall/\u0026lt;VMID\u0026gt;.fw [RULES] GROUP nfs_staging -i net0 # Allow access to NFS from guests NFS client # To access an NFS share from the client, we first need to provide ourselves with the essential userspace tools and kernel support modules needed to mount NFS shares using the standard mount command. Beyond installation, proper user and group ID alignment is important in order to preserve file ownership and permissions.\nFinally, we need to configure our /etc/fstab with the appropriate options to achieve persistent mounts across reboots.\nIn a VM # Support for NFS at the client side requires the installation of the nfs-common package. Let’s get that out of the way:\napt-get install --yes nfs-common Let’s asume that our application myapp is run by the user myappuser, that belongs to the group myappgroup. Therefore, such user requires access to the files in the shared volume. Let’s create the mount point on the guest where NFS will act as client:\nmkdir /mnt/files chown myappuser:myappgroup /mnt/files Then we can manually test that we can reach the NFS export:\nmount --types nfs4 nfs1.localdomain.com:/myapp /mnt/files umount /mnt/files For this to work, the myappuser user and the myappgroup have to exist on both server and client, with matching UID and GID, respectively.\nIn our case, running id myappuser in our client tells us that both the user and the group have id 1001\nuid=1001(myappuser) gid=1001(myappgroup) groups=1001(myappgroup),117(ssl-cert) So we need to create the same user and group in the nfs1 guest, where the NFS server runs:\ngroupadd --gid 1001 myappgroup useradd --uid 1001 --gid 1001 --no-create-home --shell /bin/false myappuser If we already have files in the shared volume /srv/nfs/myapp, we will need to recursively reassign ownership:\nchown --recursive myappuser:myappgroup /srv/nfs/myapp Now file ownership will behave correctly across the mount. No need to pass any extra options at mount time.\nIn order to have the remote volume mounted automatically upon reboot, we need to add the appropriate entry in the /etc/fstab:\n# /etc/fstab. Static file system information # nfs1.localdomain.com:/myapp /mnt/files nfs4 auto,rw,suid,nouser,async,_netdev,nofail,noatime,nodiratime,nolock,rsize=65536,wsize=65536 0 0 Explanation of options:\nnfs4: Use NFS version 4. auto: Allows automatic mounting at boot. rw: Mount read-write. nosuid: Disable SUID/SGID bits. nouser: Only root can mount async: Use asynchronous I/O _netdev: Ensures mount happens after the network is up. nofail: Allows the system to boot even if the NFS mount fails. noatime: Disables updates to access timestamps on files. nodiratime: Reduces metadata writes when directories are read or traversed. nolock: Disable NFS file locking (avoids needing rpc.statd on the client side), unless your application relies on file locking internally, which is uncommon for file-based uploads like images. rsize=65536: Read buffer size, or the maximum number of bytes the client can read from the server in a single request. wsize=65536: Write buffer size, or the maximum number of bytes the client can send to the server in a single write request. Regarding rsize and wsize, the larger the size, the fewer RPC calls for large sequential reads or writes, thus better throughput. For small random writes, this matters less. 65536 bytes equals 64 kB, which is usually the maximum supported by most modern NFS servers and clients.\nAlso note that we are not using the defaults option, as it includes the dev, suid and exec options that do not apply to our use case:\nsuid: Allow programs to run with set-user-identifier (SUID/SGID) bits. dev: Interpret device special files on the filesystem. exec: Allow execution of binaries. We do not need to specify user or group, as ownership will work based on UID/GID.\nRegarding the trailing zeros in our configuration file, respectively:\ndump tells the dump backup utility whether to back up this filesystem. fs_passno controls whether fsck should check the filesystem on boot. For network filesystems, both options are left disabled.\nYou are now ready to mount the volume with the options we just configured:\nmount /mnt/files In an LXC # When the NFS client is an unprivileged LXC, direct NFS mounting is not possible because AppArmor does not allow it. In such scenario, an alternative approach would be to mount the share on the Proxmox host first, then bind it to the container.\nAside from security risks on our multi-tenant environment, this setup reduces isolation, requires host-level privileges and increases cluster complexity (all nodes mount the same NFS paths so that guests can be migrated).\nHowever, if we were to configure the LXC as privileged, then we could reproduce the steps performed on the client VM. Trading security for convenience, privileged LXCs are less isolated than unprivileged containers, therefore a host kernel issue or crash would affect all containers and NFS mounts inside the LXC. Moreover, NFS mounts would break during live migration or backup, or prevent these tasks from completing successfully.\nAll in all, when using LXC the recommended way to store files would be an S3-compatible object storage.\nMultiple shares # Eventually, you may need the NFS server to share multiple volumes, perhaps for different applications in a platform. You could have shared volumes among different applications, and also different shares for the same set of applications.\nFor example, you could create the following directory structure in the VM hosting our NFS server:\n# tree -L 1 /srv/nfs /srv/nfs/ ├── allapps │ └── files ├── newapp │ ├── media │ ├── static │ └── tmp └── oldapp ├── docs └── tmp Unfortunately, the NFS exports file (/etc/exports) does not support variables, macros, includes, or preprocessor-like syntax such as defining common options in one place and reusing them. It is a flat file where every line must be fully expanded and interpreted literally by the exportfs system.\nTherefore, in terms of keeping the /etc/exports file more readable, we can only go so far as to:\nUsing line breaks and indentation clearly. Avoiding redundant options when possible. Grouping hosts when they all share the same options. Given these premises, in order to match the structure above, we would modify the /etc/exports file in our NFS server to this:\n# Root of export tree /srv/nfs \\ oldapp1.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) \\ oldapp2.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) \\ newapp1.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) \\ newapp2.localdomain.com(rw,async,no_subtree_check,root_squash,fsid=0) # All apps /srv/nfs/allapps/files \\ oldapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ oldapp2.localdomain.com(rw,async,no_subtree_check,root_squash) \\ newapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ newapp2.localdomain.com(rw,async,no_subtree_check,root_squash) # New app /srv/nfs/newapp/media \\ newapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ newapp2.localdomain.com(rw,async,no_subtree_check,root_squash) /srv/nfs/newapp/static \\ newapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ newapp2.localdomain.com(rw,async,no_subtree_check,root_squash) /srv/nfs/newapp/tmp \\ newapp1.localdomain.com(rw,sync,no_subtree_check,root_squash) \\ newapp2.localdomain.com(rw,sync,no_subtree_check,root_squash) # Old app /srv/nfs/oldapp/docss \\ oldapp1.localdomain.com(rw,async,no_subtree_check,root_squash) \\ oldapp2.localdomain.com(rw,async,no_subtree_check,root_squash) /srv/nfs/oldapp/tmp \\ oldapp1.localdomain.com(rw,sync,no_subtree_check,root_squash) \\ oldapp2.localdomain.com(rw,sync,no_subtree_check,root_squash) At each of our client VMs, we would create the necessary mount points using mkdir and set the correct permissions using chown.\n# New app guest # tree -L 1 /mnt /mnt ├── files ├── media ├── static └── tmp # Old app guest # tree -L 1 /mnt /mnt ├── docs ├── files └── tmp Finally, when adapting the /etc/fstab configuration files in the client VMs, aside from getting the paths right, make sure you mount leaf nodes only:\n# New app guest # /etc/fstab nfs1.andromedant.com:/allapps/files /mnt/files nfs4 auto,rw,suid,nouser,async,[..] 0 0 nfs1.andromedant.com:/newapp/media /mnt/media nfs4 auto,rw,suid,nouser,async,[..] 0 0 nfs1.andromedant.com:/newapp/static /mnt/static nfs4 auto,rw,suid,nouser,async,[..] 0 0 nfs1.andromedant.com:/newapp/tmp /mnt/tmp nfs4 auto,rw,suid,nouser,sync,[..] 0 0 All client VMs would follow a similar pattern.\nAs an example, in this scenario we are also taking the chance to enable synchronous writes to our tmp shares because we do not want any of our consumers taking jobs from some work queue and attempting to read data that has not yet been flushed to disk.\nBulk load of files # Our NFS server is ready, and so are our NFS clients. We now need to copy our existing files from their previous location to their new location in the shared volumes.\nUsing Rsync to do this would seem like the more sensible way to do this initial bulk transfer. During a maintenance window, we would execute the rsync command at the VMs running our old application to send the files to the mount points, then switch the paths. However, using Rsync over NFS is, probably, the least efficient way to do it due to the following reasons:\nMetadata overhead. NFS requires a separate network round-trip for every file operation (stat, open, read, close). For small files, this creates massive overhead. For example, synchronising 10,000 small files would require 40,000+ network requests.\nLack of real parallelism. NFS operations are sequential by default. Rsync processes files one-by-one, amplifying latency.\nProtocol limitations. Although NFSv4 was a huge improvement over NFSv3 in terms of compound operations (multiple actions in one request), it is still less efficient than native protocols like SSH.\nWrite barriers. By default, NFS enforces strict write ordering (sync writes), slowing small file operations. We did set up our shares using async, so this would be less of a problem for us.\nAs a reference, here you have an estimation for 1 GB of 10 kB files:\nMethod Time Network requests Rsync 8m 22s ~120,000 Rsync (–inplace) 4m 15s ~80,000 Tar over SSH 0m 48s 1 Parallel Rsync (16j) 1m 12s 16,000 Moreover, depending on the size of your archive, you want to spread this operation into several runs, using whatever criteria allows you to do one chunk at a time (e.g., by subdirectory).\nUsing Tar may be a reasonable option when piping the contents of the archive being built directly into SSH:\ntar cf - /opt/oldapp/files | ssh nfs1.localdomain.com \u0026#34;tar xf - -C /srv/nfs/allapps/\u0026#34; Another reasonable option is to use Rsync over SSH, straight from the client VM to the server VM, not using the NFS mount point.\nrsync --archive --no-owner --no-group --progress --delay-updates \\ --timeout=5 --delete --delete-delay \\ --rsh=\u0026#39;/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no\u0026#39; \\ /opt/oldapp/files/ nfs1.localdomain.com:/srv/nfs/allapps/files/ For maximum speed, SSH-based transfers will always outperform NFS for rsync workloads due to lower protocol overhead. However, for incremental updates after the initial synchronisation, using a tuned rsync over NFS will work well enough:\nrsync --archive --no-owner --no-group --progress \\ --inplace --whole-file --recursive --links --delete \\ /opt/oldapp/files /mnt/files/ Key options:\n--inplace: Writes directly to target files (reduces rename ops by avoiding temp-file renames). --whole-file: Sends whole files (disables delta-xfer to bypass slow rsync diffs). --no-owner --no-group: Do not attempt to change ownership (requires additional network requests). You would have to manually reassign ownership of files afterwards on the guest running the NFS server, if necessary.\nManaged via the Datacenter \u0026gt; Permissions \u0026gt; Pools menu option. ↩︎\nDefault for newly created Linux VMs since Proxmox VE 7.3. Each disk will have its own VirtIO SCSI controller, and QEMU will handle the disks IO in a dedicated thread. ↩︎\nThere are three types of datasets in ZFS: a filesystem following POSIX rules, a volume (ZVOL) existing as a true block device under /dev, and snapshots thereof. ↩︎\n","date":"17 July 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/nfs/server/","section":"Posts","summary":"Install, configure and optimise an NFS server in a VM on a Proxmox cluster using ZFS","title":"NFS server on a Proxmox VM","type":"posts"},{"content":"You can monitor the hosts and guests of your Proxmox cluster using the tools provided by Grafana Labs. Prometheus and Loki will be used to store metric data and logs, respectively, and Grafana will be used to visualise them. A number of Prometheus exporters and the Promtail agent will be installed on nodes, containers and virtual machines to retrieve and send the data.\nHow does it work? # In short, exporters retrieve data from the guest or host and the Prometheus server pulls metrics from those exporters, or directly from applications that publish them, and saves that data in its time series database. Loki acts the same way via its Promtail agent that pushes the content of log files to the Loki server. Then Grafana queries the Prometheus and Loki servers and displays the data. Finally, Prometheus AlertManager and Grafana Alerting send alerts when events are triggered.\nWe will install Prometheus, Loki and Grafana in separate containers in our cluster.\nPrometheus fetches metrics using a pull mechanism, so the Prometheus server must be able to establish TCP connections to the monitored clients. Guests must have corresponding ports open and be reachable over the network.\nLoki uses a push mechanism, so the Promtail agent in the guests and nodes need to be able to reach the Loki server.\nExample application # The above-mentioned tools can be used to monitor a myriad of applications and system parametres. In order not to lose sight of the essential, we will use a case scenario with a number of containers running the following services:\nGunicorn servers running Django applications. MinIO server holding static and media files. NGINX servers acting as reverse proxies. PostgreSQL database servers. Redis servers to be used as cache. As a reference, the following diagram partially illustrates the example scenario we want to monitor:\nThe solution displayed in this diagram neither intends to be complete nor optimal, but rather illustrate a simple-enough case scenario for this article. As you may have figured out already, there are no work queues, background processes, external APIs being consumed, high availability of data storages, etcetera.\nLogs and metrics being generated # The nodes, guests and services mentioned above are generating a number of logs and metrics (the application itself or via exporters). In this article, we will focus on the following metrics and logs:\nService/entity Logfile Metrics Exporter Gunicorn x x statsd_exporter MinIO x application NGINX x x nginx_exporter PostgreSQL x postgres_exporter PowerDNS x application Redis x redis_exporter Syslog / journald x Tinyproxy x tinyproxy_exporter This is not an exhaustive list, but rather a set of logs and metrics that are of our interest for this article. In addition to the list displayed in the table, we will also be monitoring machines stats of both guests and hosts. We will use the Promtail agent to ship all logs.\nProxmox # Proxmox Virtual Environment is an open-source virtualisation platform that integrates KVM for full virtualisation and LXC for lightweight, container-based virtualization. It provides web-based and command-line interfaces and a fully-featured API for managing storage, networking, virtual machines, containers, high-availability, and all aspects of the virtualisation stack. Proxmox VE is based on Debian Linux and includes a modified Linux kernel optimized for virtualization workloads.\nKey features of Proxmox VE include support for clustering multiple nodes, live migration of VM between hosts, built-in backup and restore functionality, and integration with various storage backends such as ZFS, Ceph, and iSCSI. It also includes a role-based permission system and integrates with LDAP and Active Directory for authentication. The combination of KVM and LXC allows users to optimize resources by running both virtual machines and containers on the same infrastructure.\nPrometheus # Prometheus is an open-source monitoring tool that is used to collect and store real-time metrics, pulled via HTTP, in a time-series database. Prometheus metrics are time series data, or timestamped values belonging to the same group or dimension. A metric is uniquely identified by its name and set of labels (key-value pairs).\nMetric name Labels Timestamp Value node_filesystem_avail_bytes {mountpoint=\u0026quot;/\u0026quot;, group=\u0026quot;postgresql\u0026quot;} @1725305992 12753068032 node_cpu_seconds_total {cpu=\u0026quot;0\u0026quot;, group=\u0026quot;postgresql\u0026quot;, mode=\u0026quot;iowait\u0026quot;} @1725305992 141845.45 Each application or system being monitored must expose metrics in the format above, either through code instrumentation or Prometheus exporters.\nWe can leverage queries to create temporary times series from the source. These series are defined by metric names and labels. Queries are written in PromQL, whcih allows users to choose and aggregate time-series data in real time and can also help establish alert conditions, resulting in notifications to external systems.\nMoreover, Prometheus can display collected data in tabular or graph form, shown in its web-based user interface, or you can also use APIs to integrate with third-party visualization solutions like Grafana.\nPrometheus exporters # Exporters are agents that help with exporting metrics from systems or services as Prometheus metrics. They are useful whenever it is not feasible to instrument a given application or system with Prometheus metrics directly. Multiple exporters can run on a monitored host to export local metrics.\nThe Prometheus community provides a list of exporters, a few of which are official whereas the vast majority are community contributions.\nLoki # Loki is a log aggregation system, inspired by Prometheus, that stores and queries log files of all sorts available across our applications and infrastructure. It does not index the contents of the log files, but rather a set of labels for each log stream (i.e., it only indexes metadata).\nTimestamp Labels Content 2024-09-24T10:01:02.123456789Z {service_name=\u0026quot;nginx\u0026quot;} GET /about By indexing the metadata (the first two columns) instead of the whole set of logs, Loki requires less storage. The third column (the original log message) remains unindexed.\nLoki stands out for splitting queries into small parts and executing them in parallel to speed up the search in large volumes of data. Unlike other systems that require large full-text indexes, Loki’s index is significantly smaller than the volume of logs ingested.\nLoki assumes you have a well instrumented application. The idea is that you almost never need to look at logs because most of your questions can be answered by metrics instead. Compute time is moved from ingest time to query time. Metrics identify the general area, which reduces the search space for logs by a huge amount, leading to less use of logs (to the point where a “fancy grep” is all you need).\nPromtail # Promtail is the agent responsible for gathering logs and sending them to Loki. It is designed to discover targets, attach labels to log streams based on configurable rules, and push them to the Loki instance for storage and querying through Grafana’s interface. Essentially, Promtail acts as the collector in the Loki logging stack.\nSimilar to how Prometheus uses exporters to collect metrics, Promtail serves as Loki’s equivalent for log collection. It runs on each node in our infrastructure, tailing log files, processing their contents through a pipeline of stages, and shipping the processed logs to Loki for storage and querying through Grafana’s interface. The labeling system Promtail uses is particularly powerful as it enables the same kind of dimensional data model that makes Prometheus metrics so flexible for querying.\nGrafana # Grafana is an open-source tool for interactive data visualization and analysis. It is used to create dashboards with panels representing specific metrics over a set period of time. It integrates seamlessly with Loki and Prometheus to provide a user-friendly interface for log exploration and visualisation. Its dashboards allow insightful visualisations and alerts based on log and metric data, making it a powerful solution for monitoring, troubleshooting and gaining actionable insights.\nAs a reference, the following diagram partially illustrates the Grafana ecosystem:\nGrafana Alerting # Grafana Alerting is an integrated alert management system embedded directly within the Grafana visualization platform. Tightly coupled with Grafana’s dashboarding capabilities, this alerting system allows creating alert rules based on the same metrics they already monitor and visualize. The system evaluates these rules continuously against incoming data, transitioning alerts through defined states as conditions evolve, with all alert management occurring within the same familiar interface used for data exploration.\nThe architecture of Grafana Alerting unifies alerting across multiple data sources, allowing teams to create consistent alert definitions regardless of whether the underlying metrics come from Prometheus, InfluxDB, or other supported backends. This unified approach simplifies multi-source monitoring environments by providing a single pane of glass for alert definition, evaluation, and notification. Each alert can trigger customizable notifications through various channels, with rich context including relevant graphs and annotations to speed troubleshooting.\nNGINX # NGINX is an open-source web server software that is widely used for serving static content, handling reverse proxying, load balancing, and caching. NGINX is known for its high performance, stability, and low resource consumption, making it a popular choice.\nOne of the key features of NGINX is its ability to act as a reverse proxy server. In this role, NGINX sits between client devices and backend servers, forwarding client requests to the appropriate server and returning the server’s response to the client. This setup can significantly enhance the performance, security, and reliability of web applications.\nWhen used with monitoring and logging tools like Prometheus, Loki, and Grafana, NGINX can distribute incoming traffic and add an extra layer of security, facilitating the efficient and secure operation of complex applications.\n","date":"24 September 2024","externalUrl":null,"permalink":"/en/posts/grafana/introduction/","section":"Posts","summary":"Collect, store and visualise metrics and logs using Grafana, Prometheus and Loki.","title":"Monitoring your Proxmox cluster with Grafana","type":"posts"},{"content":" Introduction # This series of articles will take you through the steps required to install and manage a basic Proxmox Virtual Environment cluster on dedicated servers at Hetzner, a German hosting company and data centre operator. It is an entry level proposal aimed at companies or individuals that want to self-host the software required to run their business.\nIf you have never read about Proxmox before, I suggest that you go through the excellent Migrate to Proxmox VE article on their website, which explains the core concepts very well.\nWe will start with a simple setup of three nodes that will make use of a subset of the features Proxmox offers. As we progress through the series, we will gradually introduce more advanced features, while keeping it very cost-effective and affordable.\nHardware # Hetzner offers a wide range of servers, and also accepts custom orders. The specifications of the nodes will dictate certain configuration aspects and which features of Proxmox are used. Price will vary substantially depending on what you order, hence planning before ordering is a must.\nGenerally speaking:\nThe more CPU cores you have, the more tasks the kernel will be able to run in parallel. The bigger your disks, the more capacity your local or shared storage will have in a given node and, overall, in the cluster. The amount of RAM will limit both the amount of guests per node and the amount of memory you will be able to assign to them. How much you need of each heavily depends on the load you plan on running in the cluster.\nDesign considerations # Let’s give some thought to the network configuration before getting started. We will be following the naming conventions for device names described in the Host System Administration \u0026gt; Network Configuration section of the Proxmox VE Administration Guide.\nVirtual switches allow your guests (containers and virtual machines) to use the same IP address anywhere in the cluster, allowing them to be migrated from node to node without the need to change their configuration.\nPrivate subnets through virtual switches are included by default, without any additional cost. However, you will need to purchase a subnet of public IP addresses if you plan on using floating public IP addresses on (some of) your guests, e.g. an LXC running a HTTP reverse proxy.\nAll guests on your cluster will have a net0 virtual network device with an IP address of the private network 192.168.0.0/16 via the vmbr4002 bridge.\nSome guests will also have a net1 virtual network device with an IP address of the floating public subnet assigned to the vSwitch via the vmbr4001 bridge. More on that later on this series.\nProxmox name OS name on LXC OS name on VM net0 eth0 ens18 net1 eth1 ens19 All nodes will communicate through the 10.0.0.0/24 subnet. If you do not plan on using Docker, you may want to switch to the 172.16.0.0/24 subnet.\nWe will use the static public IP address assigned to each dedicated server for administration purposes, e.g., SSH access.\nThrough the WebGUI you will be able to change the OS name of a network device when working with LXC. When working with a VM, Proxmox assigns each VirtIO NIC on different virtual PCI slots (e.g., ens18 equals to the ethernet card on the PCI slot 181). Use the ip link show command 2 to list the available network devices in a VM.\nWe will be using two fake domain names: localdomain.com and publicdomain.com. The former will be used internally, within the cluster 3, to resolve the hostnames of the guests, and the latter will be used externally, via the public Domain Name System.\nBasic setup # The basic setup consists of three or more dedicated servers with minimum specifications and three virtual switches. You do not need to place a custom order for this. You can order the servers from the Hetzner Server Auction page or from the Hetzner Dedicated Servers page, depending on your needs.\nName Description Notes CPU Intel or AMD, 8+ cores Disks 2x NVMe SSD for the OS and local storage RAID 1 Disks 2x HDD for local storage, using ZFS mirror Optional RAM 64+ GB NIC 1 Gbps, the default with any server With this basic hardware configuration you will have your only NIC handle the traffic to the Internet as well as the traffic among nodes and among guests, with the help of three virtual switches.\nThis type of setup will be fairly easy to manage and will have a very low setup and maintenance cost. However, you will have neither shared storage nor high availability. RAID 1 on your SSD-based local storage will provide fault tolerance and increased read performance.\nMore importantly, you will only be able to have a maximum of 30 guests per node due to the artificial limit of 32 MAC addresses per switch port that Hetzner has on vSwitches.\nType Device name Used by Type IP range Description Ethernet device eno1 The host Public IP Public IP address assigned to the server when ordered Bridge vmbr4001 Guests Public subnet Public subnet assigned to the vSwitch with id 4001 Bridge vmbr4002 Guests Private subnet 192.168.0.0/16 Communication among guests through vSwitch with id 4002 VLAN eno1.4003 Hosts Private subnet 10.0.0.0/24 Communication among nodes through vSwitch with id 4003 Types of nodes # All nodes in this basic setup will be of mixed type, that is, will have local storage for guests (same NVMe disks where the OS was installed or on separate HDD disks with ZFS) and will run applications, e.g., a Django web application or a PostgreSQL server.\nCreating the vSwitches # Virtual switches are a feature of Hetzner Online that allows you to create virtual layer 2 networks, enabling communication between your dedicated servers across different locations. This is particularly useful for creating a Proxmox cluster where multiple nodes need to communicate with each other and with the guests running on them.\nLog in at Hetzner’s accounts page, then navigate to Hetzner Robot \u0026gt; Servers \u0026gt; vSwitches. Use the Create vSwitch button to create up to three virtual switches, depending on your setup.\nName VLAN id Notes Cost Proxmox guests public network 4001 Ordered separately1 Proxmox guests private network 4002 192.168.0.0/16 Free of charge Proxmox hosts private network 4003 10.0.0.0/24 Free of charge Then add all the servers to each vSwitch using the Virtual switch \u0026gt; Add servers to vSwitch option inside each virtual switch you just created.\nOrdering a subnet of public IP addresses # We need to order an additional subnet of public IP addresses for the guests that will require them. Select the vSwitch with VLAN id 4001 and click on the IPs tab, then click on the Order additional IPs/Nets button.\nChoose your preferred subnet size. Type in something like “Floating IPs for Proxmox cluster” in the Purpose of use field. Agree to the terms and conditions. Click on the Apply for subnet in obligation button. Once the order has been processed, you will be able to assign the additional IPs to the guests.\nMask (bits) Decimal notation No. of IPs Usable IPs 27 255.255.255.224 32 30 28 255.255.255.240 16 14 29 255.255.255.248 8 6 For reference, in this series we will be using a fake v4.public.ip.subnet/28 subnet, with fake IP addresses like v4.public.ip.1, v4.public.ip.2, etc.\nIPv6 # To keep things as simple as possible, we will not be using IPv6 in this series, but you could order a subnet of IPv6 addresses in the same way as you did for IPv4. The subnet would be assigned to the vmbr4001 bridge, which is the public network of the guests.\nYou will see that Hetzner assigns IPv6 addresses to servers in addition to IPv4 ones. Keep in mind that :: is the IPv6 equivalent of 0.0.0.0 in IPv4. ::1 is IPv6 equivalent of 127.0.0.1 (the loopback address) in IPv4.\nCounting MAC addresses # There are a few limitations to keep in mind when using Hetzner’s vSwitches, the most important being that there is a limit of 32 MAC addresses per physical switch port. This means that we will not be able to use more than 30 guests per host, provided that each guest has just one (private) IP address.\nUse the following script to calculate the number of MAC addresses used in each node:\n#!/bin/bash # Count the number of MAC addresses in the node total=0 for bridge in $(ip link show | awk -F: \u0026#39;/vmbr/ \u0026amp;\u0026amp; !/fw/{print $2}\u0026#39;); do count=$(ip link show | grep -A 1 \u0026#34;master $bridge\u0026#34; | grep \u0026#39;link/ether\u0026#39; | awk \u0026#39;{print $2}\u0026#39; | sort -u | wc -l) total=$((total + count)) done echo \u0026#34;$total\u0026#34; This script will count the number of unique MAC addresses associated with each bridge interface that starts with vmbr, excluding any interfaces that contain fw (which are typically firewall-related interfaces in Proxmox).\nSome considerations regarding the total amount of MAC addresses you may see when running ifconfig -a or ip link show:\nBridge Interface: The bridge itself has a MAC address, which is included in the count. Virtual Interfaces: Each VM or LXC connected to the bridge has a virtual interface (e.g., veth* or tap*) with a MAC address. Firewall Interfaces: The fwpr* and fwln* interfaces do not contribute to the MAC address count because they are internal to Proxmox. When dealing with predictable network interface names, your mileage may vary. ↩︎ ↩︎\nAlternative commands are netstat -i and ifconfig -a. ↩︎\nLater on this series we will install and configure PowerDNS. ↩︎\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/introduction/","section":"Posts","summary":"Plan, install and configure your first Proxmox cluster using dedicated servers at Hetzner","title":"Entry level Proxmox 7 cluster at Hetzner","type":"posts"},{"content":"On our Proxmox cluster we have configured an NFS server on a VM, and for that we have used three virtual disks:\nA 3 GB virtual disk using QCOW2 format, on our local storage, for the OS, which we formatted using EXT4. A 1 GB virtual disk using RAW format, on our local storage, for the swap. A 100 GB virtual disk using a block device (ZVOL), on our zfspool storage, for the data, mounted on /srv/nfs. Inside the VM, these disk correspond to /dev/sda, /dev/sdb and /dev/sdc, respectively, and are mounted using UUID in the /etc/fstab file.\nEventually, the time to extend a disk will come. Extending a ZFS volume differs from extending a virtual disk in qcow2 or raw format. Moreover, having a partition table will involve partition math.\nZFS volume # To extend the ZVOL holding the data disk, follow these steps:\nResize the disk image or block device. Resize the filesystem inside the VM. To perform the first step, you can either use the WebGUI or the terminal. If you prefer the former, go to the Hardware menu option of the VM, select the data disk and use the Disk action \u0026gt; Resize button, input the number of extra gigabytes you need and click Resize disk. If you prefer the latter, execute the following command from the terminal of the host:\nqm resize 104 scsi0 +1G After resizing the disk, use lsblk to check that the OS has already detected the new size. If it does not show the new size, use the following command to instruct the OS to rescan the block device:\necho 1 \u0026gt; /sys/class/block/sdc/device/rescan To perform the second step you need to use the VM console:\nxfs_growfs /dev/sdc Make sure the disk is mounted before running xfs_growfs.\nXFS supports online resizing, while mounted and even while actively being used. However, if the disk is under heavy load, you might want to temporarily reduce I/O to avoid unpredictable behaviour.\nOS disk # To extend the size of your OS disk (a virtual disk using QCOW2 format), follow these steps:\nResize the virtual disk using the Proxmox CLI (or GUI, if you prefer). Grow the partition. Resize the filesystem inside the VM. First of all, start by installing growpart, the tool of choice for resizing mounted disks when no LVM is involved:\napt-get install --yes cloud-guest-utils In Debian, the growpart command is part of the cloud-guest-utils package, which is pre-installed on cloud images but not on ISO Netinst images.\nUse the terminal of the host to execute the following command (adapt the value to your needs):\nqm resize 104 scsi0 +1G If you check the kernel messages using dmesg, you will notice the following messages (numbers will vary depending on your previous size and how much space you added):\nsd 0:0:0:0: Capacity data has changed sd 0:0:0:0: [sda] 8388608 512-byte logical blocks: (4.29 GB/4.00 GiB) sda: detected capacity change from 6291456 to 8388608 If you now log into the VM via SSH, you can use lsblk to realise that the new disk size has already been caught up by the kernel. However, the /dev/sda1 partition still shows the old size:\n# lsblk /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 4G 0 disk ├─sda1 8:1 0 2.9G 0 part / ├─sda14 8:14 0 3M 0 part └─sda15 8:15 0 124M 0 part /boot/efi Use growpart in the console of the VM to resize the partition:\ngrowpart /dev/sda 1 We can now see the changes in the partition using lsblk:\n# lsblk /dev/sdb sda 8:0 0 4G 0 disk ├─sda1 8:1 0 3.9G 0 part / ├─sda14 8:14 0 3M 0 part └─sda15 8:15 0 124M 0 part /boot/efi However, the filesystem still shows the previous value:\n# df -h / Filesystem Size Used Avail Use% Mounted on /dev/sda1 2.8G 2.0G 629M 77% / Therefore, all that is left is to use the EXT4 resizer to resize the filesystem:\nresize2fs /dev/sda1 And verify the results:\n# df -h / Filesystem Size Used Avail Use% Mounted on /dev/sda1 3.8G 2.0G 1.6G 57% / You can also perform the procedure using fdisk and sfdisk, but it is more error-prone and cannot be automated.\nSwap disk # Resizing a swap disk can be simpler than resizing an OS or data partition because swap does not have a traditional filesystem. Furthermore, we do not need to preserve data.\nTo extend the size of your swap disk (a virtual disk using RAW format), follow these steps:\nResize the virtual disk in Proxmox GUI or CLI. Turn off swap temporarily Make the new swap area. Enable swap again. Use the WebGUI or the terminal to extend the disk. If you prefer the former, use the Hardware \u0026gt; Disk action \u0026gt; Resize button on the appropriate disk (e.g., SCSI-1), set the additional size in gigabytes and confirm. If you prefer the latter, execute the following command from the terminal of the host (adapt the value to your needs):\nqm resize 104 scsi1 +1G Inside the VM, turn off swap temporarily:\nswapoff -a Now make a new swap area:\nmkswap /dev/sdb And enable swap again:\nswapon /dev/sdb Optionally, ensure /etc/fstab is still pointing at the correct UUID:\nswapon --show ","date":"19 July 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/nfs/extending-disks/","section":"Posts","summary":"Extend the virtual disks and ZVOLs of your VM running an NFS server without data loss","title":"Extend virtual disks and ZVOLs on Proxmox","type":"posts"},{"content":"This article will make use of two LXC running Debian GNU/Linux on a Proxmox cluster to get the Prometheus server installed and set up to pull and store data metrics.\nprometheus1.localdomain.com will run the Prometheus server on port 8080. nginx1.localdomain.com will run NGINX as a reverse proxy on port 443 at the public address prometheus.publicdomain.com. This series assumes that an internal DNS server is installed and correctly configured. localdomain.com is the internal DNS zone used across the cluster, whereas publicdomain.com is a public DNS zone used to access services from the Internet.\nHow does it work # The Prometheus server will be collecting metric data by connecting to exporters (i.e., agents), which are running inside the host or guest you want to collect data from, or directly to an application. Each exporter or application will be listening on a different port.\nThe Prometheus server will periodically connect to that address and port and request the agent to gather data, then store that data in its local, on-disk time-series database located at /var/lib/prometheus/metrics2/.\nWhat can it be used for # Prometheus can be used for:\nMonitoring. Collect and store time series metrics from systems and applications to understand their current state. Historical analysis. Gain insights into system and application behavior over time. Capacity planning. Analyze trends in resource consumption to anticipate future needs. Observability. Correlate metric anomalies with events and deployments to debug and resolve operational issues. Alerting. Trigger alerts based on configurable conditions. Service Level Objective (SLO) management. Define and measure compliance with performance targets Installation # We will install the Prometheus server from the Debian repository, then manually update the binary from the Prometheus releases page at Github.\napt-get update apt-get install prometheus ssl-cert adduser prometheus ssl-cert We will configure the Prometheus server to encrypt communications using TLS. Therefore, we are adding the prometheus user to the ssl-cert group (created by the ssl-cert package) so it can read the private key of the wildcard certificate at /etc/ssl/private/localdomain.com.key, issued by Let’s Encrypt.\nFinally, update the binary files with the more modern versions from Github:\nexport PROMETHEUS_VERSION=\u0026#34;2.55.1\u0026#34; wget https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz \\ --output-document=/tmp/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz tar --directory=/tmp --extract --gzip --file=/tmp/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz cp /tmp/prometheus-${PROMETHEUS_VERSION}.linux-amd64/prometheus /usr/bin/ cp /tmp/prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool /usr/bin/ Prometheus configuration # The configuration takes two steps:\nConfigure the Prometheus server. Configure Prometheus to monitor itself. The Prometheus server uses three main configuration files:\nThe main configuration file /etc/prometheus/prometheus.yml. This determines what exporters and applications the Prometheus server will be connecting ot. The web configuration file /etc/prometheus/web.yml. This configures the HTTP server within Prometheus that the NGINX reverse proxy will be connecting to. The command-line arguments file /etc/default/prometheus. This will determine the start-up parametres of the Prometheus daemon. Command-line arguments # Let’s begin with the environment file /etc/default/prometheus used by the systemd service file1 to pass command-line arguments to the server.\n# Set the command-line arguments to pass to the server # See: https://prometheus.io/docs/prometheus/latest/command-line/prometheus/ ARGS=\u0026#34;--web.config.file=\u0026#39;/etc/prometheus/web.yml\u0026#39; \\ --config.file=\u0026#39;/etc/prometheus/prometheus.yml\u0026#39; \\ --web.listen-address=\u0026#39;:8080\u0026#39; \\ --web.external-url=\u0026#39;https://prometheus.publicdomain.com/\u0026#39; \\ --web.route-prefix=\u0026#39;/\u0026#39; \\ --storage.tsdb.path=\u0026#39;/var/lib/prometheus/metrics2/\u0026#39; \\ --storage.tsdb.retention.time=\u0026#39;2y\u0026#39; \\ --web.console.libraries=\u0026#39;/etc/prometheus/console_libraries\u0026#39; \\ --web.console.templates=\u0026#39;/etc/prometheus/consoles\u0026#39;\u0026#34; The following table summarises the arguments passed to the daemon:\nArgument Description web.config.file Web configuration in YAML format config.file Main configuration in YAML format web.listen-address Address and port the server will listen at web.external-url URL under which Prometheus is externally reachable web.route-prefix Prefix in the path for the internal endpoints storage.tsdb.path Path to the local on-disk time-series database storage.tsdb.retention.time How long to retain samples in storage web.console.libraries Path to the console library directory web.console.templates Path to the console template directory Note: Options in the web namespace have to do with the HTTP server.\nIn short, we are instructing the daemon to load the HTTP server configuration from the /etc/prometheus/web.yml file, to load the main configuration from the /etc/prometheus/prometheus.yml file, to listen to port 8080 (the default being 9090) and how to write relative and absolute links back to Prometheus itself.\nHTTP server # Let’s continue with the configuration file /etc/prometheus/web.yml, used by the server to configure authentication and enable encryption via TLS.\n# Prometheus web configuration # See: https://prometheus.io/docs/prometheus/latest/configuration/https/ # Allow TLS connections tls_server_config: cert_file: /etc/ssl/certs/localdomain.com.crt key_file: /etc/ssl/private/localdomain.com.key min_version: TLS12 # Enable HTTP/2 support http_server_config: http2: true Aside from enabling TLS and use of HTTP/2.0, the http_server_config key can be used to set headers, which may be useful depending on the environment your server is running. Moreover, the basic_auth_users key can be used to enable HTTP authentication, but we will be delegating this onto NGINX later on this article.\nMain options # Finally, let’s proceed to the main configuration file at /etc/prometheus/prometheus.yml, starting with a very basic configuration, which we will be expanding.\n# Prometheus configuration # See: https://prometheus.io/docs/prometheus/latest/configuration/configuration/ # Set the global defaults global: # How frequently to scrape targets (default is 1m) scrape_interval: 30s # How long until a scrape request times out (default is 10s) scrape_timeout: 10s # Scrapers configuration scrape_configs: # Prometheus - job_name: \u0026#39;prometheus\u0026#39; scheme: https proxy_from_environment: false tls_config: ca_file: /etc/ssl/certs/ISRG_Root_X1.pem insecure_skip_verify: false static_configs: - targets: - \u0026#39;prometheus1.localdomain.com:8080\u0026#39; labels: group: \u0026#39;prometheus\u0026#39; metrics_path: /metrics There are two main keys, global and scrape_configs. The former define global variables whereas the latter defines a list of scrape configurations, i.e., metric exporters that the server will be querying for data.\nLater on thi series, we will be adding a new entry in the scrape_configs key for every type of scrapper we install (e.g., PostgreSQL Exporter or NGINX Exporter) or application we want to scrape (e.g., MinIO).\nFor now, the example above queries the Prometheus server, which exposes Prometheus-compatible metrics itself,\nAt this point, the service file should be enabled and the daemon started, so all you need is to restart the server, then check its status.\nsystemctl restart prometheus systemctl status prometheus Should the service file be disabled, use the systemctl enable prometheus command to enable, then start it using the systemctl start prometheus command.\nReverse proxy # We will use NGINX in a different container to act as reverse proxy. Check the \\[NGINX configuration\\] ({{ \u0026lt; ref “/posts/nginx” \u0026gt; }}) article for a complete installation and configuration guide NGINX. For now, a basic server block configuration should get you started.\nserver { listen 443 ssl; server_name prometheus.publicdomain.com; ssl_certificate /etc/ssl/certs/publicdomain.com.crt; ssl_certificate_key /etc/ssl/private/publicdomain.com.key; location / { auth_basic \u0026#34;Prometheus | Calabruix\u0026#34;; auth_basic_user_file /etc/nginx/.prometheus.htpasswd; proxy_http_version 1.1; proxy_pass https://prometheus1.localdomain.com:8080; } } The following table summarises the configuration of the server block:\nArgument Description listen 443 ssl Listen on port 443 with SSL enabled server_name Set the FQDN of the virtual server ssl_certificate Path to the SSL certificate in PEM format ssl_certificate_key Path to the secret key of the SSL certificate in PEM format location Set configuration options depending on the request URI auth_basic Enable validation of user name and password auth_basic_user_file Path to the file that keeps the usernames and passwords proxy_http_version Set the HTTP protocol version for proxying proxy_pass Set the protocol, address and port of the proxied server We do not need to add the nginx user to the ssl-cert group because the master process of NGINX runs as root, therefore it can already read the secret key of the wildcard certificate at /etc/ssl/private/publicdomain.com.key, issued by Let’s Encrypt.\nAs stated before in this article, we are restricting access with HTTP basic authentication. To achieve that, we need to populate the /etc/nginx/grafna.htpasswd file using the htpasswd command from the apache2-utils package.\nThe following command will create a password file (remove the -c flag if it already exists) with a user named prometheus. Type the password in the prompt, twice.\nhtpasswd -cB -C 10 /etc/nginx/.prometheus.htpasswd prometheus The password can be generated with the following command:\nopenssl rand -base64 25 | tr --delete /=+ | cut --characters -32 Do not forget to add the records for both prometheus1.localdomain.com and prometheus.public.domain into their respective DNS zones, or your /etc/hosts file. Also check the firewall rules.\nUse the nginx -t command to check for syntax errors in the configuration files and, finally, instruct NGINX to reload its configuration:\nsystemctl reload nginx Optionally, check the status of the service using systemctl status nginx. Now you are ready to load the web page https://prometheus.publicdomain.com/ in your favourite browser.\nStorage # Prometheus stores time-series data locally in a custom, efficient format by default. It is designed for reliability and fast querying but is not clustered (i.e., no built-in replication).\nData is stored in a directory, /var/lib/prometheus/metrics2/ in our case. Ingested samples are organized into blocks, in separate subdirectories, each containing:\nA chunks/ subdirectory with all the time series samples for that period. A metadata file. An index ile mapping metric names and labels to time series in the chunks/ subdirectory. To safeguard against crashes, Prometheus uses a WAL stored in segments within the wal/ subdirectory, which can be replayed upon server restart to recover data.\n# tree /var/lib/prometheus/metrics2/ /var/lib/prometheus/metrics2/ ├── 01JNZ6T5EMKBXZ0BPMXSMCH2CK │ ├── chunks │ │ ├── 000001 │ │ ├── 000002 │ │ └── 000003 │ ├── index │ ├── meta.json │ └── tombstones ├── 01JP14KKHT2FQFX8Q4R5G81XXQ │ ├── chunks │ │ ├── 000001 │ │ ├── 000002 │ │ └── 000003 │ ├── index │ ├── meta.json │ └── tombstones ├── [..] ├── chunks_head │ ├── 020194 │ ├── 020195 │ ├── 020196 │ └── 020197 ├── lock ├── queries.active └── wal ├── 00072044 ├── 00072045 ├── [..] ├── 00072054 └── checkpoint.00072043 └── 00000000 Data is split into blocks (usually 2-hour chunks initially) and later compacted into larger blocks to reduce storage usage and improve query performance by decreasing the number of blocks that need to be queried. Deletion records are stored in separate tombstone files (instead of deleting data from the chunks). The default retention period is 15 days, after which old data is deleted. Therefore, disk speed, memory allocation and retention settings impact performance.\nManaging the local storage involves configuring retention policies to control disk space usage. Prometheus offers command-line flags like --storage.tsdb.retention.time to set data retention durations, allowing automatic deletion of older data beyond the specified timeframe.\nWhen disk size is a factor, we can use the storage.tsdb.retention.size flag to limit storage size. In such case, it is advisable to set this value to 80-85% of the allocated disk space for Prometheus. This buffer ensures that older entries are removed before the disk becomes full, preventing potential data ingestion issues.\nTo address scalability and durability limitations of local storage, Prometheus provides interfaces for integrating with remote storage systems, supporting remote writes (i.e., sending ingested samples to a remote endpoint) and remote reads ​(i.e., retrieving sample data from a remote endpoint). These integrations use a snappy-compressed protocol buffer encoding over HTTP.\nGrafana Mimir is an open source, horizontally scalable, highly available, multi-tenant TSDB for long-term storage for Prometheus developed by Grafana Labs. If you have a very large installation and very long retention periods, with hundreds of thousands of active series, it is worth exploring.\nEven though Prometheus compresses samples within series by default, since we made a ZFS pool available in some of the nodes of our Proxmox cluster, named zfspool, we will be using it for the LXC prometheus1.localdomain.com to take advantage of the deduplication and compression features of ZFS.\nIn our example, the LXC prometheus1.localdomain.com has id 114. Using the console on the node where the guest resides at, we can list the pool and the subvolume where it is stored:\n# zfs list NAME USED AVAIL REFER MOUNTPOINT zfspool/subvol-114-disk-0 15.7G 34.3G 15.7G /zfspool/subvol-114-disk-0 Moreover, we can check what compression algorithm is being used:\n# zpool get feature@lz4_compress,feature@zstd_compress zfspool NAME PROPERTY VALUE SOURCE zfspool feature@lz4_compress active local zfspool feature@zstd_compress enabled local Use man zfsprops to check for the default compression algorithm.\nFinally, we can find out the achieved compression ratio:\n# zfs get compression,compressratio zfspool/subvol-114-disk-0 zfspool/subvol-114-disk-0 compressratio 2.07x - zfspool/subvol-114-disk-0 compression on inherited from zfspool Prometheus stores an average of 2 bytes per sample. Thus, to plan the capacity of the server, you can use the following formula:\nNeeded disk space = Retention time in seconds * Ingested samples per second * Bytes per sample\nTo lower the rate of ingested samples, you can either reduce the number of time series you scrape (fewer targets or fewer series per target), or you can increase the scrape interval. However, reducing the number of series is likely more effective, due to compression of samples within a series.\nMetric types # Prometheus defines four primary metric types to represent various forms of data:\nCounter: A cumulative metric that only increases or resets to zero upon restart. It is ideal for tracking quantities like the number of requests served, tasks completed or errors encountered. Counters should not be used for values that can decrease, such as memory usage.\nExample: Total number of HTTP requests received by the Prometheus server.\nprometheus_http_requests_total{handler=\u0026#34;/metrics\u0026#34;} Example: Per-second rate of HTTP requests recieved by the Prometheus server over a 1-hour window on the /metrics endpoint\nrate(prometheus_http_requests_total{handler=\u0026#34;/metrics\u0026#34;}[1h]) Gauge: Represents a single numerical value that can fluctuate up or down. It is suitable for metrics such as current memory usage, active connections, queue sizes or the number of active threads.\nExample: Current resident memory usage of the Prometheus process.\nprocess_resident_memory_bytes{job=\u0026#34;prometheus\u0026#34;} Use the Graph tab to plot memory usage as a time-series graph.\nHistogram: Samples observations (e.g., request durations or response sizes) and counts them in configurable buckets, providing a sum of all observed values. Histograms are useful for analyzing the distribution and frequency of events.\nExample: Calculate the 95th percentile request duration over a 1-hour window, meaning 95% of requests complete within the resulting ms. The le label represents the upper bounds of each histogram bucket.\nhistogram_quantile(0.95, sum(rate(prometheus_http_request_duration_seconds_bucket[1h])) by (le)) Summary: Similar to histograms, summaries sample observations but provide configurable quantiles over a sliding time window, along with the total count and sum of observations. They are beneficial for calculating precise quantiles but have limitations in aggregating across multiple instances.\nExample: Summarize the duration of garbage collection (GC) pauses in seconds of the Prometheus server. The quantiles indicate how long pauses take at different percentiles. The count of garbage collection operations (go_gc_duration_seconds_count) and the total amount of time spent (go_gc_duration_seconds_sum) on garbage collection operations are also provided.\ngo_gc_duration_seconds{job=\u0026#34;prometheus\u0026#34;} Example: Retrieve the 50th percentile (median) garbage collection pause duration in seconds:\ngo_gc_duration_seconds{job=\u0026#34;prometheus\u0026#34;, quantile=\u0026#34;0.5\u0026#34;} This means that 50% of all garbage collection pauses lasted less than or equal to the result in microseconds (µs). This gives an idea of what a “normal” pause duration looks like.\nExample: Retrieve the 90th percentile garbage collection pause duration in seconds:\ngo_gc_duration_seconds{job=\u0026#34;prometheus\u0026#34;, quantile=\u0026#34;0.5\u0026#34;} This means that 90% of gargabe collection pauses were shorter than the result in microseconds (µs). This shows if there are occasional longer pauses, which might impact performance.\nExample: Calculate the average GC duration over a 1-hour window by dividing the total sum by the count:\nrate(go_gc_duration_seconds_sum{job=\u0026#34;prometheus\u0026#34;} [1h]) / rate(go_gc_duration_seconds_count{job=\u0026#34;prometheus\u0026#34;} [1h]) Each of these metrics provides valuable insights into Prometheus’s own performance and can be adapted for monitoring other services in a Prometheus-based monitoring system. Use the PromQL prompt in the Prometheus WebGUI to execute the above examples, see the results and play with the available metrics.\nAlternative metric models # Prometheus is an observability tool (including collection, storage, and query) that uses a metric model designed to suit its own needs. It defines a metric exposition format and a remote write protocol that the community and many vendors have adopted to expose and collect metrics, becoming a de facto standard.\nHowever, two CNCF projects aim at offering vendor-agnostic, standarised alternatives models:\nOpenMetrics for the collection of metrics, which aims at being part of the IETF, and OpenTelemetry, which unifies the collection of metrics, traces, and logs to enable easier instrumentation and correlation across telemetry signals. If you are interested in the subject, take a look at the Prometheus vs. OpenTelemetry Metrics: A Complete Guide by Timescale.\nMetrics exported by the Prometheus server # Right now, the only service or system we are monitoring is the Prometheus server itself. We can get a complete list of available metrics by visiting the /metrics path of our Prometheus webserver at prometheus.publicdomain.com. In such page:​\n# HELP provides a brief description of the metric.​ # TYPE specifies the metric type (e.g., gauge, counter).​ Subsequent lines show the metric names and their current value.​ Next you will find some key Prometheus self-metrics worth monitoring. They provide insights into Prometheus performance, query execution, garbage collection, memory usage, and overall system health.\nGeneral performance:\nMetric Name Type Description prometheus_http_requests_total Counter Total number of HTTP requests received by Prometheus. prometheus_http_request_duration_seconds Histogram Latency distribution of HTTP requests handled by Prometheus. prometheus_http_response_size_bytes Histogram Size distribution of HTTP responses served by Prometheus. Query engine\nMetric Name Type Description prometheus_engine_queries Gauge Current number of queries being executed or waiting in Prometheus. prometheus_engine_queries_concurrent_max Gauge Maximum number of concurrent queries allowed in Prometheus. prometheus_engine_query_duration_seconds Summary Distribution of time taken for Prometheus to process queries, categorized by different query execution phases. Garbage collection (GC)\nMetric Name Type Description go_gc_duration_seconds Summary Duration of garbage collection pauses, measured in seconds, with quantiles for analysis. go_gc_cycles_total_gc_cycles_total Counter Total number of garbage collection cycles completed. go_gc_heap_allocs_bytes_total Counter Cumulative sum of memory allocated to the heap by the application. Memory and resource utilization\nMetric Name Type Description process_resident_memory_bytes Gauge Current resident memory usage of the Prometheus process. go_memstats_heap_alloc_bytes Gauge Current heap memory allocated and in use. go_memstats_heap_sys_bytes Gauge Total heap memory obtained from the system. Process and system information\nMetric Name Type Description process_cpu_seconds_total Counter Total user and system CPU time consumed by Prometheus in seconds. process_open_fds Gauge Current number of open file descriptors used by Prometheus. go_goroutines Gauge Number of goroutines currently running in the Prometheus process. Located at /lib/systemd/system/prometheus.service. ↩︎ ","date":"24 September 2024","externalUrl":null,"permalink":"/en/posts/grafana/prometheus/","section":"Posts","summary":"Collect and store metric data using Prometheus.","title":"Storing metric data with Prometheus","type":"posts"},{"content":"This article will lead you through the necessary steps to install the Debian GNU/Linux operating system on a dedicated server at Hetzner.\nBegin by accessing the Hetzner control panel, then navigate to the Robot control panel and, finally, the server list. Then, follow these steps:\nIdentify the server and click on the server id (e.g., EX52-NVMe #1569272) to unfold the server details and management options. Go to the Rescue tab, select your public key 1 and click on the Activate rescue button. Go to the Reset tab and select the Press power button of server radiobutton, then click the Send button. The server will be powered off. Repeat the process to power it on. Go to the Firewall tab and make sure it allows access to port 22 via the TCP protocol. Wait for a minute, then try to connect to the rescue system on port 22 using the root user and the key you selected before. We will be using InstallImage to install the operating system with a custom configuration but, first, we need to stop currently active software RAIDs and delete the current partitions to prevent possible issues during or after the installation.\nmdadm --stop /dev/md/* wipefs -fa /dev/sd* wipefs -fa /dev/nvme*n1 You can check the current configuration with the lsblk command.\nFinally, let’s install the operating system via installimage by following these steps:\nExecute the installimage command. Choose Debian. Choose the most recent Debian 11 Bullseye image name. By default, installimage will use all available disks to create a software RAID (RAID 1 if it finds two disks, RAID 5 if it finds four or more). This is fine for a server with just two NVMe disks for the OS and the local storage. However, this default configuration needs to be adapted when using a server with two disks dedicated to the OS and two or more disks dedicated to storage (e.g., a ZFS pool).\nSo, in the Midnight Commander user interface that will show next, change the level for the software RAID (SWRAIDLEVEL) from 5 to 1 and comment the hard disk drives that will not be used for the RAID of the disks dedicated to the operating system.\nThe following example is for a system with two NVMe disks for the OS and two HHD disks for the ZFS pool:\nDRIVE1 /dev/nvme0n1 DRIVE2 /dev/nvme1n1 # DRIVE3 /dev/sda # DRIVE4 /dev/sdb SWRAIDLEVEL 1 Press F10 and select Yes to save the changes. Confirm the operation and monitor progress in the console. When the process finishes, type reboot to reboot the system into the newly-installed operating system.\nOS configuration # The base installation is Hetzner’s version of Debian AMD64 includes sudo, locales, net-tools and vim-tiny. There are some extra packages worth installing (adapt to your preferences).\napt-get update apt-get install --yes ccze dnsutils htop jq nmap parted tcpdump If you are using Vim as your text editor, remove nano and vim-tiny, then install the full version of Vim.\napt-get purge --yes nano vim-tiny apt-get install --yes vim Then set vim as the system-wide default editor and as the selected editor of the root user:\nupdate-alternatives --set editor /usr/bin/vim.basic echo \u0026#39;SELECTED_EDITOR=\u0026#34;/usr/bin/vim.basic\u0026#34;\u0026#39; \u0026gt; ~/.selected_editor DNS entries # For your convenience, set up A and, optionally, AAAA entries in your publicdomain.com DNS zone so that the host can be accessed through a FQDN:\nproxmox1 IN A v4.public.ip.addr proxmox1 IN AAAA v6:public:ip:addr::2 [..] Hostname # Configure the system hostname and related settings. Hetzner keeps a list of their data centres in their webpage. Check the end result with the hostnamectl status command.\nhostnamectl set-hostname --static proxmox1 hostnamectl set-deployment \u0026#34;production\u0026#34; hostnamectl set-chassis \u0026#34;server\u0026#34; hostnamectl set-location \u0026#34;Data Center Park Falkenstein, Germany\u0026#34; Adapt the list of static DNS entries at /etc/hosts. For simplicity, we will match the node number and the last digit of the IP address.\n# IPv4 127.0.0.1 localhost.localdomain localhost 10.0.0.1 proxmox1.localdomain.com proxmox1 10.0.0.2 proxmox2.localdomain.com proxmox2 10.0.0.3 proxmox3.localdomain.com proxmox3 As we add nodes to the cluster beyond the first three ones, the list of mapped hosts in the /etc/hosts file of all nodes will have to be updated, not just on the new servers being added as nodes.\nSupport for IPv6 will be addressed in a separate series.\nLocale # Configure and generate the system-wide locale:\nlocalectl set-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 locale-gen And reboot. Check the content of the file /etc/default/locale to see which is the default locale.\nDebian packages mirror # Configure APT to use the German mirror as well as Hetzner’s by deleting the /etc/apt/sources.list.d/hetzner-security-updates.list file, then editing the /etc/apt/sources.list file.\n# Packages and security updates from the Hetzner Debian mirror deb http://mirror.hetzner.de/debian/packages bullseye main contrib non-free deb http://mirror.hetzner.de/debian/packages bullseye-updates main contrib non-free deb http://mirror.hetzner.de/debian/packages bullseye-backports main contrib non-free # Debian mirror deb http://ftp.de.debian.org/debian bullseye main contrib non-free deb http://ftp.de.debian.org/debian bullseye-updates main contrib non-free deb http://ftp.de.debian.org/debian bullseye-backports main contrib non-free # Security updates deb http://mirror.hetzner.de/debian/security bullseye-security main contrib non-free deb http://security.debian.org/debian-security bullseye-security main contrib non-free Update the packages index, then upgrade existing packages to their latest version:\napt-get update apt-get dist-upgrade Reboot.\nServer time and timezone # The Proxmox VE cluster stack relies heavily on the fact that all the nodes have precisely synchronized time. Debian uses systemd-timesyncd by default. Hetzner’s version includes three NTP servers, configured in the /etc/systemd/timesyncd.conf.d/hetzner.conf file.\nYou can check the status of the time synchronization using the timedatectl status command.\nServers should always store UTC. Local time is a presentation layer issue that only humans need to see. You can check the time zone in your server using the timedatectl status command. You can set the time zone to UTC with the timedatectl set-timezone Etc/UTC command.\nProxmox recommends using Chrony, so let’s install and configure it.\napt-get install chrony This will have removed the systemd-timesyncd automatically. Edit /etc/chrony/chrony.conf and add Hetzner’s NTP servers. Also restrict requests to the hosts local network.\npool ntp1.hetzner.de ntp2.hetzner.com ntp3.hetzner.net iburst allow 10.0.0.0/24 Restart Chrony with the systemctl restart chrony command, then check the status of time synchronisation using the chronyc sources command.\nAdjusting the real time clock # Should you need to adjust the system clock (software) and the real time clock (hardware), you can use the timedatectl command as well.\ntimedatectl set-ntp false timedatectl set-time \u0026#34;2024-09-15 09:00:45\u0026#34; timedatectl set-ntp true The date and time have to be in the time zone of the system clock (UTC). The value of the hardware clock will be updated accordingly. An alternate method is to use the hwclock and date commands.\nhwclock -r date +%Y%m%d --set \u0026#34;20240915\u0026#34; date +%T --set \u0026#34;09:00:45\u0026#34; OpenSSH # Edit the /etc/ssh/sshd_config file and make the following changes:\n# Port 22 # Listen on port 2001 for external connections ListenAddress v4.public.ip.addr:2001 # Listen to port 22 to let the Proxmox VE establish an SSH tunnel among hosts ListenAddress 10.0.0.1:22 PermitRootLogin prohibit-password PasswordAuthentication no X11Forwarding no # TCP Forwarding is required when migrating VMs AllowTcpForwarding yes AllowAgentForwarding no AuthorizedKeysFile .ssh/authorized_keys We are changing the default port 22 for the public IP address of the server and the plan is to use port 2001 for proxmox1, 2002 for proxmox2, 2003 for proxmox3, and so on. Choose whatever ports you fancy the most.\nProxmox requires that the node is listening on port 22 on the internal IP address of the node, hence the second ListenAddress directive.\nFinally, TCP forwarding is required to migrate VMs. The rest is just disabling what is not needed and restricting access.\nCheck for syntax errors with sshd -t before restarting the service with the systemctl restart sshd command. Afterwards, check that the sshd daemon is now listening at the port of your choice.\nnetstat --program -all --numeric | grep --word-regexp LISTEN Optionally, add the host to the .ssh/config file in your computer.\n# Keep connections alive Host * ServerAliveInterval 60 ServerAliveCountMax 2 ControlMaster auto ControlPath /tmp/%r@%h:%p TCPKeepAlive yes Host proxmox1 ControlMaster auto User devops Hostname proxmox1.publicdomain.com Port 2001 IdentityFile ~/.ssh/devops Host proxmox2 ControlMaster auto User devops Hostname proxmox2.publicdomain.com Port 2002 IdentityFile ~/.ssh/devops Host proxmox3 ControlMaster auto User devops Hostname proxmox3.publicdomain.com Port 2003 IdentityFile ~/.ssh/devops The devops user will be created later in this article.\nCheck that you can connect to the server via SSH on port 2001 before exiting the current session on the default port. Adjust Hetzner’s firewall rules.\nFail2Ban on OpenSSH # Fail2Ban offers protection against brute force attacks by banning hosts that cause multiple authentication errors. This prevents the attacker from trying out a large password list in a short time.\nAs of version 7.4 of Proxmox VE, its kernel uses iptables, which is used by Fail2Ban by default 2.\nInstall Fail2ban and enable the systemd service:\napt-get install fail2ban systemctl enable fail2ban Create a local configuration file /etc/fail2ban/jail.local with the following content, adjusting the port and the rest of parametres to your needs:\n[DEFAULT] # A list of IP addresses, CIDR masks or DNS hosts that Fail2ban will not ban ignoreip = 127.0.0.1/8 ::1 # The number of seconds that a host is banned bantime = 1d # The number of failures before a host get banned maxretry = 5 # A host is banned if it has generated \u0026#34;maxretry\u0026#34; during the last \u0026#34;findtime\u0026#34; findtime = 1h [sshd] # As per /etc/ssh/sshd_config port configuration port = 2001 [pam-generic] # Default values of pam-generic already use the default backend, # but we need to enable the jail enabled = yes SSH is the only service that is enabled by default, which can be checked at the /etc/fail2ban/jail.d/defaults-debian.conf file:\n[sshd] enabled = true Restart the service to apply the changes, then check it is active over the sshd daemon using the fail2ban-client tool:\nsystemctl restart fail2ban fail2ban-client status sshd Electronic mail # Proxmox uses email to send alarms and notifications, so the proxmox-ve package has postfix as a dependency. Postfix is a hugely-popular MTA designed to determine routes and send emails.\nThe most sensitive and practical way to organise system email delivery in all your hosts and guests is to use a relay host, i.e., applications will use the Postfix in the localhost and it will use a relayhost to deliver the email. In practice, this means that no email is delivered locally, but relayed, hence the term. A relay host is also known as a smart host or a relay server. This structure is known as a satellite system.\nPostfix daemons in the nodes of the cluster will use the relay host of your email service provider, e.g., Zoho Mail, Proton Mail, and so on. To match this pattern, it would be recommended for Postfix daemons in the guests to use an internal relay host, such as Proxmox Mail Gateway, which will then relay the e-mails via your e-mail service provider as well.\nInstall Postfix via APT:\napt-get install mailutils postfix Configure it as a satellite system. You will need to check the documentation of your e-mail service provider to complete this process. If you do not want to go through this right now, configure Postfix as local only and leave the system mail name as is (e.g., proxmox1.publicdomain.com). You can later change the configuration via the dpkg-reconfigure postfix command.\nParametre Value Mail server configuration type Satellite system System mail name proxmox1.publicdomain.com SMTP relay host relayhost.mailprovider.com Root and postmaster mail recipient root Other destinations to accept mail for proxmox1.publicdomain.com, localhost Force synchronous updates on mail queue? No Local networks 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 Mailbox size limit (bytes) 0 Local address extension character + Internet protocols to use all Edit the file /etc/aliases to properly map aliases to local user accounts and external email addresses.\npostmaster: root admin: root debian: root root: [email protected] You need to run the newaliases command every time you change that file. Moreover, you will need to create the postmaster account or alias in your e-mail service provider control panel.\nTo test that the email sent by the node is reaching its destination, we can use the mail command from the mailutils package:\nmail --subject=\u0026#34;Test from $(hostname)\u0026#34; --append=\u0026#34;From: \u0026lt;root@$(hostname -f)\u0026gt;\u0026#34; root@$(hostname -f) \u0026lt;\u0026lt;\u0026lt; \u0026#34;This is a test message from $(hostname -f) using the mail command.\u0026#34; By default, all nodes send notifications via email using the root@$hostname address.\nRepeat the process in all the nodes of the cluster, as you install and configure them.\nNon-root user # You may want to create a normal user and add it to the sudo group for your daily maintenance routine. If so, first create a SSH key in your personal computer.\nssh-keygen -t ed25519 -a 100 -q -f ~/.ssh/devops -N \u0026#39;\u0026#39; -C \u0026#34;Proxmox VE DevOps\u0026#34; Then, create the user in the server and set a password for it.\nuseradd --comment \u0026#34;DevOps User\u0026#34; --home /home/devops --create-home --shell /bin/bash --no-user-group --gid adm --groups sudo devops passwd devops Finally, add the key to the user and test connectivity and permissions.\nsu - devops mkdir --mode=0700 ~/.ssh echo \u0026#34;ssh-rsa \u0026lt;your \u0026#39;~/.ssh/devops.pub\u0026#39; key\u0026gt; devops@hostname\u0026#34; \u0026gt; ~/.ssh/authorized_keys Make sure that you can acess through SSH with your usual key and that you can use sudo.\nPublic keys can be added via the Key management tab of the Robot control panel. ↩︎\nSupport for nftables landed with Proxmox VE 8.2 as an opt-in technology preview. ↩︎\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/operating-system/","section":"Posts","summary":"Install and configure the Debian OS on a dedicated server using the tools provided by Hetzner","title":"Debian OS installation and configuration on Hetzner","type":"posts"},{"content":"In previous articles of this series we have seen how to set up an NFS server on a VM on Proxmox, and how to extend the disks used by that VM. For that, we used default values for the block sizes of the different layers involved in the I/O operations, which are:\nA ZFS storage pool made of two HDD in mirror mode, with ashift=12 (4096 bytes). A ZFS volume (ZVOL) for our data disk, with volblocksize=8K. An XFS filesystem on the data disk of the VM, with data.bsize=4096. In this article we will focus on the block sizes of the different layers involved in the I/O operations of our NFS server.\nGenerally speaking, the easiest way to improve performance, minimise fragmentation, and make the most of our disk’s physical layout is:\nTo align the physical sector size of our disk with the block size of our ZFS storage pool. To align the block sizes of the ZVOL and the filesystem inside the VM. For that, we need to gather relevant statistics that allow us to make informed decisions.\nZFS ARC caching can affect the observed I/O patterns, especially for read workloads.\nCurrent situation # If you followed the steps described in the NFS server on Proxmox VE article in this series, using Debian 12 Bookworm, at the moment you ought to have the following sector and block sizes:\nLayer Option name Value Command Physical sector size PHY-SEC 4096 lsblk -o NAME,SIZE,PHY-SEC,LOG-SEC ZFS storage pool ashift 121 `zdb -C zfspool ZVOL volblocksize 8K zfs get volblocksize zfspool/vm-104-disk-0 XFS data.bsize 4096 xfs_info /dev/sdc Default values of ashift and volblocksize may differ depending on your hardware, the version of Proxmox you are using, and the version of ZFS it ships with. For instance, ZFS version 2.2 brings in a new default block size of 16K.\nMost modern SSDs, particularly enterprise-grade ones, use 8KB logical sectors.\nWhile the table above shows a disparity in the block size of our ZVOL, this is fine for most use cases. Furthermore, the specifics of each filesytem need to be considered in the equation. In the case of the ZVOL, setting volblocksize down to 4K most probably would not make it perform better because ZFS operates a lot of metadata, therefore the data-to-metadata ratio would be worse.\nZFS does not mix metadata and file data in the same volblocksize block, so metadata always incurs its own overhead, no matter how small the file is.\nFor example, with ashift=12 (i.e., 4K sector alignment) and the default redundant_metadata=all, ZFS writes two copies of metadata for redundancy. If the ZVOL has a volblocksize=8K, writing 8K of user data results in 1 × 8K data block and 2 × 4K metadata blocks (each redundant), for a total of 16K written.\nHowever, if volblocksize=4K, writing the same 8K of user data as two separate 4K writes results in 2 × 4K data blocks and 4 × 4K metadata blocks (2 per data block, due to redundancy), for a total of 24K written.\nZFS storage pool # This terminology is used to describe the grouping of storage devices (HDD, SSD, etc.) into a single logical unit using the ZFS file system.\nThe ashift parametre controls the minimum block size ZFS will use for physical I/O on disk. Our HDD has a physical sector size of 4096 bytes, thus setting ashift=12 (4096 bytes) is fine.\nHowever, using ashift=13 (8192 bytes) can still be a good idea when working with workloads with larger I/O (like our NFS server), which can benefit from the reduced metadata overhead and fewer IOPS required.\nRegarding the value of ashift used when creating a ZFS pool, Proxmox offers a recommended value on the WebGUI which depends on the logical sector size of the disks. A general guideline would be:\nashift=9 for older HDD disks with 512-byte sectors. ashift=12 for newer HDD disks with 4KB sectors. ashift=13 for SSD disks with 8KB sectors. Once a ZFS vdev is created with a specific ashift value, it cannot be changed.\nWrite amplification # Write amplification in ZFS refers to the phenomenon where the file system ends up writing more data to the storage device than the amount of data originally intended to be written by the user or application.\n$$ \\\\text{Write amplification} = \\\\frac{\\\\text{Physical bytes written to storage}}{\\\\text{Logical bytes written by the application}} $$ This can happen because ZFS is a copy-on-write (COW) file system and uses a larger record size than the data being written, requiring it to rewrite larger blocks even when only a small portion of the data needs to be changed.\nBut how does write amplification happen? Suppose our NFS server performs plenty of 8K writes at a time and our ZFS pool has ashift=12 (4K). Then, ZFS tries to write 2 × 4K blocks (to match 8K) but, due to misalignment or COW, it might read-modify-write more 4K blocks than needed, leading to write amplification.\nIf ashift=13 (8K), then ZFS treats each 8K write as one atomic block. This leads to better alignment with our I/O patterns (writing 8K at a time), less overhead, less fragmentation, and less metadata churn.\nTherefore, even though our HDD disk sectors are 4K, aligning ZFS to 8K avoids extra work when the application’s write size exceeds 4K.\nIn conclusion, if we observe, or predict, I/O patterns happening mostly in the range of 8K-16K, we are better off creating our ZFS storage pool with an ashift value of 13 instead of the default 12 offered by the WebGUI.\nMeasuring # Choosing a bigger block size when formatting a filesystem can offer a performance sweet spot for workloads that commonly read or write in chunks larger than the standard 4K.\nHowever, as with any optimisation, the effectiveness of using 8K+ blocks ultimately depends on the typical request sizes and access patterns in your environment, and the specifics of the filesystem. So, how do we figure it out?\nWe are mostly interested in historical I/O stats, not real time. And because we have different layers involved, we need to measure at each level.\nAt the host level # Using the terminal at the host (the Proxmox node), we can observe logical and physical I/O stats of our ZFS storage pool, including metadata and ZFS overhead (checksumming, compression, etc.) of all ZVOLs and datasets underneath.\nTo see logical I/O stats, we can use the zpool iostat command from the zfsutils-linux package. The output table shows the average request size, including ZFS metadata overhead (not just raw application reads/writes), since boot.\nzpool iostat -r zfspool Although not essential in calculating the right volblocksize of our ZVOL, it is convenient to understand the suffixes and prefixes being used in the output table.\nRegarding the ind and agg suffixes:\nSuffix Short for Meaning Example ind Individual Average size of each I/O sync_read_ind tells the average size of each synchronous read agg Aggregate Total bytes per second sync_read_agg is the total bandwidth of synchronous reads per second And regarding the sync and async prefixes.\nType Meaning Use case or trigger Sync read App waits until data is fetched from disk O_DIRECT, explicit fsync, or uncached reads Async read OS can prefetch or return from cache Normal file reads, when data is in memory Sync write Data must be committed to stable storage before returning Database commits, fsync(), fdatasync() Async write OS acknowledges write before data hits disk Normal buffered writes Example output of a ZFS storage pool made of two HDD in mirror mode that was created using ashift=13 (for simplicity, and because trimming is not enabled, the last four columns have been cut out):\n# zpool iostat -r zfspool zfspool sync_read sync_write async_read async_write req_size ind agg ind agg ind agg ind agg ---------- ----- ----- ----- ----- ----- ----- ----- ----- 512 0 0 0 0 0 0 0 0 1K 0 0 0 0 0 0 0 0 2K 0 0 0 0 0 0 0 0 4K 1.87M 0 3.91M 0 217K 0 23.7M 0 8K 54.1M 15.7K 8.99M 0 11.6M 19.8K 17.5M 9.74M 16K 30.5K 396K 2.71M 0 5.06K 602K 948K 8.85M 32K 329K 539K 616K 5 193K 913K 1.64M 5.59M 64K 2.45K 633K 669K 6 1.67K 1.05M 281K 3.57M 128K 221 173K 4.35M 46.2K 621 957K 5.71K 3.82M 256K 0 157K 0 74.8K 0 613K 0 4.16M 512K 0 281K 0 105K 0 648K 0 2.09M 1M 0 280K 0 1.28M 0 671K 0 2.05K 2M 0 0 0 0 0 0 0 0 4M 0 0 0 0 0 0 0 0 8M 0 0 0 0 0 0 0 0 16M 0 0 0 0 0 0 0 0 ------------------------------------------------------------------ These show counts of I/O operations categorised by I/O size and type (sync/async read/write, scrub and trim). The suffixes K and M represent kilo and mega, in base 1024.\nIn addition to zpool iostat, given that the ZVOL is exposed as a block device, we can also use iostat, from the sysstat package, to observe physical I/O statistics in real time:\niostat -xd /dev/zvol/zfspool/vm-104-disk-0 This tool shows kernel block-level I/O to the ZVOL device. Since our ZVOL is used by a VM, this shows how the host handles actual I/O coming from the guest. Relevant columns:\nColumn Description Units rareq-sz Read average request size kB wareq-sz Write average request size kB dareq-sz Average discard request size kB f_await Flush request average wait time ms ZFS stores data in recordsize chunks for filesystems and volblocksize for ZVOLs. When guest I/O sizes mismatch volblocksize, ZFS must read-modify-write the full block, hurting performance.\nIf rareq-sz and wareq-sz are much smaller than the volblocksize of our ZVOL, meaning that the VM is issuing small reads/writes, this could increase IOPS load on the pool, result in write amplification and undermine compression and coalescing.\nHowever, if rareq-sz and wareq-sz are much larger than the volblocksize of our ZVOL, meaning that the VM is issuing large read/writes, this would lead to efficient I/O ops, which is good. Larger I/O operations are more efficient and tend to align better with ZFS’s recordsize (defaults to 128K). Also, they allow ZFS to compress or dedup data more effectively and reduce write amplification on underlying disks.\n# zfs get recordsize zfspool NAME PROPERTY VALUE SOURCE zfspool recordsize 128K default Additionally, high f_await can mean that the VM (our NFS server) is using fsync() often, and that our pool is not optimised for synchronous writes, e.g., no Separate LOG (SLOG) device, on a fast NVMe or SSD. This can point to synchronisation bottlenecks.\nExample output of the same ZFS storage pool as before (for simplicity, only the four columns mentioned above are included):\n# iostat -xd /dev/zvol/zfspool/vm-104-disk-0 Device rareq-sz wareq-sz dareq-sz f_await zd16 126.40 277.94 1048576.00 0.00 ZFS stores metadata alongside data, and this overhead is more noticeable when block sizes are small or when fragmentation occurs.\nAt the guest level # Next, we need to get closer to the actual workload and its I/O patterns, so we need to measure from within the VM. For that, we can use iostat for real-time measuring, and sar for historical data, both in the sysstat package.\nLet’s start by using iostat for real-time statistics with average request size:\niostat -xd /dev/sdc Relevant columns:\nColumn Description Units rareq-sz Read average request size kB wareq-sz Write average request size kB dareq-sz Average discard request size2 kB f_await Flush request average wait time3 ms For historical data, we need to enable sar. Start by editing the /etc/default/sysstat configuration file:\nENABLED=\u0026#34;true\u0026#34; And continue by enabling and starting the systemd timer:\nsystemctl enable sysstat systemctl start sysstat The daily files (saXX) will start populating (the number matches the day of the month):\nls -lh /var/log/sysstat/ The sysstat-collect.timer timer runs every 10 minutes, whereas the sysstat-summary.timer runs once a day. Let some time go by, then see the results using the sar command:\nsar -d --dev=sdc If you want to check a particular day, use the following command:\nsar -d --dev=sdc -f /var/log/sysstat/saXX You will notice that the default behaviour is to display a list of intervals and a last line with the average. Should you be intersted in a particular moment in time, you can filter the intervals:\nsar -d --dev=sdc -s 00:00:00 -e 23:59:59 In the long run, we are mostly interested in the average.\nRelevant columns:\nColumn Description Units tps Transfers per second4 rkB/s Read throughput kB/s wkB/s Write throughput kB/s dkB/s Kilobytes discarded5 kB/s areq-sz Average request size kB await Average wait time6 ms %util Device utilization7 % Throughtput is useful for understanding workload volume, in context with request size.\nIf most requests are 8 KB or larger, it may make sense to align volblocksize and filesystem block size to 8K or more, which reduces write amplification and fragmentation. Conversely, too small blocks increase metadata and IOPS load.\nExample output under heavy load:\n# sar -d --dev=sdc -s 07:30:00 -e 08:50:00 -f /var/log/sysstat/sa24 07:30:13 AM DEV tps rkB/s wkB/s dkB/s areq-sz await %util 07:40:13 AM sdc 424.57 52524.58 0.00 0.00 123.71 1.82 75.24 07:50:13 AM sdc 509.13 85059.57 0.00 0.00 167.07 2.15 94.17 08:00:13 AM sdc 758.21 76511.56 0.00 0.00 100.91 1.39 90.90 08:10:13 AM sdc 508.45 63185.16 0.00 0.00 124.27 1.61 80.03 08:20:13 AM sdc 290.09 63357.08 0.00 0.00 218.40 1.69 43.41 08:30:07 AM sdc 622.21 61181.33 0.00 0.00 98.33 0.85 47.76 08:40:13 AM sdc 161.86 31132.86 0.00 0.00 192.35 1.81 25.46 Average: sdc 467.13 61807.10 0.00 0.00 132.31 1.54 65.25 Mapping metrics # A number of metrics can be taken into consideration when tuning block sizes, but these are the most relevant ones:\nMetric Why it matters HDD SSD Notes Average request size Helps choose optimal block size at filesystem and ZVOL layers Yes Yes Crucial for both, as mismatched sizes reduce throughput or increase latency IOPS vs bandwidth Small, random I/O favours smaller blocks; sequential workloads benefit from large blocks Yes Yes SSDs can handle much higher IOPS than HDDs, but pattern still matters CPU usage Larger blocks may reduce CPU load per byte transferred. Yes Yes Larger I/O sizes reduce syscalls and context switches, benefiting both Write amplification High when block sizes are misaligned No Yes Critical for SSDs (due to erase/write cycles) Fragmentation Smaller blocks reduce internal fragmentation, but increase metadata overhead Yes No HDDs suffer more from fragmentation; SSDs less so but metadata load increases Let’s try to map these metrics to the output provided by sar and zpool iostat.\nAverage request size # Average request size is the mean amount of data read or written per I/O operation, typically calculated as total bytes transferred divided by IOPS.\nTool Columns Units Notes sar areq-sz kB Combined average request size Rule of thumb: To estimate a good ZVOL volblocksize, find a typical average request size from these and align it, e.g., if it is consistently ~16K, set volblocksize accordingly.\nIOPS vs bandwidth # Input/Output Operations Per Second (IOPS) measures how many read/write actions happen per second, while bandwidth refers to the total amount of data transferred per second (MB/s).\nTool Columns Units Notes sar tps ops/s Total I/O operations sar rkB/s, wkB/s kB/s Total bandwidth zpool iostat r/s, w/s ops/s Total I/O operations at ZFS layer zpool iostat rbytes/s, wbytes/s kB/s Total bandwidth at ZFS layer We will use these to infer the type of workload:\nObservation Interpretation Implication High IOPS, low bandwidth Many small ops (e.g., 4K, 8K), probably random I/O Tuning for low latency matters more than throughput; small block size might be appropriate Low IOPS, high bandwidth Fewer, large ops (e.g., 128K, 256K) Good for sequential I/O, maybe increase block size for efficiency CPU usage per byte transferred # CPU usage per byte transferred is the amount of CPU time or percentage consumed for each byte of data moved to or from disk, reflecting efficiency of I/O handling.\nWe cannot measure CPU per byte directly in sar, but we can infer:\n$$ \\\\text{CPU usage per MB} = \\\\frac{\\\\text{\\\\%CPU used}}{\\\\text{MB transferred}} $$ On the one hand, sar -u provides information about CPU utilisation.\nColumn Meaning %user Time spent running processes in user space (non-kernel code) %nice Time spent on user-level processes with a positive nice value %system Time spent running kernel processes %iowait Time the CPU was idle waiting for I/O (disk/network) %steal Time stolen by the hypervisor for other VMs (only in virtualized setups) %idle Time the CPU was completely idle %user + %system reflects the NFS server demand, while %iowait reflects disk latency.\nLet’s calculate %CPU used:\n$$ \\\\text{\\\\%CPU used} = 100 - \\\\text{\\\\%idle} $$ Let’s say we have the following data from our sar -u command:\n# sar -u --dev=sdd -s 07:30:00 -e 08:50:00 -f /var/log/sysstat/sa24 07:30:13 AM CPU %user %nice %system %iowait %steal %idle 07:40:13 AM all 1.07 0.00 1.05 18.59 0.00 79.28 07:50:13 AM all 1.25 0.00 0.88 22.95 0.00 74.92 08:00:13 AM all 1.17 0.00 0.96 22.13 0.00 75.74 08:10:13 AM all 2.13 0.00 1.34 19.26 0.01 77.26 08:20:13 AM all 4.44 0.00 2.72 7.91 0.01 84.92 08:30:07 AM all 4.22 0.00 2.65 9.44 0.01 83.68 08:40:13 AM all 2.17 0.00 1.34 4.77 0.01 91.71 Average: all 2.34 0.00 1.56 15.02 0.01 81.07 Then, we would have:\n$$ \\\\text{\\\\%CPU used} = 100 - 81.07 = \\\\text{18.93\\\\%} $$ If you are more interested in application CPU usage, you can sum %user and %system:\n$$ \\\\text{\\\\%CPU (user + system)} = 2.34 + 1.56 = \\\\text{3.90\\\\%} $$ This excludes I/O wait time, which represents time the CPU is idle waiting for I/O. So, high %iowait is not usage by the NFS server, but rather a sign of storage bottleneck.\nOn the other hand, our previous use of sar -d provided us with the necessary disk I/O statistics to calculate MB transferred:\n$$ \\\\text{CPU\\\\ usage\\\\ per\\\\ MB} = \\\\frac{100 - \\\\text{\\\\%idle}}{(\\\\text{rkB/s} + \\\\text{wkB/s} + \\\\text{dkB/s}) / 1024} $$ Then, we would have:\n$$ \\\\text{MB transferred} = \\\\frac{61807.10 + 0.00 + 0.00}{1024} ≈ \\\\text{60.36 MB/s} $$ So, the CPU usage per MB would be:\n$$ \\\\text{CPU usage per MB} = \\\\frac{18.93}{60.36} = \\\\text{0.31 CPU cores per MB/s} $$ This means the device used 31% of one CPU core to transfer 1 MB per second on average. In other words, for each 1 MB/s of throughput, the device consumes 31% of a CPU core. If we do the same calculations using the application CPU usage mentioned above, we get that the device consumes 7% of a CPU core for each 1 MB/s of throughput.\nThis difference means that the NFS server is not taking more CPU because it is blocked on slow disk I/O, not because the stack is inefficient.\nRule of thumb: Try using a bigger volblocksize in the ZVOL and a bigger ashift in the ZFS storage pool and see if that reduces the amount of CPU usage per MB/s.\nInterpretation # On the one hand, the areq-sz colum on sar tells us that our guest is issuing I/O requests that average 132.31 kB on a ZVOL with block size of 8K. This means each guest I/O is split across multiple 8K ZVOL blocks.\nOn the other, the block distribution displayed by zpool iostat tells us that most of the I/O requests happen at 8K and 16K, which includes our ZVOL and others in the same node, and a fairly big number happen between 128K and 1M, probably because of ZFS ARC and transaction group aggregation.\nMetadata overhead scales with the number of blocks, not their size.\nTherefore, should we increase the volblocksize of our ZVOL to 16K to get fewer IOPS, reduce metadata overhead and write amplification, and better align it with actual guest workload sizes? It seems likely beneficial given these I/O patterns but, as always, it is about trade-offs.\nRule of thumb:\nIf average request size \u0026gt; 2× volblocksize, increase volblocksize. If 80%+ of writes are \u0026gt; volblocksize, also increase it. Match volblocksize to XFS block size. Prefer 8K+ blocks for large sequential workloads, NFS/VM image storage and reduced metadata overhead. Keep volblocksize ≤ 16K unless workload has clear benefit (snapshots cost more at higher values). Database workloads often benefit from smaller block sizes (4K-8K) for better random I/O performance, while large sequential workloads (like media files) benefit from larger blocks (16K-128K).\nI/O size mismatch # When the typical I/O size from the guest (areq-sz) does not align well with the ZVOL’s volblocksize, two key problems arise: internal fragmentation and write amplification.\nInternal framentation is wasted space inside blocks. For example, if your volblocksize is 64K but most writes (areq-sz) are 8K, each write may waste up to 56K, depending on the filesystem layout and how blocks are reused. Therefore, we want to match request size to block size as much as possible to avoid unused padding.\nThe guest OS never sees this waste, but ZFS tracks and allocates the full block size, so pool space fills up faster than expected.\nWrite amplification happens when one guest write results in multiple writes at the underlying storage layer. This occurs when:\nGuest writes are smaller than volblocksize. Copy-on-write forces read-modify-write cycles. Metadata, padding, and block pointer overhead add extra writes. Traditional write amplification refers to how many bytes are written to disk per logical byte written by the application. We will not be calculating exactly that, but rather a simplified version based on allocated size and logical used space, which we will call storage amplification.\nIn ZFS, even with compression, small writes incur overhead due to block size alignment and COW. When using synchronous writes, amplification can get worse unless a fast SLOG is available.\nMatching areq-sz and volblocksize, and using appropriate compression and sync settings, helps reduce both fragmentation and amplification.\nWorkload block size # To determine the workload block size, we can use the zpool iostat command to see how ZFS handles writes.\nTool Column Units Notes zpool iostat writes ops Number of logical write operations issued to ZFS zpool iostat nwritten bytes Amount of data written by ZFS in bytes We can extract the following details:\nwrites shows how many write operations the workload made. nwritten is what ZFS actually pushes to disk. nwritten/writes gives the average write size per operation (the workload block size). Rule of thumb: What indicates the need for a larger block size? You compare nwritten/writes (the workload block size) to your volblocksize and:\nIf your workload is writing 128K per operations, but your volblocksize is 4K, ZFS will break it into many chunks, leading to overhead, more metadata, and more IOPS. If ZFS writes (nwritten) are significantly smaller or larger than the workload size, there is a mismatch, leading to write amplification or underutilization, respectively. Allocated size # Allocated size (asize) represents the actual number of on-disk bytes that a block occupies after compression, padding and metadata, aligned to the ashift (minimum sector size).\n$$ \\\\text{Allocated size} = \\\\left\\\\lceil \\\\frac {\\\\text{logical size}} {\\\\text{compression ratio}} \\\\right\\\\rceil + \\\\text{padding} + \\\\text{metadata} $$ So, asize represents the true cost on the physical disks and will always greater than or equal to the compressed size. It is called allocated size because ZFS allocates in units of ashift (e.g., 8K if ashift=13), even if the actual data is smaller.\nThis will allow us to calculate the amplification, which is the number we care about when deciding if our current block size is too small.\n$$ \\\\text{Storage amplification} = \\\\frac{\\\\text{actual allocated size}}{\\\\text{logical used}} $$ We will gather part of the necessary data to calculate asize via the zfs get command:\nzfs get used,logicalused,compressratio zfspool/vm-104-disk-0 Example output:\n# zfs get used,logicalused,compressratio zfspool/vm-104-disk-0 NAME PROPERTY VALUE SOURCE zfspool/vm-104-disk-0 used 670G - zfspool/vm-104-disk-0 logicalused 499G - zfspool/vm-104-disk-0 compressratio 1.01x - Property Meaning used Total provisioned space for the ZVOL (entire virtual disk size) logicalused Bytes actually written from the VM to the ZVOL device compressratio The ratio of logical data size to physical storage space used after compression A compressratio of 2.0x would mean that for every 2 bytes of logical data, ZFS would be using only 1 byte of physical storage.\nEstimating # ZFS does not show actual allocated size per ZVOL directly, but we can try to estimate it using zdb:\nzdb -dddd zfspool/vm-104-disk-0 The output of that command shows us three objects:\nObject ID Type Purpose 0 DMU dnode Root directory object 1 zvol object The actual data blocks 2 zvol prop Dataset properties We want to focus on object 1, which is our virtual disk content. Example output of object 1:\nObject lvl iblk dblk dsize dnsize lsize %full type 1 4 128K 8K 495G 512 600G 82.78 zvol object Relevant columns:\nField Meaning lsize Logical size, i.e., what the guest wrote dsize Physical space used, including all overhead8 %full How much of this dataset is written Example output of our ZVOL object with volblocksize of 8K:\n# zdb -dddd zfspool/vm-104-disk-0 | awk \u0026#39;/zvol object/ {print \u0026#34;dsize=\u0026#34; $5, \u0026#34;lsize=\u0026#34; $7}\u0026#39; dsize=495G lsize=600G We can now calculate the storage amplification (or allocation efficiency):\n$ \\text{Storage amplification} = \\frac{\\text{dsize}}{\\text{lsize}} = \\frac{495}{600} \\approx 0.825 $$\nThis shows ZFS stores only 82.5% of the logical size on disk, thanks to compression and efficient block use. A few notes worth mentioning in regards to the storage amplification threshold:\nValues below 0.7 indicate very good compression, but may also suggest that the workload is not writing enough data to fill the blocks efficiently. Values of 0.7-0.9 indicate good compression and efficient block use. Values of 1.1-1.5 suggest block size mismatch. Values above indicate serious inefficiency. In our example, the slight space savings align with the low compression ratio shown by zfs get compressratio, which reported 1.01x.\nIt is normal that the space reported by df inside the VM is larger than logicalused, because df includes filesystem metadata, while logicalused counts raw writes to the block device.\nRule of thumb: If storage amplification is greater than 1.0, ZFS is using more space than it receives from the guest. This usually means:\nThe volblocksize is too small for the workload’s typical request size. ZFS is doing read-modify-write due to misaligned or sync-heavy writes. Metadata or COW overhead is significant. In such cases, consider increasing the ZVOL’s volblocksize, ensuring alignment with the guest filesystem, and evaluating whether compression is needed for the workload.\n2¹² = 4096 bytes. ↩︎\nLarge discard sizes might suggest benefit from larger block sizes, but they do not usually dominate performance. ↩︎\nTells you how long it takes to flush buffers, but not how big the data chunks are. ↩︎\nAn I/O request to a physical device. Multiple logical requests can be combined into a single I/O request. ↩︎\nDue to TRIM/UNMAP operations. Often 0 unless on SSDs with discard enabled. ↩︎\nHigh latency may suggest mismatch in I/O size vs block size. ↩︎\nNear 100% could mean saturation. Optimizing block size may help. ↩︎\nOverhead includes metadata, checksums and padding. ↩︎\n","date":"19 July 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/nfs/block-sizes/","section":"Posts","summary":"Get I/O statistics and decide the most convenient block size for your NFS server on a VM on Proxmox","title":"Aligning block sizes of VM disks on Proxmox","type":"posts"},{"content":"Unlike SQL, that tends to be more imperative (SELECT ... FROM ...), the Prometheus Query Language is a nested functional language. That means that you describe the data you are looking for as a nested set of expressions that each evaluate (without side effects) to an intermediary value. Each intermediary value is used as an argument or operand of the expressions surrounding it, while the outer-most expression of your query represents the final return value that you get to see in a table, graph, or similar use case.\nData model # The data model of Prometheus is simple: it stores numeric time series. Each time series has an identity (its metric name and a unique set of key=\u0026quot;value\u0026quot; label pairs that create dimensionality within that metric name) and a resulting set of samples. Each sample has a 64-bit integer (UNIX timestamp in milliseconds) and a 64-bit float sample value (even if it just contains an integer value).\nTo illustrate this, let’s take the following query as an example:\nprometheus_http_requests_total{code=\u0026#34;200\u0026#34;, handler=\u0026#34;/metrics\u0026#34;} → [@1743324977 → 15469, @1743324992 → 15470] In this visual representation of one series we can identify the following parts:\nName Component Time series identifier prometheus_http_requests_total{code=\u0026quot;200\u0026quot;, handler=\u0026quot;/metrics\u0026quot;} Metric name prometheus_http_requests_total Labels code=\u0026quot;200\u0026quot;, handler=\u0026quot;/metrics\u0026quot; Label names code, handler Label values 200, /metrics Samples [@1743324977 → 15469, @1743324992 → 15470] In queries, we either want to select the latest sample of a set of series at a given query step, or a historical range of samples to aggregate over in some way.\nAnatomy of a query # Let’s take the following query as an example:\nhistogram_quantile(0.5, sum by(le, handler) ( rate( prometheus_http_request_duration_seconds_bucket{ job=\u0026#34;prometheus\u0026#34; } [1h] ) ) ) In this example, from the inside out:\nprometheus_http_request_duration_seconds_bucket{job=\u0026quot;prometheus\u0026quot;}[1h] selects the histogram bucket time series1 for request durations of the available handlers over the last 1 hour. rate(... [1h]) computes the per-second rate of increase of observations in each bucket over the last 1 hour. Since histogram buckets are implemented as cumulative counters, rate() is needed to determine how frequently requests fall into each duration bucket. sum by(le, handler) (...) aggregates the per-second rate of observations per bucket (le2) and per HTTP verb (handler). This ensures that the histogram remains grouped by handler while summing rates across multiple instances, if applicable. histogram_quantile(0.5, ...) computes the 0.5 quantile using the aggregated histogram. The function interpolates an approximate quantile value based on the rate-distributed histogram data. Note: The φ-quantile is the observation value that ranks at number φ × N among the N observations. The 0.5-quantile is known as the median. The 0.90-quantile is the 90th percentile.\nA PromQL expression is not just the entire query, but any nested part of a query that you could run as a query by itself.\nTyped expressions # There are two types to be considered:\nThe type of a metric, as reported by a scraped target: counter, gauge, histogram, summary, or untyped. The type of a expression: string, scalar, instant vector, or range vector. PromQL only takes into consideration expression types. Each expression has a type and each function and operator requires its arguments to be of certain expression type.\nExample functions, in alphabetic order, grouped by argument type:\nFunction Argument type Evaluates to Description avg_over_time() Range vector Instant vector Calculates average over time range count_over_time() Range vector Instant vector Counts samples over time range rate() Range vector Instant vector Calculates per-second average rate of increase histogram_quantile() Instant vector Instant vector Calculates quantiles from histogram buckets sort() Instant vector Instant vector Sorts vector elements by value (ascending) sum() Instant vector Instant vector Adds all values in the vector clamp_max() Instant vector, Scalar Instant vector Limits vector values to maximum vector() Scalar Instant vector Converts scalar to single-element vector Example operators, in no particular order:\nOperator Argument type Evaluates to Description + Instant vector, scalar Instant vector Adds scalar to each vector element and Instant vector, instant vector Instant vector Returns elements that exist in both vectors % Scalar, Scalar Scalar Modulo operation on scalars \u0026gt; Instant vector, Scalar Instant vector Returns elements greater than scalar == Instant vector, Instant vector Instant vector Returns elements with equal values In short:\nScalars are single numeric values. Instant vectors are sets of time series with a single sample at the current time Range vectors are sets of time series with multiple samples over a specified time window String values appear in PromQL in two main contexts:\nAs label values in time series, e.g., {code=\u0026quot;200\u0026quot;, handler=\u0026quot;/metrics\u0026quot;}, or in label matchers, e.g., prometheus_http_requests_total{handler=~\u0026quot;^/api.*\u0026quot;}. As arguments to certain functions, e.g. label_replace(up, \u0026quot;host\u0026quot;, \u0026quot;$1\u0026quot;, \u0026quot;instance\u0026quot;, \u0026quot;(.*):.*\u0026quot;). Example queries # Examples of queries returning scalar values:\nType Example query Example value Scalar prometheus_http_requests_total{handler=\u0026quot;/metrics\u0026quot;} 11812 Scalar prometheus_tsdb_data_replay_duration_seconds 2.198086471 Exmaple query returning an instant vector:\nprometheus_http_requests_total \u0026gt; 0 → {code=\u0026#34;200\u0026#34;, handler=\u0026#34;/ready\u0026#34;} → 7 {code=\u0026#34;200\u0026#34;, handler=\u0026#34;/api/v1/query\u0026#34;} → 39 {code=\u0026#34;200\u0026#34;, handler=\u0026#34;/graph\u0026#34;} → 3 {code=\u0026#34;200\u0026#34;, handler=\u0026#34;/metrics\u0026#34;} → 15452 {code=\u0026#34;400\u0026#34;, handler=\u0026#34;/api/v1/query\u0026#34;} → 11 This instant vector is made up of five time series elements, where each element includes a set of labels (in this case, code and handler) and a scalar value. Functions that accept an instant vector as input would take this entire set as a single argument.\nExample query returning a range vector:\nprometheus_http_requests_total{code=\u0026#34;400\u0026#34;} [1m] → {handler=\u0026#34;/api/v1/query\u0026#34;} → [ @1743324977 → 3, @1743324992 → 3, @1743325007 → 3, @1743325022 → 3 ] {handler=\u0026#34;/api/v1/query_range\u0026#34;} → [ @1743324977 → 15469, @1743324992 → 15470, @1743325007 → 15471, @1743325022 → 15472 ] This range vector is made of two time series elements, each consisting of a set of labels (in this case, handler) and a series of timestamp/value pairs showing how the metric changed over the specified 1-minute time range.\nWhen a function such as rate() accepts a range vector as input, it takes this entire structure as a single argument and processes all the time series and their timestamp-value pairs to produce a result (which would typically be an instant vector).\nTypes of queries # In PromQL, time parametres are sent separately from the expression to the Prometheus Query API, and the exact time parameters depend on the type of query you are sending. Time parametres can be a time range or a timestamp, therefore Prometheus knows two types of PromQL queries: instant queries and range queries.\nInstant queries # Instant queries are used for table-like views, where you want to show the result of a query at a single point in time. They have the following parameters:\nThe PromQL expression. An evaluation timestamp. The expression is evaluated at the evaluation timestamp and it can return any valid PromQL expression type, i.e., strings, scalars, instant vectors and range vectors.\nExample query:\nprometheus_http_requests_total{handler=\u0026#34;/api/v1/query\u0026#34;} Because it is not provided, the evaluation timestamp in this query is now. The selector prometheus_http_requests_total is an instant vector selector that selects the latest, non-stale3 sample for any time series with the metric name prometheus_http_requests_total. Note that both the selector and the metric have the same name.\nThe expression returns a instant vector with two series with a single sample each:\n{code=\u0026#34;200\u0026#34;, handler=\u0026#34;/api/v1/query\u0026#34;} → 68 {code=\u0026#34;400\u0026#34;, handler=\u0026#34;/api/v1/query\u0026#34;} → 12 # yellow The output timestamp of each returned sample is not the timestamp when the sample was taken, but gets set to the evaluation timestamp of the query. That is, if the two samples above, which are the last available ones, were taken 36 seconds ago, they will be presented as taken at the moment of the query execution, i.e., now.\nWe can specify the evaluating timestamp as part of the query. This allows you to query metrics at a specific point in time rather than the current time. The format is \u0026lt;vector_selector\u0026gt; @ \u0026lt;timestamp\u0026gt;, where \u0026lt;timestamp\u0026gt; is a UNIX timestamp (seconds since epoch).\nExample query:\nprometheus_http_requests_total{handler=\u0026#34;/api/v1/query\u0026#34;} @ 1743493844 We can see this output on the Table tab of the Prometheus web UI.\nRange queries # Range queries are mostly used for graphs, where you want to show an expression over a given time range. They have the following parameters:\nThe PromQL expression. A start time. An end time. A resolution step. After evaluating the expression at every resolution step between the start and end time, the individually evaluated time slices are stitched together into a single range vector. Accessing a window of past data is often useful for computing aggregates like rates or averages over a period of time.\nRange queries always return a range vector (the result of the scalar or instant vector being evaluated over a range of time).\nYou write range vector selectors exactly like instant vector selectors, but with the desired time range window appended in square brackets. Including a time unit is mandatory. The available units are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) and y (years).\nExample query:\nprometheus_http_requests_total{handler=\u0026#34;/api/v1/query\u0026#34;} [1h] We can see this output on the Graph tab of the Prometheus web UI (resolution is set to 60s):\nSelectors vs queries # As you may have already figured out from the sections above, the terms instant and range are used both for:\nThe type returned by an entire PromQL query. The type of an individual selector within a PromQL query. This can be confusing.\nSelectors # Given that there are two types of vectors, instant and range, we have two types of selectors, instant vector selectors and range vector selectors.\nAn instant vector selector allows you to select the latest sample value at an evaluation timestamp when in an instant query, or at every evaluation step when in a range query.\nIt is called a vector selector because it returns a set, or vector, of time series, with one sample for each series (thus, an instant vector).\nAn example of an instant vector selector would be prometheus_http_requests_total.\nA range vector selector allows you to select an entire range of samples over time, at each evaluation step4 of a query. This allows you to run aggregations over the time window: rates of increase, averages, min/max values, quantiles, and so on.\nYou write range vector selectors exactly like instant vector selectors, but with the desired range time window appended in square brackets. For example, prometheus_http_requests_total [1h].\nQueries # This concept is about the overall query execution, and whether a query as a whole is evaluated at a single timestamp (instant), or at multiple subsequent time steps (range).\nLookback delta # An instant vector selector serves the use case of “give me the latest sample value at a given time for a set of series”. However, this requires defining “latest”.\nSince samples can have arbitrary timestamps (e.g., due to different scrape interval), there is no fixed interval between samples in Prometheus. Therefore, knowing whether there is a “current” latest samples for a given series is difficult. If the latest sample for a given series is days or weeks old, it is most probably not meaningful as part of the result of an instant vector selector at the current timestamp, as it would lead to many outdated series “flatlining” in a graph.\nHowever, samples are not expected to exactly match the evaluating timestamp either. So, some kind of middle ground is needed.\nTo select latest samples that are neither too outdated, nor require super fast scrape intervals, or even grid-aligned sample timestamps, in Prometheus instant vector selectors look back a maximum of 5 minutes relative to the evaluation timestamp, meaning older samples are dropped from the result.\nStaleness # Despite the 5-minute rule above being a good compromise between excluding old data and including recent-enough samples, it will never cover all use cases. Thus, Prometheus supports explicitly marking series as stale.\nWhen Prometheus detects that a series will go extinct (e.g., its target has disappeared, its target no longer returns it, or a recording rule stopped returning it), Prometheus writes out an explicit staleness marker for this series, which is internally signaled with a NaN sample value.\nWhen instant vector selectors encounter a staleness marker as the last-seen sample value before their evaluation timestamp, the corresponding series will not be included in the result. This solves the “double count” and “flatlining” issues more quickly.\nLearning by doing # At this point in the series we are only monitoring our own Prometheus server, so the list of available metrics is relatiely small. However, PromQL offers a huge range of functions and operators, and delving into them takes time and practice.\nYou can check the full list of operators and functions in the official PromQL guide. Moreover, PromLabs offers a PromQL cheat sheet.\nWhile you do that, you may want to go through the following list of example queries, sorted by complexity, so you learn by doing.\nBasic metric selection # Shows raw counter values of all HTTP requests handled by Prometheus, broken down by handler and status code. This introduces the fundamental concept of metric inspection.\nprometheus_http_requests_total Filtered metric selection # Filters HTTP requests to only show traffic hitting the /metrics endpoint. Demonstrates label filtering with {}.\nprometheus_http_requests_total{handler=\u0026#34;/metrics\u0026#34;} Counter rate calculation # Calculates the per-second request rate over 1-hour windows. Introduces the rate() function for counter metrics.\nrate(prometheus_http_requests_total[1h]) Aggregation with sum # Aggregates total HTTP requests by status code. Introduces the sum() and by operators for dimensional analysis.\nsum(prometheus_http_requests_total) by (code) Error rate percentage # Calculates the percentage (%) of HTTP requests that resulted in client or server errors over 1 hour. Combines filtering, rate(), and arithmetic operations.\nsum( rate( prometheus_http_requests_total{code=~\u0026#34;4..|5..\u0026#34;}[1h] ) ) / sum( rate( prometheus_http_requests_total[1h] ) ) * 100 In the numerator of this example, from the inside out:\n{code=~\u0026quot;4..|5..\u0026quot;} uses a regular expression to filter HTTP requests with 4xx or 5xx status codes. This isolates error responses from the prometheus_http_requests_total counter. rate(...[1h]) computes the per-second rate of errors (i.e., the error rate) over a 1-hour window. rate() handles counter resets and extrapolates gaps, making it ideal for transient metrics like HTTP requests. sum(...) aggregates (i.e., sums) the error rates across all handlers (e.g., /metrics, /api). Without this, the result would show per-handler error rates instead of the global error rate. The denominator repeats the rate() calculation but without filtering, giving the total request rate across all status codes. This ensures the denominator represents the total workload against which errors are compared.\nFinally, we multiply by 100 to express the ratio as a percentage.\nSome important considerations:\nCounters require rate(). Direct counter values (e.g., prometheus_http_requests_total) are meaningless without normalization over time. Aggregation is critical. Summing ensures the result reflects system-wide health, not individual endpoints. Regex filtering: 4.. and 5.. efficiently capture all 4xx and 5xx errors, respectively, without listing each code (400, 401, 500, 503, etc). Memory usage # Displays the resident memory used by the Prometheus process. Introduces system-level metrics.\nprocess_resident_memory_bytes{job=\u0026#34;prometheus\u0026#34;} Garbage collection impact # Shows the time spent in garbage collection per second over 1 hour. Highlights Go runtime metrics and their impact.\nrate(go_gc_duration_seconds_sum{job=\u0026#34;prometheus\u0026#34;}[1h]) Latency percentiles # Calculates the 95th percentile latency for HTTP requests using histogram metrics. Introduces histogram_quantile() for performance analysis.\nhistogram_quantile(0.95, rate( prometheus_http_request_duration_seconds_bucket[1h] ) ) Top 5 busiest handlers # Identifies the 5 most frequently accessed endpoints using topk(). Combines aggregation and ranking.\ntopk(5, sum( rate( prometheus_http_requests_total[1h] ) ) by (handler) ) Scrape duration analysis # Averages scrape durations per job over 1 hour. Demonstrates working with custom metrics like prometheus_target_interval_length_seconds.\navg( rate( prometheus_target_interval_length_seconds_sum[1h] ) ) by (scrape_job) Disk usage prediction # Predicts TSDB storage usage in 7 days using linear regression. Introduces time-series forecasting with predict_linear().\npredict_linear( prometheus_tsdb_storage_blocks_bytes[6h], 3600*24*7 ) Memory pressure alert # Triggers when memory usage exceeds 80% of the available limit. Combines arithmetic operations and threshold comparison.\n(process_resident_memory_bytes / process_virtual_memory_max_bytes) * 100 \u0026gt; 80 Target health status # Shows health status (1 equals healthy, 0 means unhealthy) of all scrape targets. Uses the synthetic up metric for monitoring reliability.\nup{job=~\u0026#34;.+\u0026#34;} As we add more targets along this series of articles, this query will yield more results.\nGoroutine leak detection # Alerts when the number of active Goroutines exceeds 1000. Highlights Go runtime concurrency metrics.\ngo_goroutines{job=\u0026#34;prometheus\u0026#34;} \u0026gt; 500 Composite query: GC vs. CPU # Compares CPU time spent in garbage collection (GC) vs. total CPU usage, i.e., how much CPU is wasted on GC. Combines multiple metrics and demonstrates ratio analysis.\nrate( go_gc_duration_seconds_sum{job=\u0026#34;prometheus\u0026#34;}[1w] ) / rate( process_cpu_seconds_total{job=\u0026#34;prometheus\u0026#34;}[1w] ) * 100 In the numerator of this example, from the inside out:\ngo_gc_duration_seconds_sum is a counter tracking cumulative time spent in garbage collection (GC). rate(...[1w]) computes the per-second average time spent in GC over a 1-week window (e.g., a rate of 0.05 would mean 0.05 seconds of GC per second, i.e., 5% of a CPU core). Then, in the denominator:\nprocess_cpu_seconds_total is a counter tracking cumulative CPU time used by the Prometheus process. `rate(… \\[1w\\]) converts this into per-second CPU utilization (e.g., 0.8 means 80% CPU usage). Finally, to compute GC as percentage (%) of CPU:\nDividing GC time per second by CPU usage per second gives the fraction of CPU time spent on GC. Multiplying by 100 converts this to a percentage. For example, if GC time were to be 0.000001 and CPU usage were to be 0.066732, the result would be (0.000001 / 0.066732) * 100 = 0.002%. This would mean that 0.002% of CPU time is spent on garbage collection.\nSome important considerations:\nCounters require normalization. Both metrics use rate() to convert counters into per-second rates, ensuring comparability. Actionable insight. A high percentage (e.g., \u0026gt; 0.01%) could indicate inefficient memory usage or excessive allocations. The _bucket suffix is a Prometheus naming convention to get the per-bucket time series data. ↩︎\nEach bucket in the histogram is described by a label called le, which is a canonical abbreviation for less than or equal. Therefore, the value of this label encodes the upper inclusive bound for the corresponding histogram bucket. ↩︎\nThe stale marker is an explicit way of marking a series as terminating at a certain time in the time-series database. ↩︎\nThe number of evaluation steps is determined by the resolution of the query. ↩︎\n","date":"24 September 2024","externalUrl":null,"permalink":"/en/posts/grafana/promql/","section":"Posts","summary":"Use the Prometheus Query Language to query the Prometheus database.","title":"Retrieving metrics from Prometheus using PromQL","type":"posts"},{"content":"Proxmox Virtual Environment 7 will be installed on top of the existing Debian 11 Bullseye installation, which currently has a MAC address with one public IPv4 and one IPv6 address.\nBeforehand # Add the Proxmox APT repository to the system:\necho \u0026#34;deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription\u0026#34; \u0026gt; /etc/apt/sources.list.d/pve-install-repo.list wget http://download.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg Update the package index:\napt-get update Better safe than sorry, so manually install the ifupdown2 package before installing the Proxmox VE, as it is a tricky requirement located at the Proxmox APT mirror.\napt-get install ifupdown2 dpkg --purge ifupdown systemctl enable networking.service Proxmox packages # Now you are ready to install the Proxmox VE packages.\napt-get install proxmox-ve open-iscsi zfsutils-linux The new Proxmox VE kernel should be automatically selected in the GRUB menu:\nawk -F\\\u0026#39; \u0026#39;/menuentry / {print $2}\u0026#39; /boot/grub/grub.cfg Unless you have a Proxmox subscription, remove the entreprise repository, which has just been added during the installation:\nrm /etc/apt/sources.list.d/pve-enterprise.list The enterprise repository is usually behind the community one, so run one last update of the list of packages and upgrade them to their latest versions:\napt-get update apt-get dist-upgrade Optionally, clean the downloaded packages cache:\napt-get clean Since Proxmox includes its own firmware, installed packages that contain firmware should automatically have been removed when installing pve-firmware and pve-edk2-firmware, which are dependencies of proxmox-ve. Example of packages that should have been automatically removed are firmware-bnx2x, firmware-realtek and firmware-linux-free. You can check that using the following command:\ndpkg --list | grep -e firmware-bnx2x -e firmware-realtek -e firmware-linux-free Additionally, you may also want to check that the package os-prober, an utility to detect other OSes on a set of drives, is not installed either:\ndpkg --list | grep os-prober Reboot:\nreboot Log in again and, optionally, check that the kvm kernel module is loaded:\nlsmod | grep kvm If it is not loaded, you can load it manually. For Intel CPUs, you will need to load the kvm_intel module, and for AMD CPUs, the kvm_amd module. The following command will load the appropriate module for your CPU:\nmodprobe kvm Optionally, remove the stock Debian kernel, as it is no longer needed:\napt-get purge linux-image-amd64 \u0026#39;linux-image-5.10*\u0026#39; Nameservers # Proxmox VE expects to manage the DNS and will not take its DNS settings from /etc/network/interfaces. Any package that auto-generates /etc/resolv.conf will cause the DNS to fail, so make sure that resolvconf and rdnssd are not installed:\ndpkg --list | grep -e resolvconf -e rdnssd The default Debian installation by Hetzner’s Installimage statically sets Hetzner’s nameservers in the /etc/resolv.conf file, so we do not need to change anything.\nnameserver 185.12.64.1 nameserver 2a01:4ff:ff00::add:2 nameserver 185.12.64.2 nameserver 2a01:4ff:ff00::add:1 Network configuration # Our network design using virtual switches will be done using a bridged mode due to the following advantages:\nThe host is transparent and not part of the route. Guests can directly communicate with the gateway of the assigned IP address. As per the Hetzner’s network configuration on Debian-based systems document, a point-to-point configuration needs to be used. This is because the main IP of the dedicated server is usually located in a /26 or /27 subnet and this mechanism prevents the accidental use of a foreign IP address (their infrastructure rejects any Ethernet packets that are not addressed to the gateway address).\nThere are two ways to set up the necessary bridges in each host:\nVLAN-aware bridges. Traditional bridges. When using a VLAN-aware bridge:\nThe host has just one bridge (vmbr0), that is aware of all the configured VLANs via the vlan-aware and vlan-vids options. Each guest’s virtual network card is assigned to the host’s only bridge (vmbr0). Each guest’s virtual network card is assigned a VLAN tag, which is transparently supported by the host bridge. The host’s bridge does not check the packages travelling through it, as it is the kernel’s reponsibility (at the guest’s side) to add the proper VLAN tag to each package. When using traditional bridges:\nThe host has one VLAN interface and one bridge for each VLAN tag. Each guest’s virtual network card is assigned a specific bridge from the host, but no VLAN tag is associated. The VLAN tag is added by the bridge at the host (via sub-interface, e.g., eno1.4001), thus making sure that all traffic going through that bridge is properly tagged. Human-readable, self-explanatory bridge names can help preventing misconfigurations (e.g., vmbr4002 for the guests’ local network). The management IP of the host remains on the physical interface (eno1). Future migrations between virtualisation platforms should be easier to automate. Component Traditional bridges VLAN-aware bridge Bridges Multiple (1 per VLAN) Single bridge VLAN handling Host adds tags Guests add tags Guest config No VLAN tags needed VLAN tag required per guest Host interfaces Physical interface for management VLAN sub-interface on bridge Topology Explicit separation Consolidated through software Debugging Easier (named bridges) Harder (shared bridge) Given the naming conventions for device names described in the Host System Administration: Network Configuration section of the Proxmox VE Administration Guide, we are going to use the following configuration in our single-NIC servers:\nType Device name Used by Type Description Ethernet device eno1 The host Public IP Public IP address assigned to the server when ordered Bridge vmbr4001 Guests Public subnet Floating public subnet assigned to the vSwitch with id 4001 Bridge vmbr4002 Guests Private subnet Communication among guests through vSwitch with id 4002 VLAN eno1.4003 Hosts Private subnet Communication among nodes through vSwitch with id 4003 Guests will be having one or two virtual network devices:\neno1 will be mandatory and will have an IP address of the private network 192.168.0.0/16. eno2 will be optional and will have an IP address of the public subnet assigned to the vSwitch with VLAN id 4001. Therefore, the following configuration, using traditional bridges, will be applied to the /etc/network/interfaces file on the host:\nsource /etc/network/interfaces.d/* auto lo iface lo inet loopback # Physical interface (Hetzner requires point-to-point config) auto eno1 iface eno1 inet static address v4.public.ip.addr netmask v4.public.ip.mask gateway v4.public.ip.gw pointopoint v4.public.ip.gw hwaddress aa:bb:cc:dd:ee:ff # Proxmox host iface eno1.4001 inet manual vlan-raw-device eno1 mtu 1400 auto vmbr4001 iface vmbr4001 inet manual bridge-ports eno1.4001 bridge-stp off bridge-fd 0 mtu 1400 bridge-disable-mac-learning 1 # Proxmox guests public network iface eno1.4002 inet manual vlan-raw-device eno1 mtu 1400 auto vmbr4002 iface vmbr4002 inet static bridge-ports eno1.4002 bridge-stp off bridge-fd 0 mtu 1400 # Proxmox guests private network 192.168.0.0/16 auto eno1.4003 iface eno1.4003 inet static address 10.0.0.1/24 vlan-raw-device eno1 mtu 1400 # Proxmox hosts private network 10.0.0.0/24 Some relevant notes about the configuration above:\nThe eno1 interface is configured with a static IP address, which is the public IP address of the host. The eno1 interface is configured with a point-to-point configuration and a specific MAC address, which is required by Hetzner’s network infrastructure. We use a VLAN for the private LAN of the nodes instead of a bridge, which will make it not appear on the guests when these are being configured. We will use the default network interface eno1 instead of a vmbr0, so that it cannot be selected on the guests when these are being configured. We need to restart the networking service for the new configuration to take effect:\nsystemctl restart networking Fail2ban # Fail2ban is a security tool written in Python that offers protection against so-called brute force attacks. The IP address of the user is blocked for a certain period of time after several incorrect passwords have been entered. This is to prevent the attacker from trying out a large password list in a short time.\nWe are going to use Fail2Ban to protect the SSH service as well as access to Proxmox’s web interface.\nInstall the fail2ban package and enable the service:\napt-get install fail2ban systemctl enable fail2ban Create a configuration file from one of the given templates:\ncp --archive /etc/fail2ban/jail.conf /etc/fail2ban/jail.local Edit the /etc/fail2ban/jail.local file, make the following changes in the [sshd] section and add the [proxmox] section at the end of the file:\n[sshd] enabled = true port = 2001 [proxmox] enabled = true port = 8006 filter = proxmox logpath = %(syslog_daemon)s maxretry = 3 bantime = 3600 Changing the default SSH port was done in the previous post of this series.\nNote that syslog_daemon is defined in /etc/fail2ban/paths-debian.conf as an alias to /var/log/daemon.log.\nNext, create the file /etc/fail2ban/filter.d/proxmox.conf with the following content:\n[Definition] failregex = pvedaemon\\[.*authentication failure; rhost=\u0026lt;HOST\u0026gt; user=.* msg=.* ignoreregex = While Debian 11 Bullseye uses nftables by default, the kernel shipped with Proxmox 7 still uses iptables. Since Fail2ban uses iptables by default, we do not need to make any further changes.\nRestart the service to apply the changes:\nsystemctl restart fail2ban You can use fail2ban-client to check the status of the jail:\nfail2ban-client status proxmox You should see something like this:\nStatus for the jail: proxmox |- Filter | |- Currently failed: 2 | |- Total failed: 5 | `- File list: /var/log/daemon.log `- Actions |- Currently banned: 0 |- Total banned: 0 `- Banned IP list: You can use fail2ban-regex to test the filter:\nfail2ban-regex /var/log/daemon.log /etc/fail2ban/filter.d/proxmox.conf You should see something like this:\nRunning tests ============= Use failregex filter file : proxmox, basedir: /etc/fail2ban Use log file : /var/log/daemon.log Use encoding : UTF-8 Results ======= Failregex: 0 total Ignoreregex: 0 total Date template hits: |- [# of hits] date format | [206] {^LN-BEG}(?:DAY )?MON Day %k:Minute:Second(?:\\.Microseconds)?(?: ExYear)? `- Lines: 206 lines, 0 ignored, 0 matched, 206 missed [processed in 0.01 sec] Missed line(s): too many to print. Use --print-all-missed to print all 206 lines Root password # Given that we will be using the root user credentials to access the web interface, first of all make sure that the user has a strong password via either the passwd or the pveum passwd root@pam command.\nProxmox VE employs a multi-master design, meaning each node operates independently with its own user accounts and permissions. The root user is the superuser on each node, and it is not shared across nodes. Therefore, you will set the root password on each node independently.\nThe root@pam realm refers to the local system user authentication on the specific Proxmox VE host. This is the default authentication method for Proxmox VE, and it allows you to manage local users and groups.\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/installation/","section":"Posts","summary":"Installing PVE on Debian 11, configuring the network and setting up Fail2ban","title":"Proxmox installation and configuration","type":"posts"},{"content":"In a previous article in this series we discussed the convenience of aligning block sizes across different layers of the storage stack, especially when using ZFS volumes (ZVOL).\nWhen our average workload is located beyond the typical 4K block size, using XFS becomes advantageous due to its support for larger block sizes and efficient handling of large files.\nHowever, the kernel’s page size, which defaults to 4K on Debian, will still be a limiting factor, unless we decide to compile our own kernel from sources. Fortunately, there is a way to work around this limitation via the Large Block Sizes (LBS) feature in the kernel.\nThis feature is still marked as experimental in the 6.12 LTS kernel that Debian 13 Trixie ships with, but we can experiment with it while we wait for a more modern kernel version to be backported into it (LBS was marked stable in kernel 6.13). Moreover, Debian 13 ships with a modern-enough version of xfsprogs that supports LBS.\nLarge Block Size # Support for Large Block Size (LBS) in the Linux kernel was marked as stable in version 6.13. This support focused on enabling larger block sizes for I/O operations, moving beyond the traditional 4 KB page size default.\nThe goal is to improve performance and efficiency via:\nReduced overhead, as the number of individual I/O operations is reduced. Hardware efficiency, as modern storage devices (e.g., NVMe drives) come with a default sector size of 8 KB. Application needs, as some applications (e.g., databases) may have specific internal data structures that align better with larger block sizes. This involves changes to the block layer, filesystems, and potentially memory management with folios.\nPostgreSQL, for example, uses an 8 KB page size internally. With LBS, we can now create an XFS filesystem with an 8 KB block size, matching the database’s internal page size, which can improve performance and reduce overhead when writing data.\nTo use it, all we have to do is format the XFS filesystem with the desired block size using the mkfs.xfs command with the appropriate option.\nAbout XFS # XFS is a 64-bit high-performance journaling filesystem optimised for very large files1 and filesystems2, and high-throughput workloads. It is completely multi-threaded and supports extended attributes and variable block sizes, making it a strong choice inside virtual machines.\nDesigned from day one for computer systems with large disk arrays and many CPUs, its robustness under concurrent write-heavy operations and support for advanced features, like delayed allocations and online defragmentation and resizing, make it particularly well-suited for use cases such as NFS shares, backup storage, and databases.\nXFS itself did not originate on Linux, but was first released in 1994 on IRIX, a UNIX variant for SGI workstations and servers. Starting in 1999, XFS was ported to Linux as part of SGI’s push to use Linux.\nAs a journaling file system, XFS keeps record of modifications before they are committed to its internal structures, which ensures its overall consistency in case of a crash or power loss.\nDebian kernel # Debian 13 Trixie comes with kernel 6.12 LTS and modern userland tools (the xfsprogs package) that support Large Block Sizes (LBS) in XFS. Unfortunately, LBS is marked as experimental in kernel 6.12 LTS.\nIn essence, kernel 6.12 introduced the fundamental Virtual File System (VFS) infrastructure and initial XFS support for Large Block Sizes, making the concept viable. Then kernel 6.13 added critical features like atomic write support for major filesystems (EXT4, XFS), improving general large file handling, and incorporating the usual wave of bug fixes and optimizations that are essential for a feature to be considered truly stable and production-ready.\nMaintenance of version 6.12 by the Linux Kernel Organization is restricted to patches that fix security issues, bugs or regressions, or provide stability. However, while we wait for a more modern kernel (hopefully 6.15+) to be backported to Trixie, we can check it out and test it.\nRegarding userspace tools, Debian 13 ships with xfsprogs version 6.13, which means we will have:\nFull userspace support for LBS filesystems. All the maintenance tools that understand larger block sizes. Proper compatibility between kernel and userspace tools. Aligning block sizes # We want to match the same block size that Proxmox used to create the ZVOL (volblocksize) to the block size of XFS. Because volblocksize can change depending on the version of zfsutils-linux, start by checking out its value via the terminal of the host before formatting the disk of your virtual machine.\nList the existing ZVOLs using zfs list, then use zfs get volblocksize to check the block size of the specific ZVOL.\n# zfs get volblocksize zfspool/vm-104-disk-0 NAME PROPERTY VALUE SOURCE zfspool/vm-104-disk-0 volblocksize 8K default When formatting the disk, convert the value of volblocksize into bytes. For the example above, inside the VM you would use 8192 bytes.\nmkfs.xfs -b size=8192 /dev/sdc The mkfs.xfs command returns the geometry information for the file system to make sure all parameters are set correctly.\nZFS version 2.2 brings in a new default block size of 16K.\nThe mkfs.xfs command will fail if the block size is not supported by the kernel.\nUsing XFS # The xfsprogs package provides a set of utilities for managing XFS filesystems, including tools for creating (mkfs.xfs), checking and repairing (xfs_repair), and extending (xfs_growfs) a filesystem.\nFormatting # Let’s say that our VM has a data disk we are using to store the files served by our NFS server, or the databases in our PostgreSQL server. When formatting the disk, we want to align the block sizes of our XFS filesystem with the underlying ZFS storage.\nRecent versions of xfsprogs allow us to specify both the block size and the sector size when using mkfs.xfs. Aligning both will get us better performance.\nAs of Debian 13 with kernel version 6.12, the following command can be used to format the disk with an 8K block size and a 4K sector size:\nmkfs.xfs -b size=8192 -s size=4096 /dev/sdc When a kernel 6.15+ is available, we will be able to specify larger sector sizes. Should our volblocksize be 16k, the following command would make the I/O requests even more performant:\nmkfs.xfs -b size=16384 -s size=16384 /dev/sdc Sector size # By default, mkfs.xfs uses a 512-byte sector size, which matches what the ZVOL exposes. The ZVOL defaults to such sector size mainly due to two reasons:\nLegacy compatibility. Many OS, boot loaders, and even BIOS/UEFI implementations historically expect 512-byte logical sectors, and may even refuse to mount or format a disk if it reports something unusual. Alignment problems. By advertising 512-byte logical sectors, ZFS makes it harder for the guest filesystem to get misaligned (from ZFS’s point of view), as every alignment is a multiple of 512. Although ZFS abstracts the physical layer, volblocksize is its true internal allocation unit. However, it does not tell the guest about it so that it can present a safe virtual disk that works on any OS regardless of its sector size support.\nHowever, if the guest filesystem knows that the real storage prefers, for example, 16 KB writes, it can:\nBatch I/O so it writes in 16 KB multiples. Work around the RMW penalty. Then, ZFS can directly map filesystem blocks to ZVOL blocks without fragmentation or partial-block writes.\nBatching I/O requests is about how the filesystem plans writes in the first place. If XFS believes the sector size is 16 KB, it will naturally coalesce smaller logical changes into 16 KB-aligned writes before sending them to the block device.\nAvoiding RMW cycles is about what happens if a write is smaller than the underlying ZFS volblocksize when it finally hits ZFS. If ZFS gets a sub-16 KB write:\nIt reads the whole 16 KB block from disk. It modifies just the changed part (e.g., the 512-byte region). It writes the whole 16 KB block back. That is the read-modify-write penalty, which happens down in the storage layer.\nTherefore, when we set, for example, -s size=16K in XFS, we get both:\nFewer small writes generated, thanks to batching/alignment. No RMW cycles triggered in ZFS, because it only ever sees full 16 KB writes. ZFS defaults to lying for maximum compatibility, leaving it to the VM admin to override if the guest OS can handle larger sectors.\nMounting # Once the disk has been formatted, we need to mount it:\nmount -t xfs -o noatime,logbufs=8 /dev/sdc /srv/nfs Given the nature of our workload, both of these options are good, low-risk optimisations:\nnoatime tells XFS not to update the access time metadata every time a file is read. This skips extra writes for read operations, reduces metadata churn and slightly improves performance and reduces wear on SSD devices. logbufs=8 tells XFS to use 8 in-memory log buffers for the journal (i.e., the write-ahead log). This increases parallelism for metadata logging, allows more outstanding metadata transactions before forcing a flush and can improve performance in metadata-heavy workloads (file creation, deletion, renaming). This option is often the default on modern systems. Repairing # A file system in use should be boring and mostly invisible to the system administrator and user. However, crashes happen, and crash recovery needs to be considered. XFS provides xfs_repair to both check and repair a corrupted or damaged XFS filesystem.\nIt is typically run on an unmounted file system to ensure no conflicting operations occur while it replays the journal log to correct errors that might have occurred due to improper unmounting. The -n option allows us to check the file system for inconsistencies without actually making any changes.\nsystemctl stop nfs-server.service umount /srv/nfs xfs_repair /dev/sdc We can find out the filesystem is damaged:\nUpon boot, when mounting the filesystem, errors will be logged in the system journal. Use journalctl --boot to view it. During execution, logged by the kernel. Use journalctl --dmesg to view it. Resizing # XFS supports online resizing, while mounted and even while actively being used. However, if the disk is under heavy load, you might want to temporarily reduce I/O to avoid unpredictable behaviour.\nXFS can grow online, but cannot shrink.\nTo extend the ZVOL holding the data disk, follow these steps:\nResize the disk image or block device. Resize the filesystem inside the VM. Use the terminal of the Proxmox host to resize the ZVOL:\nzfs set volsize=+100G zfspool/vm-104-disk-0 After resizing, use lsblk to check that the OS has already detected the new size. When using using VirtIO/SCSI, the OS sees the size change immediately. Because we did not partition the disk before formatting it, we do not need to deal with partitions.\nFinally, perform the second step in the VM terminal3:\nxfs_growfs /srv/nfs Make sure the disk is mounted before running xfs_growfs.\nDefragmenting # A command worth note is xfs_fsr. FSR stands for file system reorganizer and it allows defragmentation of the extent lists of all files in a file system and can be run in background.\nxfs_fsr /srv/nfs By default it assigns 7200 seconds of time to perform such operations, in 10 passes, but that can be tweaked using the -t and -p options, respectively.\nIt may also be used on a single (large) file:\nxfs_fsr /srv/nfs/myapp/pdf/file.pdf Backing up # Although all normal backup applications can be used for XFS file systems, the xfsdump and xfsrestore commands from the xfsdump package are specifically designed for XFS backup.\nxfsdump uses a special API to perform I/O based on file handles so that it does not generate inconsistent device snapshots on the raw block device. This command can perform backups to regular files on local and remote systems, and it supports incremental backups with a sophisticated inventory management system.\napt-get install --yes xfsdump Let’s assume that we mounted a backup disk at /mnt/backups. We would start with a full backup (level 0):\nxfsdump -l 0 -L \u0026#34;20250812-full-backup\u0026#34; -M \u0026#34;Full backup of NFS share\u0026#34; \\ -f /mnt/backups/nfs-full-backup-20250812.xfs /srv/nfs In case of interruption, backup operations can be resumed using the -R option:\nxfsdump -l 0 -L \u0026#34;20250812-full-backup\u0026#34; -M \u0026#34;Full backup of NFS share\u0026#34; \\ -f /mnt/backups/nfs-full-backup-20250812.xfs -R /srv/nfs The next week, we would perform an incremental backup using -l 1, which specifies a level 1 backup, meaning it would include changes since the last level 0 backup.\nxfsdump -l 1 -L \u0026#34;20250819-incr-backup\u0026#34; -M \u0026#34;Incremental backup of NFS share week 1\u0026#34; \\ -f /mnt/backups/nfs-incr-backup-20250819.xfs /srv/nfs This backup would contain only files changed since the level 0 backup.\nThe following week, we would perform another incremental backup:\nxfsdump -l 2 -L \u0026#34;20250826-incr-backup\u0026#34; -M \u0026#34;Incremental backup of NFS share week 2\u0026#34; \\ -f /mnt/backups/nfs-incr-backup-20250826.xfs /srv/nfs This backup would only contain files changed since the level 1 backup.\nRestoring # XFS offers a different command for restoring backups, named xfsrestore. We would start by listing the inventory of backups, which would provide us with a the available session IDs and session labels:\nxfsrestore -I Optionally, we would list the contents of a specific backup:\nxfsrestore -I -f /mnt/backups/nfs-full-backup-20250812.xfs When having to restore everything from scratch, we would follow these steps:\nStop the services using the NFS share. Unmount the NFS share. Format the disk again, if needed. Restore the full backup. Apply the incremental backups, in order. systemctl stop nfs-server.service umount /srv/nfs mkfs.xfs -b size=8192 -s size=4096 /dev/sdc xfsrestore -f /mnt/backups/nfs-full-backup-20250812.xfs /srv/nfs xfsrestore -f /mnt/backups/nfs-incr-backup-20250819.xfs /srv/nfs xfsrestore -f /mnt/backups/nfs-incr-backup-20250826.xfs /srv/nfs If we wanted to restore a specific file at a given point in time, we would follow these steps:\nFind which backup contains the file. If found, restore just that file, using the session ID from the inventory. xfsrestore -t -f /mnt/backups/nfs-incr-backup-20250826.xfs | grep proposal.odt xfsrestore -S \u0026#34;2d129e2a-7c33-47a9-ac33-5a4862b594b1\u0026#34; -s myapp/docs/proposal.odt \\ -f /mnt/backups/nfs-incr-backup-20250826.xfs /srv/nfs/ An entire subdirectory could also be restored by specifying the directory path instead of a single file.\nSummary of which backup file to use when:\nWhen Which Complete recovery Start with level 0, then apply all incrementals in order Point-in-time recovery Start with level 0, apply incrementals up to desired date Single file recovery Use the most recent backup that contains the file Recent files Check incremental backups first (smaller and faster) We will be using Proxmox Backup Server to back up the entire VM and its disks (those marked for backup), including the NFS share. Still, xfsdump is a tool that can be used in specific cases to have a second, complementary backup copy of our data. For instance, the generated dumps could be sent to a different storage location for added redundancy.\nInformation # The xfs_info utility provides detailed information about the structure and characteristics of an XFS filesystem. It displays details like the file system size, block size, sector size, inode information, and other relevant parametres.\nxfs_info /srv/nfs The amount of information displayed can be quite extensive, so here is a table with an explanation of the various fields.\nMeta-data section\nField Meaning meta-data=/dev/sdc Device where metadata (superblock, allocation groups, inode structures) resides. isize=512 Size (in bytes) of each inode. 512 B is typical. agcount=4 Number of allocation groups (AGs) in the filesystem; AGs enable parallel allocation on multi-threaded workloads. agsize=9830400 blks Number of blocks in each AG (~78.4 MiB per AG with bsize=8192). sectsz=512 Sector size reported by the device (or emulated by ZVOL). attr=2 Extended attribute format version (v2 is current). projid32bit=1 Project quotas with 32-bit project IDs are supported. crc=1 Metadata checksumming (XFS v5 format). finobt=1 Free inode B+tree present, improving inode allocation speed. sparse=1 Sparse inode chunk allocation enabled. rmapbt=1 Reverse mapping B+tree (for reflink \u0026amp; deduplication). reflink=1 Reflink (copy-on-write cloning) enabled. bigtime=1 Extended timestamp range (supports dates beyond 2038). inobtcount=1 Tracks inode counts per AG. nrext64=1 64-bit extent counters enabled. exchange=0 Online exchange feature not enabled. metadir=0 No separate metadata directory. Data section\nField Meaning bsize=8192 Data block size (8 KB) blocks=39321600 Total blocks in the filesystem (~300 GB total) imaxpct=25 Max % of space reserved for inodes (25% default) sunit=0 Stripe unit size (0 = none defined) swidth=0 Stripe width (0 = none defined) Naming section\nField Meaning version=2 Directory structure format (v2 = efficient hashed directories) bsize=8192 Directory block size (matches data bsize) ascii-ci=0 Case-insensitive lookups disabled ftype=1 Filetype field stored in directory entries (improves performance) parent=0 No parent pointer feature enabled Log section\nField Meaning internal log Journal (transaction log) stored on same device as data bsize=8192 Log block size (8 KB) blocks=19200 Log size (~150 MiB) version=2 Log format version 2 sectsz=512 Log sector size sunit=0 Log stripe unit (0 = none) lazy-count=1 Lazy log counter updates (performance optimization) Realtime section\nField Meaning none No separate realtime volume extsz=8192 Default extent size (8 KB) blocks=0 No realtime data blocks rtextents=0 No realtime extents rgcount=0 No realtime allocation groups Metadata takes space # Let’s say that we format a 300G disk using XFS, as follows:\nmkfs.xfs -b size=8192 /dev/sdc mount -t xfs /dev/sdc /srv/nfs df -h /srv/nfs We would see something like 300G total, 4.3G used, 296G available, meaning that a our fresh filesystem already lost 4.3G (~1.4%, which is expected). This is because XFS is optimised for performance rather than minimal metadata footprint. Specifically:\nXFS pre-allocates metadata structures (like inode tables, allocation group headers, B+trees, journals), so the initial used space reflects this reservation. The larger the block size, the more space reserved. An 8 KB block size slightly increases the metadata footprint compared to 4 KB. The internal log (journal) takes space, ~150 MB in this case (19200 × 8 KB). Individual files of up to 9 exabytes. ↩︎\nVolumes of up to 18 exabytes in size. ↩︎\nYou can either use the device path /dev/sdc or the mount point /srv/nfs. ↩︎\n","date":"12 August 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/nfs/xfs/","section":"Posts","summary":"Explore the benefits of using XFS on a Proxmox VM when attempting to align block sizes of I/O layers","title":"Larger block sizes with XFS on a Proxmox VM","type":"posts"},{"content":"This article will make use of two LXC running Debian GNU/Linux on a Proxmox cluster to get the Loki server installed and set up to recieve and store log data.\nloki1.localdomain.com will run the Loki server on port 8080. nginx1.localdomain.com will run NGINX as a reverse proxy on port 443 at the public address loki.publicdomain.com. This series assumes that an internal DNS server is installed and correctly configured. localdomain.com is the internal DNS zone used across the cluster, whereas publicdomain.com is a public DNS zone used to access services from the Internet.\nThe Loki server will be collecting log data sent by Promtail agents, which are running inside the host or guest you want to collect log data from. Therefore, Promtail is configured separately.\nPromtail agents will connect to that address and port as they gather new entries in the log files they are monitoring, then Loki will store that data in its local, on-disk time-series database located at /var/lib/loki/.\nHow does it work # Loki ingests logs from various sources (Promtail in our case), attaches metadata in the form of labels, and stores them in a time-series database (TSDB). Logs are queried from Loki using LogQL, a query language similar to PromQL, used by Prometheus. Loki is optimized for high write throughput and efficient storage.\nWhen a query is made:\nLoki identifies relevant log streams using the metadata labels. It retrieves and filters log lines matching the query. The results are presented in Grafana or other supported interfaces. What can it be used for # Loki can be used for:\nCentralised log management. Collect logs from multiple systems into a unified view. Cost-effective logging. Collect logs from multiple systems into a unified storage and prevent those systems from having to deal with resource-intensive tasks. Observability. Investigate application issues by correlating logs with metrics and traces, i.e., debugging and monitoring. Historical analysis. Retain logs over time for compliance, auditing, or performance analysis. Main components # Loki is a modular system that contains many components. These components can either be run together (single-binary mode that runs all targets), in logical groups (simple, scalable deployment mode, each running read, write or backend targets), or individually (in microservice mode). This, in turn, is what allows it to scale.\nComponent all read write backend Description Distributor x x Handles push requests from clients Ingester x x Persists data and ships it to long-term storage Query front-end x x Queues and optimises requests for the query scheduler Query scheduler x x Used by the frontend to queue split-up queries for the querier Querier x x Executes LogQL queries Index gateway x x Handles and serves metadata queries Compactor x x Compacts index files produced by ingesters Ruler x x Manages and evaluates rule and alert expressions Bloom planner x x Periodically plans the tasks for blooms creation Bloom builder x x Processes tasks created by the planner to build data structures Bloom gateway x x Handles and serves chunks filtering requests using bloom filters Installation # First of all, install some prerequisites:\napt-get install curl gnupg2 ca-certificates lsb-release debian-archive-keyring Now import the official Grafana signing key so APT can verify the packages we will be intalling later on:\ncurl --silent https://apt.grafana.com/gpg.key | gpg --dearmor --yes --output /etc/apt/keyrings/grafana.gpg Set up the APT repository for the stable Grafana packages:\ncat \u0026lt;\u0026lt; EOF \u0026gt; /etc/apt/sources.list.d/apt-grafana.sources X-Repolib-Name: APT Grafana Types: deb URIs: https://apt.grafana.com Suites: stable Components: main Architectures: amd64 Signed-By: /etc/apt/keyrings/grafana.gpg Enabled: yes EOF Set up repository pinning to prefer the packages from apt.grafana.com over the default ones:\necho -e \u0026#34;Package: *\\nPin: origin apt.grafana.com\\nPin: release o=stable\\nPin-Priority: 900\\n\u0026#34; \\ | tee /etc/apt/preferences.d/99loki Now update the packages index and install Loki and Redis:\nexport LOKI_VERSION=\u0026#34;3.5.1\u0026#34; apt-get update apt-get install loki=${LOKI_VERSION} redis Redis configuration # Loki uses Redis for caching. Redis requires minimum configuration, which is done by editing the following options in the /etc/redis/redis.conf file:\nrequirepass \u0026lt;password\u0026gt; maxmemory 100mb maxmemory-policy allkeys-lru The password can be generated with the following command:\nopenssl rand -base64 25 | tr --delete /=+ | cut --characters -32 And restart Redis:\nsystemctl restart redis Loki configuration # The Loki server uses a single configuration file /etc/loki/config.yml in YAML format, which contains information on the Loki server and its individual components. This file is passed by the systemd service file1 to the executable as an argument. It is a very large file, so let’s start by introducing the main sections available:\nKey Description target A list of components to run auth_enabled Enables authentication and authorization ballast_bytes Helps optimize garbage collection server Configures the main HTTP and gRPC server settings common Shared configuration settings across components distributor Controls how log entries are distributed to ingesters querier Configures query execution and result handling query_scheduler Manages the scheduling of queries across multiple queriers frontend Configures the query frontend for handling and caching queries query_range Controls range query splitting, caching, and parallelization ruler Manages alerting and recording rules ruler_storage Manages connections to the Thanos Object Storage2 client ingester_client Configures how the distributor communicates with ingesters ingester Sets up the ingester component, which writes logs to storage block_builder Defines how log data is constructe and compressed into chunks block_scheduler Manages the scheduling of block-building jobs pattern_ingester Configures pattern-based log ingestion index_gateway Manages index queries without constant interaction with object storage bloom_build Builds bloom filters3 for efficient querying bloom_gateway Serves queries using bloom filters storage_config Defines storage backends for chunks and indexes chunk_store_config Configures caching and flushing behavior for chunks schema_config Sets up the schema for indexing and storing logs compactor Configures index compaction for performance and cost optimization compactor_grpc_client Configures gRPC client settings for the compactor limits_config Sets global and per-tenant limits for ingestion and querying frontend_worker Configures workers that process queries from the frontend table_manager Manages the lifecycle of index tables memberlist Configures memberlist-based KV store for cluster coordination dataobj_explorer Allow to interactively inspect the contents of the object storage runtime_config Allows dynamic configuration changes at runtime operational_config Sets operational parameters for the Loki instance tracing Configures distributed tracing settings analytics Enables analytics collection for usage insights. profiling Sets up profiling to analyze performance. shutdown_delay Delays shutdown to allow in-flight requests to complete. metrics_namespace Sets a prefix for all emitted metrics. We will be using most of these sections, but not all.\nConfiguring Loki # We will be using the configuration keys listed above to configure our Loki server in a single instance, named loki1.localdomain.com, somewhat following the order determined by the default /etc/loki/config.yml file shipped by Grafana Labs with the loki package and the order presented in the Grafana Loki configuration parameters documentation.\nWe will be making explicit some default configuration values to make them easier to find and adjust as we progress through the series and feed more and more logs to Loki.\nAt the moment, Loki requires a restart when its configuration changes. So, when you have gone through all the configuration options and your /etc/loki/config.yml file is ready, issue the following command:\nsystemctl restart loki Basic options # We will be running all components in a single instance. Moreover, we will be delegating authentication onto the NGINX reverse proxy and using the firewall to restrict access to the server.\n# Run all components in single binary mode target: all # Disable authentication auth_enabled: false # Optionally, disable reporting statistics to stats.grafana.org analytics: reporting_enabled: false Server options # Both Grafana and our Promtail agents will be using HTTP to communicate with Loki. However, Loki components communicate among themselves using gRPC.\n# Configuration options of the Loki server. # See: https://grafana.com/docs/loki/latest/configure/#server # Log level is set to `info` by default. server: # Optionally, change the default ports http_listen_port: 8080 grpc_listen_port: 8081 # Default listen addresses http_listen_address: \u0026#34;0.0.0.0\u0026#34; grpc_listen_address: \u0026#34;0.0.0.0\u0026#34; # TLS configuration over HTTP # All gRPC connections will use the localhost, so no TLS needed tls_min_version: VersionTLS12 http_tls_config: cert_file: \u0026#34;/etc/ssl/certs/localdomain.com.crt\u0026#34; key_file: \u0026#34;/etc/ssl/private/localdomain.com.key\u0026#34; # Log level log_level: info # Default size limit of gRPC messages this server can receive and send (4 MB) grpc_server_max_recv_msg_size: 4194304 grpc_server_max_send_msg_size: 4194304 # Increase the limit on the number of concurrent streams for gRPC # calls per client connection from 100 to 1K grpc_server_max_concurrent_streams: 1000 Common options # These are base configuration options that will be inherited by multiple modules, and which can be overriden in each module-specific configuration section.\nWe will be using the filesystem as storage, which is the default option. The package uses the subdirectory /tmp/loki by default, but we will be adapting that to Debian standards.\n# Common configuration to be shared between multiple modules # See: https://grafana.com/docs/loki/latest/configure/#common common: path_prefix: /var/lib/loki storage: # Use the local filesystem as storage filesystem: # Directory to store chunks in chunks_directory: /var/lib/loki/chunks # Directory to store rules in rules_directory: /var/lib/loki/rules # Instruct components to use the localhost to communicate among themselves instance_addr: 127.0.0.1 # Adapt the default replication factor to a single-instance deploy replication_factor: 1 # Use the in-memory key/value store ring: kvstore: store: inmemory The instance_addr is the IP address components will use to advertise themselves to the cluster. It affects all inter-component communication (ring, gRPC, health checks, etc).\nThe replication_factor determines how many copies of log streams are stored across ingesters. In a single-instance deployment we must set this to 1, as the default value of 3 would cause Loki to attempt replication to non-existent instances.\nThe ring in Loki is a coordination mechanism used by components to track their ownership of data shards. It uses a hash ring to ensure log streams are consistently mapped to specific ingesters, which is key for maintaining data consistency and replication in multi-instance deployments.\nIn our single-instance setup, the ring’s main purpose is to satisfy Loki’s internal architecture requirements, so there is no need for distributed key-value stores like etcd.\nQuery frontend # This section configures how the query frontend component will behave in regards to query splitting and caching. We will be using Redis instead of the default embedded cache, and using compression and caching as much as possible.\n# Configuration options for query splitting and caching in the query-frontend query_range: # Cache backend for the query frontend component results_cache: # Configures the cache backend for a specific component. # See: https://grafana.com/docs/loki/latest/configure/#cache_config cache: # Default validity of entries (unless overridden) default_validity: 1h # Redis server configuration redis: # Redis endpoint endpoint: 127.0.0.1:6379 # Let Loki manage TTL via default validity expiration: 0s # Let Loki auto-scale (10 per CPU core) pool_size: 0 # Password to use when connecting to Redis password: \u0026lt;password\u0026gt; # Keep idle connections open indefinitely idle_timeout: 0s # Keep connections alive forever max_connection_age: 0s # Use compression in cache compression: snappy # Cache query results (default is false) cache_results: true # Default behaviour to cache index stats, volume, series and label query results cache_index_stats_results: true cache_volume_results: true cache_series_results: true cache_label_results: true Global limits # The limits_config block configures global and per-tenant limits in Loki. It supports a large array of options so, to make it easier to understand and maintain, it is presented split into categories. Moreover, we will be using Loki to meet long-term storage legal requirements.\nSample size includes the size of the logs line and the size of structured metadata labels\n# Configure global limits # See: https://grafana.com/docs/loki/latest/configure/#limits_config limits_config: # A. Ingestion and rate limit # Enforce limits globally ingestion_rate_strategy: \u0026#34;global\u0026#34; # Default per-user ingestion rate limit in sample size per second (4MB) ingestion_rate_mb: 4 # Default per-user allowed ingestion burst size (6MB). Burst size is the per-distributor # local rate limiter. Should be aligned with the expected max payload size per push request. ingestion_burst_size_mb: 6 # Default maximum byte rate per second per stream (3MB) per_stream_rate_limit: \u0026#34;3MB\u0026#34; # Default maximum burst bytes per stream (15MB) per_stream_rate_limit_burst: \u0026#34;15MB\u0026#34; # B. Retention and aging # Default behaviour to reject samples meeting the criteria below reject_old_samples: true # Default maximum accepted sample age reject_old_samples_max_age: \u0026#34;1w\u0026#34; # Duration which table will be created/deleted before/after it is needed. # Samples from before this time will not be accepted. creation_grace_period: \u0026#34;10m\u0026#34; # Retention period to apply to stored data. Must be either 0 (disabled) or a multiple of 24h. # Requires `compactor.retention_enabled = true`. 43800 hours equals 5 years. retention_period: \u0026#34;43800h\u0026#34; # Default deletion mode deletion_mode: \u0026#34;filter-and-delete\u0026#34; # C. Query and performance # Enable metric aggregation to speed up histogram queries metric_aggregation_enabled: true # Default maximum number of unique series that is returned by a metric query max_query_series: 500 # Default maximum number of queries that will be scheduled in parallel by the frontend max_query_parallelism: 32 # Default limit to length of chunk store queries max_query_length: 30d1h # Default (lack of) limit to the length of the [range] inside a range query max_query_range: 0s # D. Metadata and features # Do not attempt auto-discovery of log levels during ingestion. # We will do this manually, via regex within Promtail. discover_log_levels: false # Default maximum number of active streams per user, across the cluster max_global_streams_per_user: 5000 # Default behaviour to allow user to send structured metadata in push payload allow_structured_metadata: true # Default behaviour to enable log-volume endpoints for log volume dashboards. # Allows aggregating log counts (or sizes) over specified time ranges, grouped by labels, # e.g., \u0026#34;logs per minute\u0026#34; trend. volume_enabled: true Compactor # The compactor component compacts index shards for performance and also takes care of retention, that is, deleting logs that are considered too old. The default behaviour of Loki is to keep logs forever, which we want to change to meet our needs.\n# Configuration options of the compactor. # See: https://grafana.com/docs/loki/latest/configure/#compactor compactor: # Activate custom (per-stream, per-tenant) retention retention_enabled: true # Default aximum number of tables to compact in parallel max_compaction_parallelism: 1 # Default number of upload/remove operations to execute in parallel when finalizing # a compaction, per compact operation, which can be executed in parallel upload_parallelism: 10 # Define a store to be used for managing delete requests (default is none, which is invalid) # Requires setting `storage_config.filesystem.directory`. delete_request_store: filesystem # Default max number of delete requests to run per compaction cycle delete_batch_size: 70 # Default interval at which compaction operations are run (how often) compaction_interval: 10m # Default delay after which chunks will be fully deleted during retention retention_delete_delay: 2h # Default working directory to store downloaded bloom blocks working_directory: \u0026#34;/var/lib/loki/compactor\u0026#34; Ingester # We will attempt an optimised ingester configuration to balance chunk file count, memory usage and reliability in our single-instance Loki using filesystem storage on ZFS with compression enabled. Flushing of received log streams from memory to disk will happen both based on time and size.\n# Configuration options of the ingester. # See: https://grafana.com/docs/loki/latest/configure/#ingester ingester: # Flush chunks after 24h to prevent too many small files max_chunk_age: 24h # Align with `max_chunk_age` to flush inactive streams chunk_idle_period: 24h # Increase target compressed size (2MB) for chunks to balance file count and query performance. chunk_target_size: 2097152 # Default target uncompressed size (256KB) of a chunk block lets ZFS compression handle this # effficiently. When this threshold is exceeded, the head block will be cut and compressed # inside the chunk. chunk_block_size: 262144 # Retain chunks in memory after they have been flushed for late-arriving logs chunk_retain_period: 15m # Default maximum retries for failed flushes, critical for filesystem reliability max_retries: 10 # How the lifecycle of the ingester will operate lifecycler: ring: # Default period at which to heartbeat to the ring heartbeat_period: 15s # Default heartbeat timeout after which compactors are considered unhealthy within the ring heartbeat_timeout: 1m # Default duration to sleep before exiting on shutdown (no data loss with WAL) final_sleep: 0s Schema # This section configures the chunk index schema and where it is stored. We will be maintaining daily index and chunk tables and we will be splitting indices and chunks into subdirectories to prevent large amounts of files populating a single directory on our local, on-disk time series database.\n# Configuration options of the schema. # See: https://grafana.com/docs/loki/latest/configure/#schema_config # See: https://grafana.com/docs/loki/latest/configure/#period_config schema_config: # Configures the chunk index schema and where it is stored. configs: # Configure what index schemas should be used for from specific time periods # The date of the first day that index buckets should be created - from: \u0026#34;2024-01-01\u0026#34; # Which index to use. Either \u0026#39;tsdb\u0026#39; or \u0026#39;boltdb-shipper\u0026#39;. \u0026lt;store\u0026gt; # and \u0026lt;object_store\u0026gt; below affect which \u0026lt;storage_config\u0026gt; key is used. store: tsdb # Which store to use for the chunks object_store: filesystem # The schema version to use (current recommended schema is v13). schema: v13 # Configures how the index is updated and stored index: # Path prefix for index tables. Prefix always needs to end with a path # delimiter \u0026#39;/\u0026#39;, except when the prefix is empty (default is \u0026#34;index/\u0026#34;). path_prefix: \u0026#34;index/\u0026#34; # Table prefix for all period tables (default is \u0026#34;\u0026#34;) prefix: \u0026#34;index_\u0026#34; # Table period. Retention is only available if the index period is 24h. # Single store TSDB and single store BoltDB require 24h index period. period: \u0026#34;24h\u0026#34; # Configure how the chunks are updated and stored chunks: # Table prefix for all period tables prefix: \u0026#34;chunks_\u0026#34; # Table period period: \u0026#34;24h\u0026#34; # Default number of shards that will be created is fine unless high cardinality is # encountered (many unique label combinations). row_shards: 16 Pattern ingester # The pattern ingester allows the logs to be analyzed for patterns and also enables the creation of Bloom filters. A bloom filter is a space-efficient probabilistic data structure that is used to determine whether a set of data belongs to a subset.\nThe configuration of the bloom servers, responsible for building bloom filters, is done in the bloom_build section. Similarly, the configuration of the bloom gateway server, responsible for serving queries for filtering chunks based on filter expressions, is done in the bloom_gateway section. Both these servers are experimental as of the current version of Loki.\n# Configuration options of the pattern ingester. # See: https://grafana.com/docs/loki/latest/configure/#pattern-ingester pattern_ingester: # Enable the pattern ingester enabled: true # Metric aggregation settings metric_aggregation: # Address of the Loki instance to push aggregated metrics to, # matching `server.http_listen_address` and `server.http_listen_port` loki_address: 127.0.0.1:8080 # HTTP client tuning http_client_config: enable_http2: true proxy_from_environment: false # Fail fast on slow pushes timeout: 10s # Disabled for security follow_redirects: false # Reduce load by incresing the default value (30s) of the interval between operations pull_push_interval: 2m # Configures how the lifecycle of the pattern ingester will operate and where # it will register for discovery. lifecycler: # `ring` inherits from `common.ring` (in-memory) # Default period at which to heartbeat heartbeat_period: 5s # Default heartbeat timeout after which instance is assumed to be unhealthy heartbeat_timeout: 1m # Configuration options for the bloom planner and builder servers bloom_build: # Enable the experimental feature enabled: true # Limit concurrency so two bloom‑build tasks run at once max_builders: 2 # Retry each individual bloom‑build task twice on failure before marking it as failed task_max_retries: 2 # How long the planner will wait for a builder to acknowledge or complete a task before requeuing builder_response_timeout: 30s # ZFS already compresses disk storage, but this helps in-memory transfer efficiency and page size bloom_block_encoding: \u0026#34;zstd\u0026#34; # Once a new bloom block is built, fetch it into the gateway\u0026#39;s cache so queries can use it without extra latency prefetch_blocks: true # Decrease the default to 150MB to keep down the heap footprint of each builder task. # Smaller blocks give the builder more, finer‑grained units of work. # In a single‑instance environment, this helps distribute CPU and I/O more evenly across cores. max_block_size: 150MiB # Maximum size of the raw bloom filter per individual time series. Filters larger than this are dropped. max_bloom_size: 64MiB # Instruct the planner to break the series key‑space into 128 slices so builds can run in parallel, # smaller units, aiming for roughly 8 GB of series data per bloom‑build task. planning_strategy: \u0026#34;split_keyspace_by_factor\u0026#34; split_keyspace_by: 128 split_target_series_chunk_size: 8GB # Configuration options for the bloom planner server planner: # Running the bloom creation planning twice a day is enough planning_interval: 12h # Cover recent activity and include recent historical context. # Setting `min_table_offset`to 0 ensures that the current active index table (where most # writes happen) is included, which enables faster recent queries. # Setting `max_table_offset` to 2 means the planner includes the last two inactive tables # as well, which helps with queries that span recent time windows (e.g., last 24–48h). # Because older tables rarely change, there is little benefit in trying to replan them # every time unless retention requirements change. min_table_offset: 0 max_table_offset: 2 retention: # Enable bloom retention enabled: true queue: # Reduce the default maximum number of tasks to queue per tenant to keep the queue size # modest, reducing the change of OOM and GC pressure in our single instance. Even under # heavy indexing, 1000 pending bloom‑build tasks provides ample headroom. max_queued_tasks_per_tenant: 1000 # Move queued tasks off the heap and onto the ZFS filesystem to avoi bloating memory. # ZFS has built-in compression, which makes on-disk queues very space-efficient. store_tasks_on_disk: true # Directory to store tasks on disk. tasks_disk_directory: /var/lib/loki/bloom-planner-queue # Default setting not to clean the tasks directory upon startup. clean_tasks_directory: false # Configuration options for the bloom builder server builder: # Address and port of the bloom planner, # matching `server.grpc_listen_address` and `server.grpc_listen_port`. planner_address: 127.0.0.1:8081 # See: https://grafana.com/docs/loki/latest/configure/#grpc_client grpc_config: # Decrease the maximum size of messages from 100MB to 10MB to prevent a single huge # bloom‑filter transfer from triggering a GC stall or OOM in our single-instance deploy # and to align with expected bloom-block sizes max_send_msg_size: 10485760 max_recv_msg_size: 10485760 # Controls how the builder retries when an individual bloom‑build task (its gRPC call to # the planner) fails temporarily, e.g., due to CPU contention, or I/O stall). # It implements an exponential‑style retry delay so that the system: # 1. Doesn’t hammer the planner continuously on every failure # 2. Gives transient issues time to clear before trying again. # 3. Eventually gives up (after `max_retries`) backoff_config: # These backoff settings keep bloom‑build tasks responsive to transient hiccups while # ensuring fail‑fast behavior for persistent problems—ideal for a single‑instance # Prevents hot‑looping on very rapid retries (100 ms can be too tight under load). # A slightly longer base delay gives transient pressure (e.g. brief CPU spikes or # filesystem contention) time to settle. min_period: 250ms # Caps backoff so that, in persistent error scenarios, we don’t end up waiting a # full 10 s before retrying. A 5 s ceiling balances giving the system breathing # space versus surfacing issues faster. max_period: 5s # Halves the default retry count so that truly failing tasks will give up sooner, # free up queue slots, and let you detect and investigate root causes, rather than # thrashing on repeated futile retries. max_retries: 5 bloom_gateway: # Turn the gateway on so queries can use Bloom filters to skip irrelevant chunks # and actually apply the bloom‑based chunk filtering in the read path enabled: true enable_filtering: true # Number of parallel workers testing chunks against Bloom filters worker_concurrency: 2 # Lower the number of blocks each worker can check at once to reduce peak memory and gRPC streams block_query_concurrency: 4 # Reduce the size of the in-flight Bloom-filter checks per tenant queue to keep memory bounded # and back-presure predictable in our single-instance. max_outstanding_per_tenant: 256 # Redice the chunk-filter tasks to batch together to reduce per-RPC payload size, easing gRPC # backpressure and GC presure. num_multiplex_tasks: 128 client: # Point the gateway\u0026#39;s gRPC client at the planner endpoint, # matching `server.grpc_listen_address` and `server.grpc_listen_port`. addresses: 127.0.0.1:8081 pool_config: # Decreas how often the client refreshes its list of gateway backends, to reduce DNS or # service-discovery churn on a stable, single-node address list. check_interval: 30s grpc_client_config: # Cap gRPC message sizes to 10 MB to bound per-RPC memory (from 100 MB) to reduce chances of # triggering GC spikes if a single RPC returns many blocks. max_send_msg_size: 10MiB max_recv_msg_size: 10MiB Together, these settings let our Loki instance actually use Bloom filters for faster queries, while keeping resource use bounded and predictable on a single‑node ZFS system.\nMemory: Lower concurrency, smaller batches and tighter limits on in‑flight tasks/RPC sizes prevent a single process from ballooning RAM usage. CPU: Fewer workers and block‑checks align with modest core counts (2–4 cores), avoiding excessive context‑switching. Filesystem: ZFS compression and caching handle on‑disk Bloom blocks; smaller in‑memory buffers play nicely with ARC without displacing hot data. Ruler # The Loki Ruler continuously evaluates Prometheus‑style recording and alerting rules against our log data. At this point, we will not be using any rules, neither recording nor alerting. We will configure and use Alertmanager later on in this series, in a separate article.\n# Top‑level storage config for the ruler (replaces deprecated `ruler.storage`) ruler_storage: backend: filesystem local: # Where rule files in YAML format will be stored directory: /var/lib/loki/rules ruler: # Do not expose the alert‑rule API until Alertmanager is in play enable_api: false Frontend # The frontend in Loki sits at the edge of the query path. It accepts incoming HTTP queries, handles request‑level concerns, such as timeouts, body‑size limits and logging, enforces per‑tenant concurrency controls, and then forwards work to the querier or scheduler. Tuning the frontend lets us balance throughput, latency, and resource use.\nfrontend: # Log slow queries log_queries_longer_than: 500ms # Include these request headers in slow‑query logs log_query_request_headers: \u0026#34;User‑Agent,X‑Request‑ID\u0026#34; # Enable per‑query stats query_stats_enabled: true # Bump max body size of requests from 10 MB to 20 MB max_body_size: 20971520 # Throttle concurrent outstanding queries per tenant to bound memory, # improving efficiency of ZFS ARC, if present max_outstanding_per_tenant: 512 # Increase the time between DNS lookups of the scheduler scheduler_dns_lookup_period: 30s # Reduce the time to wait for in‑flight queries on shutdown graceful_shutdown_timeout: 2m For reference, the default value of the encoding parametre, i.e., json, only affects how the frontend interprets the incoming query payloads over HTTP, not how it talks to queriers or schedulers. Those interactions use gRPC with protobuf, regardless of this setting. Moreover, HTTP responses are compressed by default.\nIn our single-instance Loki we will not be using sharding, therefore the default values of frontend.enable_sharding: false and frontend.strategy: default are adequate.\nSlow‑query logging \u0026amp; stats will allow us to tune performance. They will be visible in the journald using a format similar to the following one:\n# journalctl --unit=loki --follow level=info ts=2025-05-12T14:50:02.123Z caller=frontend.go:XXX msg=\u0026#34;slow query detected\u0026#34; query_duration=611.342ms method=GET path=/loki/api/v1/query_range params=\u0026#34;...\u0026#34; headers=\u0026#34;User-Agent=Grafana/X.X\u0026#34; Querier # The querier is Loki’s workhorse for executing log queries. It pulls data from both in-memory ingesters and long-term storage (chunks), merges and filters streams, applies query transformations (e.g., |= or |~), and returns the assembled result to the frontend or directly to the client.\nquerier: # Adapt the number of concurrent queries for 2-4 CPU cores max_concurrent: 4 # Decrease message size from 100 MiB to 10 MiB to bound memory per-RPC grpc_client_config: max_send_msg_size: 10485760 max_recv_msg_size: 10485760 Most default values in this section are already aimed at a single-instance Loki installation, thus we just had to adjust the concurrency and the message size. Next you can find the list of directives with default values that you can add to your configuration file for reference, or skip them if you prefer to keep it shorter.\n# Default values of the engine, for reference engine: # Cap how far an instant query looks back max_look_back_period: 30s # topk sketch size max_count_min_sketch_heap_size: 10000 # Default values regarding multi-tenancy, for reference # Read both ingesters \u0026amp; store query_store_only: false # Skip store if object store is unavailable query_ingester_only: false # Single-tenant mode multi_tenant_queries_enabled: false # No header-based overrides per_request_limits_enabled: false # No partitioning of ingesters query_partition_ingesters: false # Default values of query size and volume limits, for reference # Prevent runaway chunk scans max_chunks_per_query: 2000000 # Cap series returned max_query_series: 500 # Allow going all the way back in time when querying data and metadata max_query_lookback: 0s # Maximum span of a single query max_query_length: 30d1h # Do not limit the length of the range in range queries max_query_range: 0s # Maximum number of queries that will be scheduled in parallel by the frontend max_query_parallelism: 32 # Maximum number of queries will be scheduled in parallel by the frontend for TSDB schemas. tsdb_max_query_parallelism: 128 # Target maximum number of bytes assigned to a single sharded query tsdb_max_bytes_per_shard: 600MB # Sharding strategy to use in query planning tsdb_sharding_strategy: \u0026#34;power_of_two\u0026#34; # Default values of frontend and scheduler integration, for reference. When neither # `frontend_address` nor `scheduler_address` are set, queries are only received via HTTP endpoint. frontend_address: \u0026#34;\u0026#34; scheduler_address: \u0026#34;\u0026#34; Query range # This block governs how range queries are split for parallelism and how their partial results are cached before assembly. Loki offers six separate results caches in the query_range/querier scope:\nCache type What is cached Time‐range results Final merged time-series datapoints returned by a range query Index statistics Series counts and label-cardinality statistics used in dashboards Log‐volume metrics Total count and size of log lines matching a query over a time range Series lists Sets of series keys that match a given log selector Label values All observed values for a particular label name and selector Instant metrics Single-point metric queries (e.g., error rates, gauges at now) We will be configuring all of them to use Redis to benefit from persistence across restarts. Unfortunately, at the moment Loki does not offer a way to reduce the verbosity of such configuration.\nThe default values of all other directives suit our needs. We will be explicit about two of them, for reference.\nquery_range: # Keep raw time bounds, i.e., do not mutate incoming queries to align their # start and end with their step (this is the default behaviour). align_queries_with_step: false # Do not attempt to parallelise query execution via a shared scheduler (default behaviour). parallelise_shardable_queries: false # Time-range results cache cache_results: true results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; expiration: 1h pool_size: 10 idle_timeout: 30s max_connection_age: 5m compression: snappy # Index‐stats cache cache_index_stats_results: true index_stats_results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; # Fresher index counts expiration: 15m pool_size: 5 idle_timeout: 30s max_connection_age: 5m compression: snappy # Volume‐results cache cache_volume_results: true volume_results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; expiration: 1h pool_size: 5 idle_timeout: 30s max_connection_age: 5m compression: snappy # Series‐results cache cache_series_results: true series_results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; expiration: 1h pool_size: 5 idle_timeout: 30s max_connection_age: 5m compression: snappy # Label‐values cache cache_label_results: true label_results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; # Labels change less often expiration: 2h pool_size: 5 idle_timeout: 30s max_connection_age: 5m compression: snappy # Instant‐metric cache cache_instant_metric_results: true instant_metric_results_cache: cache: redis: endpoint: 127.0.0.1:6379 password: \u0026lt;password\u0026gt; expiration: 30m pool_size: 5 idle_timeout: 30s max_connection_age: 5m compression: snappy Some use cases can help understand what is stored in each cache. The LogQL expressions are not efficient, but they have intentionally been kept simple.\nCache type LogQL expression Use case Time-range results `count_over_time({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo; [5m])` Index statistics `count_over_time({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo; [1h])` Log volume `count_over_time({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo; [5m])` Series list `count_over_time({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo; [1h])` Label values `label_values({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo;, status)` Instant metrics `count_over_time({job=\u0026ldquo;nginx\u0026rdquo;} = \u0026ldquo;GET\u0026rdquo; [1m])` Although some of the examples are repeated, each is cached and used differently under the hood. We are getting ahead of ourselves, but note that the same query (e.g., count_over_time({job=\u0026quot;nginx\u0026quot;} |= \u0026quot;GET\u0026quot; [1m])) may use multiple caches, i.e., it is cached differently depending on how the query is run:\nIf it is used in a Grafana graph panel (with a time range), it will be executed as a range query (via /loki/api/v1/query_range), and the result will be cached in the time-range results cache. If it is used in a gauge panel, an alert rule, or Grafana’s “Instant” mode, it becomes an instant query (via /loki/api/v1/query), returning a single value, therefore this result will be cached in the instant metric cache. If Grafana needs to autocomplete label values for a filter (like status), it might run a query like label_values(...), which is served by the label values cache. So, even if two queries look the same in LogQL, Loki may cache and retrieve them differently depending on how and where they are executed.\nIngesting logs # Loki ingests logs by flowing them through a set of components, each with a specific role in accepting, processing, storing, and indexing log data. While some components are optional or only used in larger deployments, understanding the overall ingestion path helps clarify how logs are labeled, routed, stored, and queried efficiently. Below is a high-level walkthrough of the ingestion pipeline:\nDistributor. Accepts incoming log entries from clients (e.g., Promtail), validates them, splits them into streams based on labels, and assigns them to ingesters using consistent hashing. It ensures that logs with the same label set are routed to the same ingester.\nIngester. Receives logs from the distributor and temporarily buffers them in memory. It batches logs into compressed chunks, which are flushed to long-term storage when they reach a size, age, or idle threshold. Ingester also handles log replication and exposes recent logs for queries.\nQuery frontend (optional). Sits between Grafana (or API clients) and the querier. It improves query responsiveness by splitting large queries into subqueries, caching results, and distributing load. Especially useful in high-volume or multi-tenant setups.\nQuery scheduler (optional). Enhances scalability and fairness by decoupling query queueing from execution. It receives subqueries from the query frontend, enqueues them in per-tenant queues, and dispatches them to queriers for execution.\nQuerier. Executes user queries written in LogQL. It fetches recent logs from ingesters and historical chunks from storage, merges the results, filters them by labels and content, and returns them to the user.\nIndex gateway. Acts as an intermediate between queriers and the index store. It caches and serves index data (i.e., label → chunk mappings), reducing pressure on the index backend and improving query latency.\nChunk store. The long-term storage backend for compressed log chunks. This can be a local filesystem, object storage (e.g., S3, GCS), or another supported store. Chunks are stored in efficient compressed formats.\nIndex store. Stores metadata about where to find logs based on label matchers. This index maps stream labels to chunk references and is used to quickly find candidate chunks during query execution.\nPromtail. A log shipper that reads logs from sources like files, journald, or syslog. It attaches labels (e.g., job, host, app) and sends the enriched logs to Loki’s distributor via HTTP or gRPC.\nWhere does it store data # Grafana Loki stores its data in chunks and indexes:\nChunks. Contain the actual log data, compressed and stored in object storage systems. Indexes. Contain metadata (labels) stored in databases. Loki supports various storage backends, the most relevant being:\nLocal: Time Series Database (TSDB) on the filesystem. Remote: S3, or other object storage systems for scalability. Data is stored in a directory, /var/lib/loki/ in our case, as defined in the common.path_prefix key.\nInside chunks/ we will find two sub-directories, fake/ and index/. The former is the tenant id in our single-tenant deployment and holds all chunks (log data), whereas the latter stores index files (metadata mapping labels to chunks).\nIn our single-tenant instance we will be using the filesystem to store our chunks (/var/lib/loki/chunks/fake). Later on this series we will be optionally switching to S3.\nDirectory Purpose chunks/fake/ Stores all chunks (log data) for our single-tenant instance chunks/index/ Stores index files (metadata mapping labels to chunks) compactor/ Compactor working files (retention/deletion operations) wal/ Write-Ahead Log to buffer recent log entries before they are flushed tsdb-shipper-active/ Holds active TSDB blocks (index and metadata) before upload tsdb-shipper-cache/ Cache for uploaded or downloaded index blocks rules/ Local directory for rule groups (recording \u0026amp; alerting) TSDB shipper directories are used when Loki runs with TSDB index storage, which is the default behaviour, enabled via the schema_config.configs.store key, even in local-only mode (i.e., when not uploading to an object store).\ntsdb-shipper-active/ contains TSDB block files that are currently being built and compacted. tsdb-shipper-cache/ holds metadata about uploaded or downloaded blocks for faster access and deduplication. To safeguard against crashes, Loki uses a WAL stored in segments within the wal/ subdirectory, which can be replayed upon server restart to recover data. The WAL is used by both the ingester and ruler components.\nLater on this series we will be using alerting rules. Loki will store rule group definitions in the rules/ directory when using the filesystem in the ruler_storage.backend configuration key.\nLocated at /etc/systemd/system/loki.service` ↩︎\nThe Thanos Object Storage Client provides a unified interface to work with various object storage providers. ↩︎\nBloom filters are space-efficient, probabilistic data structures used to test whether an element is a member of a set. ↩︎\n","date":"24 September 2024","externalUrl":null,"permalink":"/en/posts/grafana/loki/","section":"Posts","summary":"Install and configure a Loki server to receive and store logs sent with Promtail","title":"Storing log data with Loki","type":"posts"},{"content":"This article will lead you through the necessary steps to create the cluster and perform its initial configuration. Both the Hetzner firewall and the Proxmox firewall will be configured to allow the necessary traffic between the cluster nodes and the guests.\nIn previous articles, we set up the 10.0.0.0/24 local network for our nodes by performing the following steps:\nConfigured the eno1.4003 interface on each node. Configured the /etc/hosts file on each node. Created the vSwitch with id 4003 and added the nodes to it. Therefore, nodes should be able to ping each other over this network.\nCertificates # By default, Proxmox installs a self-signed certificate. We will be using Let’s Encrypt through the ACME protocol (Automatic Certificate Management Environment) to obtain a valid certificate for the node, which will be renewed automatically by Proxmox from then onwards.\nThis section only applies the first time a new cluster is configured. Skip it when adding a new node to an existing cluster.\nAccount # At the first server (not yet a node since we have not created the cluster yet) we will configure the account, then the challenge plug-in. Using the WebGUI, go to the Datacenter \u0026gt; ACME menu option and add the account using the button on the top:\nAccount name: \u0026lt;somename\u0026gt;, e.g., calabruix. E-Mail: \u0026lt;youremail\u0026gt;, e.g., [[email protected]](https://calabruix.es/cdn-cgi/l/email-protection). ACME Directory: Let's Encrypt V2 (production). Accept the terms of service and click Register.\nChallenge plug-in # The default challenge plugin is HTTP, which is already installed. For it to work, the following conditions must be met:\nPort 80 of the node needs to be reachable from the internet (i.e., a firewall rule needs to be added). There must be no other listener on port 80. The requested subdomain (e.g., proxmox1.publicdomain.com) needs to resolve to the public IP of the node. Optionally, if you are using Cloudflare, you can add an additional challenge using DNS by using the Add button right below the Challenge Plugins section:\nPlugin id: cloudflare Validation delay: 30 DNS API: Cloudflare Managed DNS Account id: [..] Token: [..] Zone id: [..] (optional) The account id and zone id can be copied from the bottom right corner of the publicdomain.com domain overview page at Cloudflare’s dashboard. The API token can be obtained (with finegrained permissions) at the API Tokens menu option of your user’s profile.\nIssuing the certificate # In the main menu, select the server proxmox1, go to the System \u0026gt; Certificates menu option and, in the ACME section, use the Add button to add the certificate request data:\nChallenge type: DNS or HTTP Plug-in: cloudflare (if you selected the DNS challenge type) Domain: proxmox1.publicdomain.com Still in the ACME section of the screen, choose the account by clicking the Edit button next to the Using account label, select the account created before (e.g., Calabruix) and click Apply. Finally, click the Order Certificates Now button.\nThe process will place the order, which will consist of:\nValidating the ownership of the domain. Sending the CSR (certificate request). Waiting for the certificate to be issued. Installing the certificate and restarting the PVE Proxy. Once the process is finished, you will need to close the browser tab and open a new one to access the WebGUI using the new certificate.\nProxmox will take care of renewing the certificate automatically.\nUnfortunately, wildcard certificates cannot be issued through the user interface so we will have to repeat the process for each node once it has become part of the cluster.\nCluster creation # The cluster will be created on the first node, then the second and third nodes will join it. The following command will create the cluster and set up the necessary configuration files on the first node.\nAccess the WebGUI of the first node at https://proxmox1.\u0026lt;publicdomain.com\u0026gt;:8006/ and log in with the root user:\nUser name: root Password: \u0026lt;yourpassword\u0026gt; Realm: Linux PAM standard authentication Language: English - English (default) To create a cluster go to Datacenter \u0026gt; Cluster and click on Create cluster. Use this information:\nCluster name: \u0026lt;clustername\u0026gt; Cluster network: choose the node private address 10.0.0.1 from the list. Hit Create and wait for the process to finish. The server is now a node of a single-node cluster.\nAlternatively, you can create the cluster from the terminal by running the following command:\npvecm create \u0026lt;clustername\u0026gt; Where \u0026lt;clustername\u0026gt; is the name of your cluster, e.g., calabruix or staging.\nTwo-Factor Authentication # To enhance security, it is recommended to enable Two-Factor Authentication (2FA) for the root user. This can be done through the WebGUI by going to the menu option Datacenter \u0026gt; Users \u0026gt; Two Factor and click the button Add: TOTP. Follow the usual steps.\nFor 2FA to work, it requires the exact same software versions on all nodes.\nHetzner’s firewall # Hetzner’s firewall only takes care of incoming traffic and its rules are processed before the packets arrive at our Proxmox installation, including the packets that travel through the vSwitches (VLAN), including the public IP subnet.\nIt is a secondary layer of protection but it does not protect against DDoS attacks. For that, Hetzner includes an automated system, which is always active and included with the server fees.\nThe number of rules are limited to 10. Rule number 11 is to drop all incoming traffic not allowed before. Create the firewall template using the New template button in the Firewall templates page of the control panel. Adapt the following proposal to your needs:\nName: Proxmox VE Use by default: Yes Filter IPv6 packets: No Hetzner services (incoming): Yes # Name Source IP Destination IP S. port D. port Protocol TCP flags Action 1 Ping icmp accept 2 Proxmox WebGUI 8006 tcp accept 3 OpenSSH 2001-2010 tcp accept 4 HTTP 80,443 * accept 5 Proxmox hosts 10.0.0.0/24 10.0.0.0/24 * accept 6 Proxmox guests 192.168.0.0/16 192.168.0.0/16 * accept 7 Public subnet v4.public.ip.subnet/28 * accept 8 Ephemeral port range 1 32768-65535 tcp ack accept Select and apply the template to all the servers via the Firewall tab of each server in the server list of the control panel.\nIn the ruleset above, all traffic to the floating public IP addresses is allowed, which means it is only filtered by the PVE Firewall. Once all the services in the cluster have been set up, it may be a good idea to revisit rule number 7.\nProxmox’s firewall # The Proxmox VE firewall allows setting up firewall rules for all hosts inside a cluster, as well as for virtual machines and containers. Features like macros, security groups, IP sets and aliases help making that task easier.\nAll firewall related configuration is stored in the Proxmox cluster file system at /etc/pve/, so those files are automatically distributed to all cluster nodes, and the pve-firewall service updates the underlying iptables rules automatically on changes. Because the iptables-based firewall service runs on each cluster node, it provides full isolation between virtual machines.\nThe PVE Firewall groups the network into two logical zones:\nHosts: Traffic from/to a cluster node. Guests: Traffic from/to a virtual machine or container. By default, the firewall is disabled at the datacentre and guest levels, and enabled at the node level. We can check this by visiting the Datacenter \u0026gt; Firewall \u0026gt; Options menu option.\n# /etc/pve/firewall/cluster.fw [OPTIONS] enable: 1 When the firewall is disabled at the datacentre level, it will remain disabled even if enabled at the node level. To enable the firewall for a node, you must first enable it at the datacentre level. To enable the firewall for a guest, you must first enable it at both the datacentre and node levels.\n# /etc/pve/nodes/\u0026lt;node\u0026gt;/firewall/host.fw [OPTIONS] enable: 1 Note: The firewall is enabled by default at the node level, so you will not see the enable option in the file unless you disable it first.\nThe default policies are to accept all outgoing traffic and to drop all incoming traffic.\nIP aliases # IP aliases allow us to associate an IP address or subnet to a name. We will be able to refer to those names inside IP set definitions and in source and destination properties of firewall rules. For example, we can create a few aliases for some guests we already have plans for.\n# /etc/pve/firewall/cluster.fw [ALIASES] ipv4_private_ansible1 192.168.0.1 # Ansible Controller ipv4_private_nginx1 192.168.0.2 # NGINX 1 ipv4_private_nginx2 192.168.0.3 # NGINX 2 ipv4_public_nginx1 v4.floating.ip.1 # NGINX 1 ipv4_public_nginx2 v4.floating.ip.2 # NGINX 2 ipv4_public_office v4.office.ip.addr # Work office An alias named localnet is automatically defined by Proxmox to represent the local network. Use the command pve-firewall localnet to see assigned values.\nIPv4 and IPv6 aliases are added separately at the Datacenter \u0026gt; Firewall \u0026gt; Alias menu option, hence the prefix.\nIP sets # IP sets allow us to associate a number of aliases or subnets to a name. We will be able to refer to those names in source and destination properties of firewall rules. For example, we can create an two IP sets named private_webservers and public_webservers with their respective aliases.\n# /etc/pve/firewall/cluster.fw [IPSET private_webservers] # NGINX guests ipv4_private_nginx1 ipv4_private_nginx2 [IPSET public_webservers] # NGINX guests ipv4_public_nginx1 ipv4_public_nginx2 The following three IP sets have special meanings when manually created by the administrator:\nName Description Zone management Allows IPs to do access management tasks (WebGUI, SSH) Hosts blacklist Blocks specific IP addresses Hosts, guests ipfilter-netX Used in every guest’s firewall to prevent IP spoofing Guests When added, they will be found in the /etc/pve/firewall/cluster.fw file:\n# /etc/pve/firewall/cluster.fw [IPSET management] ipv4_public_office [IPSET blacklist] some.funny.ip.address another.funny.ip.address [IPSET ipfilter-net0] # Only allow IPs from the private network on net0 192.168.0.0/16 For containers with configured IP addresses, the ipfilter-netX sets, if they exist (or are activated via the general IP Filter option in the guest’s Firewall \u0026gt; Options tab), implicitly contain the associated IP addresses. If such a set exists for an interface, then any outgoing traffic with a source IP not matching its interface’s corresponding ipfilter set will be dropped.\nSecurity groups # Security groups are collection of rules, defined at cluster level, which can be used in all guests’ rules. For example, we can create a security group named webserver with rules to open the HTTP and HTTPS ports.\n# /etc/pve/firewall/cluster.fw [group webserver] # Default rules for web servers IN HTTP(ACCEPT) -log nolog # Allow HTTP traffic IN HTTPS(ACCEPT) -log nolog # Allow HTTPS traffic IN ACCEPT -p udp -dport 443 -log nolog # Allow HTTP/3 traffic Then, this group can be added to a guest’s firewall:\n# /etc/pve/firewall/\u0026lt;VMID\u0026gt;.fw [RULES] GROUP webserver -i net0 # Allow access to NGINX from guests GROUP webserver -i net1 # Allow access to NGINX from the Internet Configuration # At the moment, after installation, the following addresses and ports have services listening on them:\nService Description Address Port Protocols pvedaemon Proxmox VE API Daemon 127.0.0.1 85 TCP master Postfix 127.0.0.1 25 TCP init RPC bind 0.0.0.0 111 TCP, UDP sshd Secure SHell v4.static.ip.1 2001 TCP sshd Secure SHell v4.static.ip.1 22 TCP pveproxy Web interface 0.0.0.0 8006 TCP spiceproxy SPICE 2 0.0.0.0 3128 TCP corosync Clustering Engine 3 10.0.0.1 5405 UDP However, this list of ports needs to be expanded with the following:\nService Description Address Ports Protocols QEMU VNC Web console v4.static.ip.1 5900-5999 TCP, Websocket corosync Clustering Engine 10.0.0.1 60000-60050 UDP QEMU Live migration 10.0.0.1 5900-5999 TCP Before adding new nodes to the cluster, we are going to do a basic configuration of the firewall on our only node, proxmox1, using the web interface.\nUsing the Datacenter \u0026gt; Firewall \u0026gt; Alias menu option we will be creating aliases\nFor each node. For the IP address of our work place. Per private network range, for future use (optionally). Name IP/CIDR Comment ipv4_public_proxmox1 v4.static.ip.1 Proxmox 1 ipv4_public_proxmox2 v4.static.ip.2 Proxmox 2 ipv4_public_proxmox3 v4.static.ip.3 Proxmox 3 ipv4_public_office v4.office.ip.addr Work office ipv4_link_local_169 169.254.0.0/16 RFC3927 ipv4_private_10 10.0.0.0/8 RFC1918 ipv4_private_172 172.16.0.0/12 RFC1918 ipv4_private_192 192.168.0.0/16 RFC1918 ipv4_shared_100 100.64.0.0/10 RFC6598 Later one we will add aliases for guests.\nUsing the Datacenter \u0026gt; Firewall \u0026gt; IPSet menu option we will be creating IP sets:\nFor private networks. For Hetzner’s System Monitor. For the cluster nodes public addresses, using the alias we created before. For the management IP addresses. Name Comment Aliases management Management IPs ipv4_public_office private_hosts Hosts ipv4_private_10 private_guests Guests ipv4_private_192 public_hetzner_sysmon Hetzner SysMon 188.40.24.211, 213.133.113.82, 213.133.113.83, 213.133.113.84, 213.133.113.86 public_hosts HOsts ipv4_public_proxmox1, ipv4_public_proxmox2, ipv4_public_proxmox3 If we enable the firewall, traffic to all hosts is blocked by default, with the only exceptions being the web interface (WebGUI) on port 8006 and the secure shell (OpenSSH) on port 22, but only from the local network and the IP addresses added to the management IP set.\nFinally, using the Datacenter \u0026gt; Firewall menu option we will be creating rules:\nTo allow ping among nodes. To allow ping among guests. To allow ping from anywhere (optionally). To allow inbound traffic to the WebGUI not only from management IPs (optionally). To allow ping from Hetzner Server Monitoring (optionally). To allow connections to the public static IP addresses of the cluster nodes via SSH. Type Action Macro Iface Protocol Source S. port Destination D. port Comment in ACCEPT Ping +public_hetzner_sysmon +public_hosts Allow ping from Hetzner’s SysMon in ACCEPT Ping +private_hosts +private_hosts Allow ping among nodes in ACCEPT Ping +private_guests +private_guests Allow ping among guests in ACCEPT tcp +public_hosts 8006 Allow access to WebGUI from anywhere in ACCEPT tcp +public_hosts 2001:2010 Allow external SSH traffic to node You will want to adapt these rules to your needs. For instance, you may want to add a rule to allow some external uptime monitoring solution to access the WebGUI so that an HTTP check can be performed.\nWe do not need to add a rule to allow SSH traffic among nodes (subnet 10.0.0.0/24) because that is automatically set by the PVE Firewall.\nIf you want to be more explicit regarding access via SSH to the nodes, add the following rule via Datacenter \u0026gt; Node \u0026gt; Firewall on each node, adapting the port to each node:\nType Action Macro Interface Protocol Source S. port Destination D. port Comment in ACCEPT tcp 2001 Allow external SSH traffic to node We previously configured our SSH daemons to listen to port 2001 and onwards on their public IP addresses.\nOpen a SSH connection to one of your Proxmox VE hosts before enabling the firewall so that you still have access to the host if something goes wrong, then enable the firewall at the datacentre level by using the Datacenter \u0026gt; Firewall \u0026gt; Options \u0026gt; Firewall menu option.\nLater on, more firewall rules will be added at the guest level to allow access to specific services from certain locations.\nDefault rules # Some traffic is automatically filtered by the default firewall configuration. This acts as a safeguard, to prevent lock-outs.\nAt the datacentre level, if the input or output policy is set to DROP or REJECT, the following traffic is still allowed for all hosts in the cluster:\nProtocol Description Any Traffic over the loopback interface Any Already established connections IGMP Manage multicast group memberships TCP From management IPSet to port 8006 (WebGUI) TCP From management IPSet to port range 5900-5999 (VNC web console) TCP From management IPSet to port 3128 (SPICE proxy) TCP From management IPSet to port 22 (SSH) UDP From the cluster network to port range 5405-5412 (Corosync) UDP Multicast traffic in the cluster network ICMP Type 3 (destination unreachable), 4 (congestion control) or 11 (time exceeded) However, the following traffic is dropped, but not logged even with logging enabled:\nProtocol/Mode Description TCP Connections with invalid connection state Broadcast 4 Not related to corosync, i.e., not through ports 5405-5412 Multicast 5 Not related to corosync, i.e., not through ports 5405-5412 Anycast 6 Not related to corosync, i.e., not through ports 5405-5412 TCP Traffic to port 43 (WHOIS) UDP Traffic to ports 135 (RPC endpoint mapper) and 445 (SMB) UDP Traffic to the port range 137-139 (NetBIOS) UDP Traffic form source port 137 (NetBIOS Name Service) to port range 1024-65535 UDP Traffic to port 1900 (SSDP) TCP Traffic to port 135, 139 and 445 (see above) UDP Traffic originating from source port 53 (DNS) At the guest level, if the input or output policy is set to DROP or REJECT, this drops or rejects all the traffic to the guests, with some exceptions for DHCP, NDP, router advertisement, MAC and IP filtering depending on the set configuration. The same rules for dropping/rejecting packets are inherited from the datacenter, while the exceptions for accepted incoming/outgoing traffic of the host do not apply.\nLogging # By default, all logging of traffic filtered by the firewall rules is disabled. To enable logging, the loglevel for incoming or outgoing traffic has to be set in the Firewall \u0026gt; Options menu option. This can be done individually for the host as well as for the guests.\nWhen enabled, output of logging of Proxmox VE’s standard firewall rules can be reviewed via the Firewall \u0026gt; Log menu option. However, only some dropped or rejected packets are logged for the standard rules.\nZFS pool # ZFS is a modern, open-source filesystem and logical volume manager designed for scalability, data integrity, and simplified storage administration. Unlike traditional filesystems, ZFS integrates the following features into a single cohesive system:\nVolume management. Advanced RAID (software-defined redundancy). Snapshots. Compression. Built-in checksumming. Each node of the cluster should have a pair of SSD disks, set up with RAID 1 upon installation, that hold the operating system and offer space for containers and virtual machines as well. If they have additional HDD or SSD we can set a ZFS pool on them and benefit from the extra features that this filesystem offers for our Proxmox cluster, the most relevant being:\nThin provisioning when assigning virtual disks to a VM or subvolumes to an LXC. No need to manage partitions, as ZFS combines volume management, filesystem, and RAID functionality into a single stack. Instant snapshots and clones with near-zero storage overhead. Built-in compression (LZ4), that reduces storage footprint (~2-3x) with minimal CPU impact, improving effective I/O throughput. Adaptive Read Cache (ARC) optimises RAM usage. Optionally, SSD-based L2ARC boosts read performance for HDD-backed pools 6. Provisioning generally refers to the process of making resources or services available to users, systems, or applications. In our current context, provisioning refers to how storage space is allocated to virtual disks. ZFS uses thin provisioning by default, meaning it reserves the requested space but does not immediately consume the physical space. This leads to three key benefits:\nSpace efficiency. When you create a 100GB virtual disk (zvol), ZFS reserves but does not immediately consume 100GB of physical space. Dynamic growth. Physical storage is allocated incrementally only as data is actually written by the guest. Overcommitment. You can safely allocate more virtual storage than physically available (e.g., assign 2TB total to guests on a 1TB pool). We already installed the zfsutils-linux package when we installed Proxmox, so the zfs kernel module should already be loaded. Therefore, in the WebGUI, we can navigate straight to the Disks \u0026gt; ZFS menu option of the node with the spare disks, should we have any, and click on the Create ZFS button. Fill in the necessary details:\nName: zfspool 7 RAID level: Mirror Compression: on ashift: 12 Select the two disks from the list below (e.g., /dev/sda and /dev/sdb) and click the Create button. If you left the Add storage checkbox ticked, you will also get it added to the Proxmox VE Storage, available at Datacenter \u0026gt; Storage.\nFinally, regarding the ZFS ARC, it would be ideal if we could allocate ~1GB of RAM per TB of storage for ARC efficiency. Let’s asume our node has 2x 8TB HDD assigned to the ZFS pool. Therefore, we would aim for 8GB of RAM via the /etc/modprobe.d/zfs.conf configuration file:\noptions zfs zfs_arc_max=8589934592 options zfs zfs_arc_min=4294967296 You will need to reboot the server for these changes to take effect.\nYou can check the ephemeral port range of your Proxmox installation by running sysctl net.ipv4.ip_local_port_range on any of the nodes. ↩︎\nA remote display system used by Proxmox VE to provide access to virtual machines. ↩︎\nA cluster management tool used by Proxmox VE to coordinate multiple nodes. ↩︎\nIn broadcast, a single packet is sent to all devices on a network segment. It is a one-to-all communication. ↩︎\nMulticast sends a packet to a specific group of devices, rather than all devices on the network. It is a one-to-many communication. ↩︎\nAnycast delivers a packet to the nearest member of a group of potential receivers. This is a one-to-nearest communication, typically used to optimise delivery and reduce latency. ↩︎ ↩︎\nMake sure that all your ZFS pools share the same name across the nodes of the cluster. ↩︎\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/cluster-creation/","section":"Posts","summary":"Turning your single PVE server into a one-node cluster and configuring the firewall","title":"Creating the Proxmox cluster","type":"posts"},{"content":"Once we have our Proxmox cluster up and running, whether it has just one node or multiple nodes already, we will eventually have to go through the process of adding a new node to the cluster.\nAdding a node to a cluster is a straightforward process, but it requires careful attention to detail to ensure that everything works smoothly.\nPlanning # It is imperative that we follow a set of well-defined steps to avoid human errors. Any of the existing nodes can be used as basis to add new nodes, but we will always use the first node as the reference point.\nThe steps to follow are:\nAdd the server to the virtual switches. Install and configure the operating system. Install the Proxmox packages. Edit the /etc/hosts file on all nodes, existing and new, so that there is an entry for each node, including the new node being added. Test connectivity among nodes using ping, including the new server, on the 10.0.0.0/24 network. If using Cloudflare DNS to issue new Let’s Encrypt certificates, add the public IP address of the new server to the API Token on Cloudflare. Disable 2FA in the existing cluster. Add the server to the cluster. Edit the Hetzner firewall to remove temporary access to port 22 on the public IP address. Optionally, edit the Proxmox firewall on the newly added node to allow SSH access. Using one of the previously existing cluster nodes, issue a Let’s Encrypt certificate for the newly added node Re-enable 2FA for the cluster. Most of these steps have already been covered in previous posts. Thus, in this article we will focus on the new ones only.\nTwo-Factor Authentication # Before adding the new node, we need to disable 2FA in the existing cluster. This can be done by navigating to Datacenter \u0026gt; Permissions \u0026gt; Two Factor, editing the root@pam user account and unchecking the Enabled option. To re-enable it later, we would use the same interface.\nAlternatively, we can do it from the terminal:\nmv /etc/pve/priv/tfa.cfg /etc/pve/priv/tfa.cfg.bak To re-enable it later, we can move the file back:\nmv /etc/pve/priv/tfa.cfg.bak /etc/pve/priv/tfa.cfg The pveum command does not allow disabling 2FA, only deleting it.\nHosts mapping # Regarding the need to edit the /etc/hosts file on all nodes, this is crucial to ensure that all nodes can resolve each other’s hostnames correctly. If you do not want to use hostnames when managing your cluster, or to have IP addresses resolving to hostnames, then this mapping becomes just convenient.\nAnyhow, this can be done either using the System \u0026gt; Hosts menu entry of the WebGUI in each node, or by editing the /etc/hosts file through the terminal.\nBecause the /etc/hosts file is not inside /etc/pve, it is not automatically replicated across the cluster, so we need to manually ensure that all nodes have the same entries (the same /etc/hosts file, actually).\nAdding the server # Visit the Proxmox WebGUI of the first node and navigate to Datacenter: Cluster. Use the Join information button to get the necessary information for the new node being added.\nIP address: 10.0.0.1 Fingerprint: CD:5B:D4: [..] Join information: eyJpcEFk [..] Use the Copy information button to ease the process.\nOpen new browser tabs for each of the other servers (e.g., https://proxmox2.publicdomain.com:8006/), navigate to Datacenter \u0026gt; Cluster and click the Join cluster button. Paste the just-copied information and insert these values:\nPassword: \u0026lt;the root user password of the first node\u0026gt; Cluster network: choose the node private address 10.0.0.1 from the list In the broswer tab of the first node we will see the node being added to the existing cluster. In the browser tab of the server being added we will be losing connection. If we refresh the page, we will be getting a security warning due to the change in the certificate. However, we can just close it and continue the configuration from the first node.\nWe will not lose connection via SSH to the newly-added node since we have an existing rule at the datacenter level to alllow TCP connections to the port range 2001 to 2010.\nYou can check the nodes of a cluster from the terminal at any moment by running the following command:\npvecm nodes Certificate issuance # Issuing a Let’s Encrypt certificate for the newly added node is similar to the process we followed when creating the cluster. The only difference is that we will be doing it from the first node of the cluster. As stated before, it could be done from any of the existing nodes, but we will use the first one as the reference point.\nUsing the WebGUI of the first node, go to the System \u0026gt; Certificates menu option of the newly added node and, in the ACME section, use the Add button to add the certificate request data:\nChallenge type: DNS or HTTP Plug-in: cloudflare (if you selected the DNS challenge type) Domain: proxmox2.publicdomain.com Still in the ACME section of the screen, choose the account by clicking the Edit button next to the Using account label, select the account created before (e.g., Calabruix) and click Apply. Finally, click the Order Certificates Now button.\nThe process will place the order, which will consist of:\nValidating the ownership of the domain. Sending the CSR (certificate request). Waiting for the certificate to be issued. Installing the certificate and restarting the PVE Proxy. In a new browser tab or window, load the WebGUI of the new node and enter the credentials again. No error regarding an invalid certificate should appear.\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/adding-nodes/","section":"Posts","summary":"Add nodes by following a set of well-defined steps that prevent human errors","title":"Adding nodes to a Proxmox cluster","type":"posts"},{"content":"The official documentation of Proxmox describes the procedure to remove a cluster node. This article includes some additional steps.\nPrerequisites # The node needs to:\nBe empty. That is, all containers and virtual machines need to be migrated to other nodes. Have no replication jobs. Go to the Replication menu entry of the node and make sure it is empty. Optionally, be offline 1. Removing the node # Let’s assume we have a cluster with five nodes, named proxmox1 to proxmox5, and we want to remove the proxmox5 node. We will need to have SSH sessions open with both the node to be deleted (i.e., proxmox5) and any other node (e.g., proxmox1).\nIn the proxmox1 node, use the pvecm nodes command to list the nodes and identify the one to be removed.\n# pvecm nodes Membership information ---------------------- Nodeid Votes Name 1 1 proxmox1 (local) 2 1 proxmox2 3 1 proxmox3 4 1 proxmox4 5 1 proxmox5 Remove the node from the cluster by issuing the pvecm delnode proxmox5 command.\n# pvecm delnode proxmox5 Killing node 5 If the node was down while you issued the command, you will receive the message Could not kill node (error = CS_ERR_NOT_EXIST), which can be safely ignored as it does not report an actual failure in the deletion of the node, but rather a failure in corosync trying to kill an offline node.\nCheck the node list again using the pvecm nodes command.\n# pvecm nodes Membership information ---------------------- Nodeid Votes Name 1 1 proxmox1 (local) 2 1 proxmox2 3 1 proxmox3 4 1 proxmox4 Using the SSH session in the now-removed node (e.g., proxmox5), shut it down:\nshutdown -h now The official documentation emphasises that the node, once removed and shut down, should never come back online again (in the same network). To quickly achieve this, you can:\nRemove the server from the virtual switches. Use Hetzner’s rescue system to wipe the disks. Should you need to reinstall it and reuse the same hostname or IP address, make sure you have cleaned up first, as described in the next section.\nCleaning up # Back to the proxmox1 SSH session, remove the configuration files of the node from the cluster. Because the /etc/pve directory is a cluster-wide filesystem, removal of the configuration directory and fingerprint of the node will automatically be replicated to the rest of nodes.\nrm --recursive --force /etc/pve/nodes/proxmox5 At this point, a number of SSH-related files still have the fingerprint of the just-deleted node (e.g., proxmox5 or 10.0.0.5):\nPath to file Linked by /etc/pve/priv/known_hosts /etc/ssh/ssh_known_hosts /etc/pve/priv/authorized_keys /root/authorized_keys /root/.ssh/known_hosts To clean it up, execute the following commands on the SSH session of the proxmox1 node:\nsed -i.bak \u0026#39;/proxmox5\\|\\b10.0.0.5\\b/d\u0026#39; /etc/pve/priv/known_hosts sed -i.bak \u0026#39;/proxmox5\\|\\b10.0.0.5\\b/d\u0026#39; /etc/pve/priv/authorized_keys ssh-keygen -f \u0026#34;/root/.ssh/known_hosts\u0026#34; -R \u0026#34;proxmox5\u0026#34; ssh-keygen -f \u0026#34;/root/.ssh/known_hosts\u0026#34; -R \u0026#34;10.0.0.5\u0026#34; Again, changes in the files inside /etc/pve/priv/ will be replicated across the cluster. However, changes in the /root/.ssh/known_hosts file will not.\nWe cannot use ssh-keygen -R on the files inside /etc/pve/priv/ because there are hardlinks pointing at them and the command would fail with the following error:\n# ssh-keygen -f \u0026#34;/etc/pve/priv/known_hosts\u0026#34; -R \u0026#34;10.0.0.5\u0026#34; # Host 10.0.0.5 found: line 25 link /etc/pve/priv/known_hosts to /etc/pve/priv/known_hosts.old: Function not implemented Final notes # In Proxmox 8, the link /etc/ssh/ssh_known_hosts no longer exists and, if it does, it can be safely removed using pvecm updatecerts --unmerge-known-hosts.\nIf you receive an SSH error after rejoining a node with the same IP or hostname, run pvecm updatecerts once on each node to update its fingerprint cluster wide.\nIf the node that was deleted had a ZFS pool, you need to edit the /etc/pve/storage.cfg file and remove the node name from the nodes key of the zfspool entry.\nThis is how the official documentation recommends to do it. ↩︎ ","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/removing-nodes/","section":"Posts","summary":"Remove nodes by following a set of well-defined steps that prevent human errors","title":"Removing nodes from a Proxmox cluster","type":"posts"},{"content":"Extended Berkeley Packet Filter (eBPF) is a Linux kernel technology that allows programs to run in a sandboxed environment inside the kernel without modifying kernel source code or loading kernel modules. Programs, written in a subset of C, are compiled to eBPF bytecode via LLVM, statically verified by an in-kernel verifier, and then compiled just-in-time to native code for near-native execution speed.\nThey attach to kernel hook points, e.g., system calls, tracepoints, kprobes, XDP, or cgroup hooks, and have become the current foundation for observability, security, and networking tools.\n","date":"9 November 2026","externalUrl":null,"permalink":"/en/glossary/ebpf/","section":"Glossary","summary":"Extended Berkeley Packet Filter (eBPF) is a Linux kernel technology that allows programs to run in a sandboxed environment inside the kernel without modifying kernel source code or loading kernel modules. Programs, written in a subset of C, are compiled to eBPF bytecode via LLVM, statically verified by an in-kernel verifier, and then compiled just-in-time to native code for near-native execution speed.\n","title":"Extended Berkeley Packet Filter","type":"glossary"},{"content":"GNU Privacy Guard (GPG) is a free, open-source implementation of the OpenPGP standard (RFC 4880), distributed under the GPL license. It combines symmetric-key cryptography (for speed) with public-key cryptography (for secure key exchange), allowing users to encrypt and digitally sign files, messages, and emails so that only the intended recipient can read the content, while any recipient can verify the message’s integrity and the sender’s identity.\n","date":"9 November 2026","externalUrl":null,"permalink":"/en/glossary/gpg/","section":"Glossary","summary":"GNU Privacy Guard (GPG) is a free, open-source implementation of the OpenPGP standard (RFC 4880), distributed under the GPL license. It combines symmetric-key cryptography (for speed) with public-key cryptography (for secure key exchange), allowing users to encrypt and digitally sign files, messages, and emails so that only the intended recipient can read the content, while any recipient can verify the message’s integrity and the sender’s identity.\n","title":"GNU Privacy Guard","type":"glossary"},{"content":"Self-Monitoring, Analysis, and Reporting Technology (S.M.A.R.T.) is a monitoring system built into the firmware of nearly all modern storage devices. Its primary function is to detect and report various indicators of drive reliability in order to predict imminent hardware failures before they occur.\nThe drive’s internal sensors and counters continuously track attributes such as temperature, power-on hours, read/write error rates, reallocated sector counts, and (for SSDs) available spare capacity and flash endurance. Each attribute is assigned a normalized value and a vendor-defined threshold; when the value drops below the threshold, the drive is flagged as “failing” and a warning is sent to the host system (often visible during BIOS/UEFI startup).\nDrives may also support optional self-test routines (short and extended) whose results are stored in a self-test log. SMART does not repair hardware or guarantee that every failure is predictable, but it provides an early-warning mechanism that allows users to back up data or replace a drive before a catastrophic loss occurs.\n","date":"9 November 2026","externalUrl":null,"permalink":"/en/glossary/smart/","section":"Glossary","summary":"Self-Monitoring, Analysis, and Reporting Technology (S.M.A.R.T.) is a monitoring system built into the firmware of nearly all modern storage devices. Its primary function is to detect and report various indicators of drive reliability in order to predict imminent hardware failures before they occur.\n","title":"Self-Monitoring, Analysis, and Reporting Technology","type":"glossary"},{"content":"Operating System Command (OSC) is one of the control functions defined in ECMA-48 (the standard behind ANSI escape sequences), alongside CSI (Control Sequence Introducer), the \\e[ prefix we see in colour codes.\nAn OSC sequence is \\e] followed by a numeric command, a semicolon, the payload, and a terminator, which can be either BEL (\\a) or ST, the String Terminator (\\e\\).\nThe name reflects what it was for originally: unlike CSI sequences, which manipulate the screen itself (cursor movement, colours, erasing), OSC sequences pass data to the host environment around the terminal, i.e., the window manager, the title bar, and later on things like clipboard access (OSC 52) and hyperlinks (OSC 8).\n","date":"5 September 2026","externalUrl":null,"permalink":"/en/glossary/osc/","section":"Glossary","summary":"Operating System Command (OSC) is one of the control functions defined in ECMA-48 (the standard behind ANSI escape sequences), alongside CSI (Control Sequence Introducer), the \\e[ prefix we see in colour codes.\n","title":"Operating System Command","type":"glossary"},{"content":"fif, an acronym for “Find In Files”, is a small Zsh utility that turns a search for text into something genuinely interactive. Instead of running grep or rg (ripgrep) and reading a wall of matched lines, fif hands every match to fzf for fuzzy filtering and shows a live, syntax-highlighted preview of the surrounding context as the list narrows down.\nIt is a thin layer gluing together tools that are very useful on their own and likely already installed: fzf drives the fuzzy list, ripgrep does the actual text search, and bat renders the preview pane with syntax highlighting instead of a flat wall of text.\nRequirements # fif needs three things to behave the way this article describes:\nfzf, a general-purpose command-line fuzzy finder. Point it at any list (files, shell history, running processes, git branches) and it turns that list into an interactive, narrow-as-you-type interface. It has no idea what text search even is, it only filters and displays whatever it is given. Inside fif, fzf is the actual interface: every match rg finds gets piped into fzf’s fuzzy list, and fzf’s own preview-window mechanism is what fif hooks into to show the syntax-highlighted context alongside the results.\nripgrep (rg) is a line-oriented text-search tool, functionally in the same space as GNU Grep (grep) or Silver Searcher (ag), built for speed and for automatically respecting .gitignore, .ignore, and hidden-file conventions without being told to. Inside fif, rg is what actually performs the text search: it produces the list of matching lines fed into fzf. Its speed keeps the fuzzy list responsive even across a large tree, and its .gitignore-awareness is what keeps irrelevant directories (e.g., a virtual environment, a build output) out of the results with no manual exclusion needed.\nbat is a cat replacement with syntax highlighting, a Git-aware modifications gutter, and line numbers, built on the same syntax-definition library used by a number of editors. Inside fif, bat is what renders the preview pane, where each match is shown in context with the file’s actual syntax highlighted, which is what makes it possible to tell a variable definition from a comment or a template reference at a glance.\nDebian packages # Install rg and bat from the Debian repositories:\nsudo apt install --yes bat fzf ripgrep One thing worth knowing before moving on. Debian renames the bat executable to batcat, because the name bat was already taken by an unrelated package. Since fif looks for a binary literally named bat to decide whether to use it for the preview pane, we will fix it with a symlink:\nmkdir --parents ~/.local/bin ln --symbolic /usr/bin/batcat ~/.local/bin/bat As long as ~/.local/bin comes before /usr/bin in $PATH, bat resolves correctly from then on for fif, and for anything else that expects the upstream binary name.\nCheck the installed versions with the following commands:\nbat --version fzf --version rg --version Binaries # Debian’s own packages trade newness for stability: whatever version lands in a release stays there, tested and frozen, for the lifetime of that release, which is exactly why sudo apt install above is the sensible default for most setups. For anyone who specifically wants the latest upstream release instead, both projects publish prebuilt, statically-linked binaries on their GitHub releases pages, making a pinned install into ~/.local/bin a clean alternative.\nThis replaces the apt install/symlink route above, rather than sitting alongside it.\nbat, from the releases page:\nBAT_VERSION=\u0026#34;v0.26.1\u0026#34; wget \u0026#34;https://github.com/sharkdp/bat/releases/download/${BAT_VERSION}/bat-${BAT_VERSION}-x86_64-unknown-linux-musl.tar.gz\u0026#34; \\ --output-document=/tmp/bat.tar.gz tar -xzf /tmp/bat.tar.gz -C ~/.local/bin --strip-components=1 \u0026#34;bat-${BAT_VERSION}-x86_64-unknown-linux-musl/bat\u0026#34; chmod +x ~/.local/bin/bat rm /tmp/bat.tar.gz No batcat symlink needed on this route (the binary is already named bat).\nfzf, from the releases page:\nFZF_VERSION=\u0026#34;0.74.5\u0026#34; wget \u0026#34;https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-linux_amd64.tar.gz\u0026#34; \\ --output-document=/tmp/fzf.tar.gz tar -xzf /tmp/fzf.tar.gz -C ~/.local/bin fzf chmod +x ~/.local/bin/fzf rm /tmp/fzf.tar.gz ripgrep, from the releases page:\nRG_VERSION=\u0026#34;15.2.0\u0026#34; wget \u0026#34;https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl.tar.gz\u0026#34; \\ --output-document=/tmp/ripgrep.tar.gz tar -xzf /tmp/ripgrep.tar.gz -C ~/.local/bin --strip-components=1 \u0026#34;ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl/rg\u0026#34; chmod +x ~/.local/bin/rg rm /tmp/ripgrep.tar.gz Check the installed versions with the following commands:\nbat --version fzf --version rg --version Installation # Clone the repository into Oh My Zsh’s custom plugins directory:\ngit clone https://github.com/roosta/fif ~/.oh-my-zsh/custom/plugins/fif Then add fif to the plugins array in ~/.zshrc:\nplugins=(colored-man-pages fif git ufw) Oh My Zsh’s plugin loader automatically sources any file named \u0026lt;plugin-name\u0026gt;.plugin.zsh it finds in that directory (the repository already ships one, fif.plugin.zsh, matching the folder name exactly). No manual source line needed.\nReload the shell, or open a new terminal, and fif is available. There is no --version flag in fif, but we can check the version with the following command instead:\necho $_FIF_VERSION Configuration # fif exposes more environment variables than most people will ever need. Three are worth setting deliberately:\nVariable Purpose FIF_RG_OPTS Options passed to rg for the concatenation step (colours, hidden files, and so on) FIF_FZF_OPTS Options layered on top of $FZF_DEFAULT_OPTS for the fuzzy list itself FIF_EDITOR_SCRIPT Points at a script to open the matched file/line in something other than $EDITOR’s default behaviour Since fif now loads through Oh My Zsh’s plugins array, these need to be set before source $ZSH/oh-my-zsh.sh (that line is what actually sources fif.plugin.zsh, and it reads these variables at that moment).\nAdd the block just above the plugins line:\nfif_rg_opts=( --hidden --color always --colors=match:none --colors=path:fg:blue --colors=line:fg:yellow ) plugins=(colored-man-pages fif git ufw) source $ZSH/oh-my-zsh.sh FIF_EDITOR_SCRIPT is only worth setting if $EDITOR’s default behaviour (which already works out of the box with Vim) does not fit what is actually in use. The script receives two arguments, the matched line number and then the file path, so any editor with its own “jump to line” flag can be wired in without touching fif itself.\nUsage # Run fif with no arguments to search every file from the current directory, or scope it to a specific file or path:\nfif ~/Projects/mywebsite fif will scan the directory and present the interface. You can start typing and, whatever you type, it will instantly offer results. These are the default keybinds:\nKeybind Action ↑, ↓ Move the selection up/down the match list Enter Confirm and open the file at that location Ctrl-s Toggle sort Ctrl-p Toggle the preview pane The moment you hit enter, you leave fif and enter your default editor, so you need to start using your editor’s keybindings.\nA set of Python projects, each with its own .venv/, is exactly the case rg’s .gitignore-awareness earns its keep. As long as .venv/ is listed in .gitignore (which it should be) a search across the whole tree never has to wade through a virtual environment’s installed packages to reach the actual source files. Typing a fragment of a function name, e.g., datetime, filters live across every exercise folder, with each .venv/ silently excluded. No need to use --exclude flags or manual pruning.\nMoreover, searching such a codebase for a django-environ accessor (e.g., DATABASE_URL) is where bat’s preview pane earns its place. A flat-text match on that string looks identical whether it turns up in config/settings.py as a typed accessor call, in .env.example as a plain KEY=value line, or in a compose.yaml file as a YAML environment: entry. fif’s preview renders each one in its actual syntax, so it is obvious at a glance which is a Python assignment, which is a shell variable, and which is just sitting in a comment, without opening a single file.\nFIF_EDITOR_SCRIPT points at a small script that receives two arguments (the matched line number, then the file path) and decides how to open them. Because VS Codium’s codium executable understands the --goto FILE:LINE syntax, should we want to use it as our editor, the custom script pointing at it is a single line:\ncodium --goto \u0026#34;${2}:${1}\u0026#34; To do this, first create somewhere permanent to store the script:\nmkdir --parents ~/.config/zsh/scripts Now create the codium.sh script:\ncat \u0026gt; ~/.config/zsh/scripts/fif-codium.sh \u0026lt;\u0026lt; \u0026#39;EOF\u0026#39; #!/usr/bin/env bash codium --goto \u0026#34;${2}:${1}\u0026#34; EOF Then make it executable:\nchmod +x ~/.config/zsh/scripts/fif-codium.sh And point FIF_EDITOR_SCRIPT at it in the ~/.zshrc file, before the plugins line, alongside fif_rg_opts, so it is read the moment fif.plugin.zsh is sourced:\nexport FIF_EDITOR_SCRIPT=\u0026#34;$HOME/.config/zsh/scripts/fif-codium.sh\u0026#34; fif_rg_opts=( --hidden --color always --colors=match:none --colors=path:fg:blue --colors=line:fg:yellow ) plugins=(colored-man-pages fif git ufw) With that in place, pressing Enter on a match opens that exact file at that exact line in VS Codium.\nWhere fif fits # Worth being precise about what fif replaces and what it does not. fzf’s own Ctrl-R binding searches shell history (commands already run), whereas fif searches file contents, an entirely different corpus. And against plain rg, fif does not do anything rg could not already do on its own. What it adds is the fuzzy, interactive narrowing and the live preview, turning a search into something closer to browsing than to reading a static list of matches.\nFinding files # fif solves finding text inside files. fd solves the adjacent problem: finding files by name, fast, with the same .gitignore-awareness as rg and the same no-flags-needed defaults. Same author as bat, same philosophy as rg, an excellent companion to fif. Installed alongside these, the three cover finding files, finding text, and reading files nicely with no overlap between them:\nsudo apt install --yes fd-find On Debian, the binary is installed as fdfind, for the same name-clash reason bat becomes batcat. The same symlink trick applies:\nln --symbolic /usr/bin/fdfind ~/.local/bin/fd And as before, we can install the latest binary if we prefer so (and skip the symbolic link):\nFD_VERSION=\u0026#34;v10.5.0\u0026#34; wget \u0026#34;https://github.com/sharkdp/fd/releases/download/${FD_VERSION}/fd-${FD_VERSION}-x86_64-unknown-linux-musl.tar.gz\u0026#34; \\ -O /tmp/fd.tar.gz tar -xzf /tmp/fd.tar.gz -C ~/.local/bin --strip-components=1 \u0026#34;fd-${FD_VERSION}-x86_64-unknown-linux-musl/fd\u0026#34; chmod +x ~/.local/bin/fd rm /tmp/fd.tar.gz Check the installed version with the following command:\nfd --version Tying back to the .venv/ examples already in this article, we can use fd to list every .py file across our tree of Python projects, with each website or exercise’s .venv/ skipped automatically, the same .gitignore-awareness fif leans on via rg, just applied to finding files by name instead of searching inside them:\nfd --extension py . ~/Projects/mywebsite The . sitting between --extension py and the path is doing real work, not decoration. fd’s argument order is fd [PATTERN] [PATH...], i.e., the first positional argument is always read as a search pattern, never as a path. Drop the . and fd would try to treat ~/Projects/mywebsite itself as the pattern. Since that string contains a /, fd refuses outright, because a pattern with a path separator can never match a bare filename. . sidesteps this by acting as a match-all pattern (as a regular expression it matches any single character, and since every filename has at least one, it matches everything) leaving the --extension filter to do the actual narrowing and the path argument free to land where it belongs.\n","date":"4 September 2026","externalUrl":null,"permalink":"/en/posts/tooling/fif/","section":"Posts","summary":"fif turns fzf, ripgrep and bat into a single fuzzy search-inside-files tool with an instant, highlighted preview of every match.","title":"Find in text files using fuzzy search with fif","type":"posts"},{"content":"The shell is one of the most important tools a systems engineer works with. It is the interface you use the most when your day is spent moving between servers, containers, and repositories. This article walks through how I configured Zsh on my new laptop, with every step reproducible and version-pinned, the way I try to document all of my infrastructure work.\nOrigins # Zsh (the “Z shell”) was created by Paul Falstad in 1990, originally as a student project at Princeton University. Its name is, appropriately, a small joke: it was meant to be the alphabetically last word on shells. Over the following decades it grew into something considerably more ambitious than a class assignment, borrowing ideas from ksh, bash, and tcsh while adding its own extensive completion system, scripting features, and configurability.\nWhile Zsh has been the default login shell on macOS since Catalina (2019), Bash is still the default in most Linux distributions.\nWhy Zsh # Bash is everywhere, and for portable scripts it is still the default choice (or plain sh) without hesitation. But as an interactive daily driver, Zsh offers a handful of features that make a real difference:\nA far more capable completion system. Zsh’s compinit/compdef framework can complete not just filenames, but subcommands, flags, and context-aware arguments for tools that ship completion definitions. Better globbing. Extended glob patterns and recursive globbing (**/*.py, for instance) work out of the box. Shared, persistent history across sessions. Multiple open terminals can share history in real time. Richer prompt scripting. Small conveniences, but noticeable. A mature plugin ecosystem. Frameworks like Oh My Zsh exist specifically because Zsh’s extensibility invites this kind of layering. Installation # The first step is simply getting Zsh installed and set as the default login shell:\nsudo apt install --yes zsh Before switching, it is worth confirming that Zsh is listed among the shells the system considers valid login shells:\ngrep zsh /etc/shells With that confirmed, set it as the default shell for the current user:\nchsh -s $(which zsh) chsh only takes effect on your next login, so to make sure it worked:\ngetent passwd $USER | cut -d: -f7 Oh My Zsh # Oh My Zsh is a community-maintained framework that sits on top of Zsh, providing a plugin manager, a large library of themes, and sane defaults for things you would otherwise have to configure by hand, e.g., completion styles, history behaviour, and so on. Its real value is the plugin ecosystem: hundreds of community-contributed plugins that wrap common tools with useful completions and aliases, all toggled through a single array in your configuration file.\nInstalling it is a single script:\nsh -c \u0026#34;$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)\u0026#34; exec zsh Plug-ins # A plug-in is Zsh code, executing inside the shell process, typically aliases, functions, completion definitions, ZLE (Z-shell Line Editor) widgets, key bindings and environment variables. Plug-ins bundled with the framework are located under ~/.oh-my-zsh/plugins/, whereas custom plug-ins are located under ~/.oh-my-zsh/custom/plugins/. They are named in the plugins=() array in the ~/.zshrc configuration file.\nSeparate programs can add functionality to Zsh without being plug-ins. A binary that emits Zsh code on request, for instance, is activated by sourcing that code from ~/.zshrc, e.g., source \u0026lt;(tool init zsh), and knows nothing about Oh My Zsh (it behaves identically on a bare Zsh installation). Other dependencies are not code at all: a font is simply a font, however much a prompt may rely on it.\nThe three plug-ins below all ship with Oh My Zsh, so enabling them is just a matter of naming them in the array. A custom plug-in works the same way once its directory exists under ~/.oh-my-zsh/custom/plugins/. The only extra step is putting it there, usually with a git clone.\nplugins=(colored-man-pages git ufw) By default, Oh My Zsh enables the git plug-in, which provides many aliases (e.g., ga equals git add) and a few useful functions (e.g., gbds deletes all squash-merged branches) for Git. We are adding the Colored man pages plugin, which adds colours to man pages (e.g., man grep) and the UFW plugin, which adds completion for managing the Uncomplicated Firewall (e.g., sudo ufw status).\nThese plug-ins will be active when we start a new shell.\nDo not add zsh-syntax-highlighting or fast-syntax-highlighting to the plugins=() array, as we will be using zsh-patina.\nComplementary tools # The rest of the setup does not go through Oh My Zsh at all. These are standalone, third-party tools: binaries hooked into Zsh through an activation line in ~/.zshrc rather than the plugins=() array, plus one font that several of them depend on to render their icons.\nfzf # fzf is a general-purpose fuzzy finder for the command line. Once wired into Zsh, it upgrades reverse history search (Ctrl + R) into an interactive fuzzy search, and adds fuzzy file and directory completion. I install it as a pinned binary release rather than through the distribution’s package manager, so the version is explicit and reproducible:\nFZF_VERSION=\u0026#34;0.74.5\u0026#34; wget \u0026#34;https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-linux_amd64.tar.gz\u0026#34; \\ --output-document=/tmp/fzf.tar.gz tar -xzf /tmp/fzf.tar.gz -C ~/.local/bin fzf chmod +x ~/.local/bin/fzf rm /tmp/fzf.tar.gz Check the installed version:\nfzf --version Enabling it in Zsh is a single line:\necho \u0026#39;source \u0026lt;(fzf --zsh)\u0026#39; \u0026gt;\u0026gt; ~/.zshrc Deja # Deja is a replacement for zsh-autosuggestions. Both draw an inline ghost-text suggestion after the cursor, and both accept it with the right arrow key, but the model behind the suggestion is different. zsh-autosuggestions can only ever complete a command that starts with what you have typed, while Deja scores candidates on four signals combined: a fuzzy subsequence match, frecency (frequency blended with a one-week recency decay), how often you have run that command from the directory you are currently in, and the probability that it follows the command you just ran.\nIn practice that last pair is what makes the difference. Typing dc in one repository suggests that repository’s docker compose invocation, but the same two letters in another suggests a different one. Another example would be knowing that you are about to run just test after running just build.\nIt runs as a background daemon shared across sessions, keeping the per-keystroke response under a millisecond, and all state lives in a local SQLite database (nothing leaves the machine). It ships as a Go binary, which we will install following these commands:\nDEJA_VERSION=\u0026#34;0.4.2\u0026#34; wget \u0026#34;https://github.com/Giammarco-Ferranti/deja/releases/download/v${DEJA_VERSION}/deja_${DEJA_VERSION}_linux_amd64.tar.gz\u0026#34; \\ --output-document=/tmp/deja.tar.gz tar -xzf /tmp/deja.tar.gz -C ~/.local/bin deja chmod +x ~/.local/bin/deja rm /tmp/deja.tar.gz Check the installed version:\ndeja --version Seed the database from your existing history, so it is useful from the first prompt:\ndeja import Enabling it in Zsh is a single line:\necho \u0026#39;source \u0026lt;(deja init zsh)\u0026#39; \u0026gt;\u0026gt; ~/.zshrc By default, Deja binds Tab to an inline picker that cycles through ranked alternatives, but Tab is already driving compinit completion system (a large part of why we chose Zsh over Bash) and it is fzf’s fuzzy-completion trigger (** followed by Tab) as well.\nWe can keep the default and live with Tab doing double duty, as Deja only intercepts it when a suggestion is on screen. However, if we are not comfortable with the Tab key having two different meanings depending on an invisible state, we can move the picker onto something else and leave Tab entirely to completion. A couple of options are:\nCtrl + N, the one suggested by the Deja documentation, though it is normally bound to down-line-or-history (check with bindkey | grep '\\^N'). Alt + N, normally bound to history-search-forward (check with bindkey | grep '\\^\\[n'). Both are already taken, but neither loss hurts much in this particular setup: both walk forward through history, and between fzf’s Ctrl + R and Deja’s own suggestions we have better ways of getting a past command back.\nYou need to be in a Zsh shell to use bindkey.\nTo do this, we need to manually edit our ~/.zshrc file and, before the source \u0026lt;(deja init zsh) instruction, add an export:\n# Use Ctrl + N to cycle through ranked alternatives export DEJA_CYCLE_KEY=\u0026#39;^N\u0026#39; source \u0026lt;(deja init zsh) To use Alt + N, substitute '^N' for '^[n':\n# Use Alt + N to cycle through ranked alternatives export DEJA_CYCLE_KEY=\u0026#39;^[n\u0026#39; source \u0026lt;(deja init zsh) You can obtain the code for a key to your liking by using cat -v and typing the combination you want to try. Exit using Ctrl + C.\nOn a fresh prompt, before we have typed anything, Deja already predicts the command we are most likely to run next and shows it as ghost text:\n→ accepts the whole suggestion, Ctrl + → accepts one word. The ghost is not part of the line: Enter runs whatever we have actually typed, which on an empty prompt is nothing at all. → is what commits the suggestion into the buffer first. Ctrl + X suppresses suggestions for the rest of the session. Shift + → and Shift + ← cycle the fuzzy matcher between tight, smart (the default), and loose, controlling how far apart your typed characters are allowed to sprawl in a candidate. deja fuzzy shows the current setting. If we would rather have a quiet empty prompt, deja empty off turns that behaviour off.\nA note on secrets. Deja records the commands we run into a plaintext SQLite database at ~/.local/share/deja/deja.db. The directory is 0700 and the files 0600, but it is not encrypted. It honours the same rules Zsh uses to decide what not to remember. With setopt hist_ignore_space, a line starting with a space is discarded by both. HISTORY_IGNORE patterns are applied the same way Zsh applies them:\nsetopt hist_ignore_space HISTORY_IGNORE=\u0026#39;(*AWS_SECRET*|*--password*|*TOKEN=*)\u0026#39; Deja does not redact secrets embedded in otherwise ordinary commands, e.g., curl -H \u0026quot;Authorization: ...\u0026quot;, so the leading space remains the reliable habit. Note also that an ignored command breaks the prediction chain (it is dropped as the “previous command” for sequence scoring, so it cannot resurface indirectly).\nFiraCode Nerd Font # Both Starship and several Oh My Zsh themes rely on glyphs, e.g., Git branch icons, language logos, status symbols, that live outside the standard Unicode ranges most fonts ship with. Nerd Fonts solves this by patching popular programming fonts with these extra icon sets. I use FiraCode, just because it is the default suggestion at the Starship website and it does the job just fine:\nNERD_FONT_VERSION=\u0026#34;3.5.0\u0026#34; wget https://github.com/ryanoasis/nerd-fonts/releases/download/v${NERD_FONT_VERSION}/FiraCode.zip \\ ---output-document=/tmp/FiraCode.zip mkdir -p ~/.local/share/fonts/FiraCode unzip /tmp/FiraCode.zip -d ~/.local/share/fonts/FiraCode fc-cache -fv rm /tmp/FiraCode.zip Without this step, Starship’s prompt will still work, but you will see empty boxes or question marks where icons should be.\nStarship # Starship is a minimal, extremely fast prompt that works identically across Bash, Zsh, Fish, and other shells. You get a prompt that adapts to context automatically, showing the current Git branch and status, detected language runtimes and their versions, and more, only when relevant. For example, here is what it looks like inside a Python repository with a virtual environment active:\nProjects/myrepo is 󰏗 v0.3.1 via  v3.14.7 (myrepo) Installing it is a single script, same as Oh My Zsh:\ncurl -sS https://starship.rs/install.sh | sh You can install curl using apt install --yes curl.\nCheck the installed version:\nstarship --version Starship ships with configuration presets, and since we have already installed a Nerd Font, it makes sense to use the preset built around it:\nmkdir -p ~/.config starship preset nerd-font-symbols -o ~/.config/starship.toml Then, enable it in Zsh:\necho \u0026#39;source \u0026lt;(starship init zsh)\u0026#39; \u0026gt;\u0026gt; ~/.zshrc zsh-patina # zsh-patina is a syntax highlighter, i.e., the same as zsh-syntax-highlighting or fast-syntax-highlighting, but implemented differently: it runs as a small background daemon, shared across your open Zsh sessions, and highlights commands, files, and directories based on whether they actually exist and are accessible, rather than through pattern matching alone.\nIt ships as a .deb package rather than a Zsh plugin:\nZSH_PATINA_VERSION=\u0026#34;1.11.0\u0026#34; wget https://github.com/michel-kraemer/zsh-patina/releases/download/${ZSH_PATINA_VERSION}/zsh-patina_${ZSH_PATINA_VERSION}_amd64.deb \\ --output-document=/tmp/zsh-patina_${ZSH_PATINA_VERSION}_amd64.deb sudo dpkg --install /tmp/zsh-patina_${ZSH_PATINA_VERSION}_amd64.deb rm /tmp/zsh-patina_${ZSH_PATINA_VERSION}_amd64.deb Check the installed version:\nzsh-patina --version After installation, enable it in Zsh:\necho \u0026#39;source \u0026lt;(zsh-patina activate)\u0026#39; \u0026gt;\u0026gt; ~/.zshrc It is also worth enabling shell completions for the tool itself:\nzsh-patina completion \\ | sudo tee /usr/local/share/zsh/site-functions/_zsh-patina \\ \u0026gt; /dev/null About using source # You may have noticed that all activation lines above use source \u0026lt;(command) rather than the more commonly documented eval \u0026quot;$(command)\u0026quot;. Both achieve the same result, i.e., running the shell code a tool generates on startup, but I avoid eval deliberately.\neval executes a string as shell code with no separation between “data” and “instructions,” which is exactly the kind of pattern that makes shell injection possible if the generated output is ever tampered with or unexpectedly malformed. source \u0026lt;(...) runs the same generated code, but as an actual script read through process substitution, which I find both safer as a habit and easier to inspect.\nYou can run the inner command on its own and see exactly what it would output before sourcing it.\nOrder of activation # There is one detail that is easy to get wrong: order of activation in ~/.zshrc. If you followed the instructions above in order, since each echo ... \u0026gt;\u0026gt; ~/.zshrc command appends to the end of the file, and Oh My Zsh’s own plugins=() array and source $ZSH/oh-my-zsh.sh line are set up earlier in the file, the ordering ends up being:\nOh My Zsh loads first, with its plugins. fzf’s key bindings and completion are sourced. Deja’s integration is sourced, preceded by its key-binding override (optional). Starship’s init is sourced next. zsh-patina’s activation is sourced last. This is not incidental, though the reason differs per tool. Both Starship and zsh-patina hook into Zsh’s prompt and command-execution machinery, i.e., the precmd and preexec hooks that run before and after each command. Sourcing them at the very end of the file means they wrap around whatever Oh My Zsh and its plugins have already defined, rather than risk being overridden by something loaded afterwards. Deja is a different case: it wraps ZLE widgets and key bindings rather than prompt hooks, so it needs Oh My Zsh and fzf to have finished installing theirs, but it must come before the two prompt tools so they still get the last word.\nSo, if you ever restructure your ~/.zshrc, keep this order. For example, let’s say that you install fnm for a Node.js project and want to integrate it with Zsh, the last lines of your ~/.zshrc file would look like this:\nsource \u0026lt;(fnm env --use-on-cd --shell zsh) source \u0026lt;(fzf --zsh) source \u0026lt;(deja init zsh) source \u0026lt;(starship init zsh) source \u0026lt;(zsh-patina activate) If you decided to use some other keybinding to cycle through ranked alternatives instead of Tab, you will have the extra export line.\nYakuake tab labels # Yakuake is a drop-down terminal emulator for KDE Plasma. It embeds the same Konsole component the standalone application uses, so profiles, colour schemes and rendering behave identically, but instead of living in a window it slides down from the top of the screen on a global shortcut (F12 by default) and rolls back up when you are done.\nIt comes from the distribution repositories, so unlike the tools above there is no version to pin:\nsudo apt install --yes yakuake Like Konsole, it keeps sessions in tabs along the bottom of the panel. Once there are six or seven of them open, the default Shell label is of no use at all. Therefore, we want for each tab to label itself: the name of the directory we are sitting in when the shell is idle, e.g., mywebsite, and the name of whatever is currently running when it is not, e.g., mywebsite - just build.\nThe tools for the job # Zsh already has the machinery for this, and so does Oh My Zsh. Its lib/termsupport.zsh sets both the window title and the tab title on every prompt and every command, formatted through ZSH_THEME_TERM_TITLE_IDLE and ZSH_THEME_TERM_TAB_TITLE_IDLE and switched off with DISABLE_AUTO_TITLE. It does so the way every shell has done for decades: by printing OSC escape sequences (\\e]2;…\\a for the window, \\e]1;…\\a for the tab) into the terminal and letting the emulator interpret them.\nKonsole honours those sequences. Yakuake discards them, so its tab bar never receives anything and Konsole’s %w tab title format has nothing to show. The only interface Yakuake exposes for tab labels is D-Bus (Desktop Bus).\nSo the shape of the solution is the same as Oh My Zsh’s, but the transport changes. We keep:\nadd-zsh-hook, an autoloadable function shipped with Zsh, to register our code with the precmd and preexec hooks, i.e., the same two hooks Starship and zsh-patina use. precmd runs before each prompt is drawn (idle) and preexec runs after Enter but before the command executes (busy). Zsh parameter expansion to derive the label without spawning any helper processes. And we replace the print -Pn \u0026quot;\\e]…\u0026quot; call with a gdbus call. Nothing here is a plug-in, so nothing goes into the plugins=() array, and there is no new binary to install either: gdbus ships with GLib (GTK C utility library), which is already on any Plasma desktop.\nIf you prefer Qt’s tooling, qdbus6 takes the same arguments in a shorter form. I use gdbus because it is present even on machines where Qt is not.\nHow the setup works # Yakuake’s D-Bus service is org.kde.yakuake, and it exposes two objects we care about: /yakuake/sessions, which can tell us which session is currently active, and /yakuake/tabs, which can rename a tab given a session id. So, we are going to write a script that goes through three steps:\nWork out our own session id once. Define a helper that renames it. Hang that helper off the two hooks. Add the following to ~/.zshrc:\n# Yakuake tab labels, set over D-Bus because Yakuake ignores OSC titles if [[ -n $KONSOLE_DBUS_SESSION ]] \u0026amp;\u0026amp; (( $+commands[gdbus] )); then typeset -g YAKUAKE_TAB_ID=\u0026#34;${${$(gdbus call --session \\ --dest org.kde.yakuake --object-path /yakuake/sessions \\ --method org.kde.yakuake.activeSessionId 2\u0026gt;/dev/null)#\\(}%,\\)}\u0026#34; if [[ $YAKUAKE_TAB_ID == \u0026lt;-\u0026gt; ]]; then _yakuake_tab_title() { gdbus call --session --dest org.kde.yakuake \\ --object-path /yakuake/tabs \\ --method org.kde.yakuake.setTabTitle \\ \u0026#34;$YAKUAKE_TAB_ID\u0026#34; \u0026#34;$1\u0026#34; \u0026gt; /dev/null 2\u0026gt;\u0026amp;1 \u0026amp;! } _yakuake_tab_title_precmd() { _yakuake_tab_title \u0026#34;${PWD:t}\u0026#34; } _yakuake_tab_title_preexec() { local cmd=${1%% *} [[ $cmd == (sudo|doas|env|command) ]] \u0026amp;\u0026amp; cmd=\u0026#34;$cmd ${${1#* }%% *}\u0026#34; _yakuake_tab_title \u0026#34;${PWD:t} - $cmd\u0026#34; } autoload -Uz add-zsh-hook add-zsh-hook precmd _yakuake_tab_title_precmd add-zsh-hook preexec _yakuake_tab_title_preexec fi fi Reading it from the top:\nPre-requisites. $KONSOLE_DBUS_SESSION is exported by every Konsole-family terminal, and $+commands[gdbus] is Zsh’s associative array of executables on PATH evaluated arithmetically, so it is 1 when the binary is found and 0 when it is not. Together they mean the whole block is simply skipped on a machine or terminal where it does not apply.\nObtain session id. When a new tab is created, the shell starting inside it is the active session, so asking once at startup gets us our own id and we never have to look it up again. gdbus prints return values as D-Bus tuples, e.g., (5,), so the nested expansions strip that down to 5: ${…#\\(} trims the leading ( from the front and ${…%,\\)} trims the trailing ,) from the end. typeset -g makes the result global so it survives into the functions defined below.\nValue check. \u0026lt;-\u0026gt; is Zsh’s glob operator for a sequence of digits. If the lookup failed or returned something unexpected, the hooks are never registered at all, rather than firing broken D-Bus calls on every prompt for the rest of the session.\nHelper. \u0026gt; /dev/null 2\u0026gt;\u0026amp;1 discards both the return value and any error, so a failure never prints noise above the prompt. \u0026amp;! runs the call in the background and disowns it, so the process fork does not sit in the prompt’s critical path and no job notification is printed. The trade-off is that two calls made in quick succession have no guaranteed ordering.\nIdle label. ${PWD:t} is the “tail” modifier: the last segment of the path, so ~/Projects/MyCompany/mywebsite becomes mywebsite. For two levels, i.e., MyCompany/mywebsite, use ${PWD:h:t}/${PWD:t} instead.\nBusy label. $1 in preexec is the full command line as typed, and ${1%% *} cuts everything from the first space onwards to leave the first word. A bare first word is uninformative for wrappers, though, as every sudo command would read just sudo, so for those we append the second word as well: ${1#* } drops the first word and %% * takes the first word of what is left, giving sudo systemctl.\nThe registration. add-zsh-hook appends to the precmd_functions and preexec_functions arrays. This matters: defining precmd() and preexec() directly would silently replace whatever Starship or zsh-patina had already installed there. Because it appends rather than replaces, this block is also indifferent to the ordering rules of the previous section, as long as it comes after Oh My Zsh has loaded.\nVerifying and adjusting # Open a tab and ask Yakuake for the active session id by hand:\ngdbus call --session --dest org.kde.yakuake \\ --object-path /yakuake/sessions \\ --method org.kde.yakuake.activeSessionId A tuple such as (0,) means the service is reachable and the block will work. If it prints nothing, or the labels never change, there are three things worth checking:\nDynamic tab titles. Yakuake has a Dynamic tab titles option in its behaviour settings which makes it manage the labels itself. With it enabled, a title set over D-Bus is either ignored outright or applied and then immediately overwritten. Turn it off.\nManually renamed tabs. Renaming a tab by double-clicking it pins the label, and D-Bus calls for that tab stop taking effect afterwards.\nKonsole windows. $KONSOLE_DBUS_SESSION is exported by Konsole as well, so if Yakuake happens to be running, a shell started in a regular Konsole window will pass the guard and relabel Yakuake’s active tab from across the desktop. If you use both, compare echo $KONSOLE_DBUS_SERVICE in each and tighten the first condition to match only the Yakuake one.\nValidating the setup # Once everything above has run, start a new session and walk through a short checklist to confirm each piece actually works:\nzsh getent passwd $USER | cut -d: -f7 deja ping zsh-patina check fc-list : family | grep -i \u0026#34;FiraCode\u0026#34; starship --version Where:\ngetent passwd ... should print the path to Zsh, confirming the default shell change took effect. deja ping should print pong. zsh-patina check runs the tool’s own self-diagnostic. fc-list ... \u0026quot;FiraCode\u0026quot; confirms the Nerd Font variant was installed and is registered with fontconfig. starship --version confirms the binary is on your PATH and reachable. If any of these come back empty or with an error, it is worth checking ~/.zshrc directly before troubleshooting further, as a surprising number of shell configuration issues turn out to be a typo, or a step run in the wrong order.\nOptionally, log out and log back in, then perform the checks.\nFinal note # None of these tools are strictly necessary, but the incremental cost of setting each of these up once is small compared to the time saved across months of daily use. I have deliberately kept every install step version-pinned and scripted so that this configuration can be reproduced identically.\n","date":"7 July 2026","externalUrl":null,"permalink":"/en/posts/tooling/zsh/","section":"Posts","summary":"How to configure the Z shell with Oh My Zsh, fzf, deja, Starship, and zsh-patina on Linux.","title":"Configuring Zsh on a new laptop for DevOps","type":"posts"},{"content":"The Advanced Message Queuing Protocol (AMQP) is an open standard communication protocol designed for message exchange between applications and distributed systems. It allows different programs to communicate reliably, securely, and asynchronously, even if they use different programming languages.\n","date":"12 June 2026","externalUrl":null,"permalink":"/en/glossary/amqp/","section":"Glossary","summary":"The Advanced Message Queuing Protocol (AMQP) is an open standard communication protocol designed for message exchange between applications and distributed systems. It allows different programs to communicate reliably, securely, and asynchronously, even if they use different programming languages.\n","title":"Advanced Message Queuing Protocol","type":"glossary"},{"content":"Simple Mail Transfer Protocol (SMTP) is an application layer protocol for sending email messages. It is used for communication between servers and between servers and email clients.\n","date":"6 May 2026","externalUrl":null,"permalink":"/en/glossary/smtp/","section":"Glossary","summary":"Simple Mail Transfer Protocol (SMTP) is an application layer protocol for sending email messages. It is used for communication between servers and between servers and email clients.\n","title":"Simple Mail Transfer Protocol","type":"glossary"},{"content":"The Command Line Interface (CLI) is a user interface that allows users to interact with a computer system by typing commands and commands into a terminal or command prompt.\n","date":"26 April 2026","externalUrl":null,"permalink":"/en/glossary/cli/","section":"Glossary","summary":"The Command Line Interface (CLI) is a user interface that allows users to interact with a computer system by typing commands and commands into a terminal or command prompt.\n","title":"Command Line Interface","type":"glossary"},{"content":"SCSS (Sassy CSS) is the most common syntax for Sass (Syntactically Awesome Style Sheets), a preprocessor scripting language that extends standard CSS with advanced programming features. It is a superset of CSS, meaning any valid CSS code is also valid SCSS, and it uses a familiar syntax with curly braces and semicolons.\nBecause browsers cannot interpret SCSS directly, files with the .scss extension must be compiled into standard .css files using a Sass compiler.\n","date":"21 April 2026","externalUrl":null,"permalink":"/en/glossary/scss/","section":"Glossary","summary":"SCSS (Sassy CSS) is the most common syntax for Sass (Syntactically Awesome Style Sheets), a preprocessor scripting language that extends standard CSS with advanced programming features. It is a superset of CSS, meaning any valid CSS code is also valid SCSS, and it uses a familiar syntax with curly braces and semicolons.\n","title":"Sassy CSS","type":"glossary"},{"content":"Syntactically Awesome Style Sheets (Sass) is a preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). It exists in two syntaxes: the original indented syntax (.sass), which uses whitespace for structure, and the more popular SCSS (.scss), which uses CSS-like braces and semicolons.\nSince browsers cannot interpret Sass directly, the code must be compiled into standard CSS using the appropriate tools.\n","date":"21 April 2026","externalUrl":null,"permalink":"/en/glossary/sass/","section":"Glossary","summary":"Syntactically Awesome Style Sheets (Sass) is a preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). It exists in two syntaxes: the original indented syntax (.sass), which uses whitespace for structure, and the more popular SCSS (.scss), which uses CSS-like braces and semicolons.\n","title":"Syntactically Awesome Style Sheets","type":"glossary"},{"content":"FastCGI Process Manager (FPM) is an alternative PHP FastCGI implementation designed to handle high loads efficiently. It runs as a separate service, managing pools of worker processes that execute PHP scripts, improving performance and resource utilization. FPM offers advanced features like dynamic process spawning, adaptive scaling, and enhanced logging.\n","date":"14 April 2026","externalUrl":null,"permalink":"/en/glossary/fpm/","section":"Glossary","summary":"FastCGI Process Manager (FPM) is an alternative PHP FastCGI implementation designed to handle high loads efficiently. It runs as a separate service, managing pools of worker processes that execute PHP scripts, improving performance and resource utilization. FPM offers advanced features like dynamic process spawning, adaptive scaling, and enhanced logging.\n","title":"FastCGI Process Manager","type":"glossary"},{"content":"Hypertext Preprocessor (PHP) is a server-side scripting language primarily used for web development. It was originally created by Rasmus Lerdorf in 1995 and is now owned by the PHP Association. PHP is often used to create dynamic web pages that can respond to user input, interact with databases, and generate dynamic content.\n","date":"14 April 2026","externalUrl":null,"permalink":"/en/glossary/php/","section":"Glossary","summary":"Hypertext Preprocessor (PHP) is a server-side scripting language primarily used for web development. It was originally created by Rasmus Lerdorf in 1995 and is now owned by the PHP Association. PHP is often used to create dynamic web pages that can respond to user input, interact with databases, and generate dynamic content.\n","title":"Hypertext Preprocessor","type":"glossary"},{"content":"Python Enhancement Proposal (PEP) is a design document providing information to the Python community or describing a new feature for Python, its processes or its environment. These documents serve as the primary mechanism for proposing major new features, collecting community input, and documenting the design decisions behind the language.\n","date":"11 April 2026","externalUrl":null,"permalink":"/en/glossary/pep/","section":"Glossary","summary":"Python Enhancement Proposal (PEP) is a design document providing information to the Python community or describing a new feature for Python, its processes or its environment. These documents serve as the primary mechanism for proposing major new features, collecting community input, and documenting the design decisions behind the language.\n","title":"Python Enhancement Proposal","type":"glossary"},{"content":"Tom’s Obvious Minimal Language (TOML) is a configuration file format designed for readability and a clear, unambiguous specification. It supports key-value pairs, tables (sections), arrays, and inline tables to structure data hierarchically, making it ideal for human-readable and easy-to-edit project configurations.\n","date":"11 April 2026","externalUrl":null,"permalink":"/en/glossary/toml/","section":"Glossary","summary":"Tom’s Obvious Minimal Language (TOML) is a configuration file format designed for readability and a clear, unambiguous specification. It supports key-value pairs, tables (sections), arrays, and inline tables to structure data hierarchically, making it ideal for human-readable and easy-to-edit project configurations.\n","title":"Tom's Obvious Minimal Language","type":"glossary"},{"content":"The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. TCP is connection-oriented, meaning that sender and receiver firstly need to establish a connection based on agreed parameters; they do this through a three-way handshake procedure. The server must be listening (passive open) for connection requests from clients before a connection is established.\n","date":"10 April 2026","externalUrl":null,"permalink":"/en/glossary/tcp/","section":"Glossary","summary":"The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. TCP is connection-oriented, meaning that sender and receiver firstly need to establish a connection based on agreed parameters; they do this through a three-way handshake procedure. The server must be listening (passive open) for connection requests from clients before a connection is established.\n","title":"Transport Control Protocol","type":"glossary"},{"content":"Stock Keeping Unit (SKU), o Unitat de Manteniment d’Existències, és un codi alfanumèric únic assignat a cada variant del producte en inventari, utilitzat per identificar, fer el seguiment i gestionar les existències dins d’una empresa. Serveix com a referència interna per a articles com mides, colors o models específics.\n","date":"11 March 2026","externalUrl":null,"permalink":"/en/glossary/sku/","section":"Glossary","summary":"Stock Keeping Unit (SKU), o Unitat de Manteniment d’Existències, és un codi alfanumèric únic assignat a cada variant del producte en inventari, utilitzat per identificar, fer el seguiment i gestionar les existències dins d’una empresa. Serveix com a referència interna per a articles com mides, colors o models específics.\n","title":"Stock Keeping Unit","type":"glossary"},{"content":"The World Wide Web Consortium (W3C) is an international standards organization founded in 1994 by Tim Berners-Lee that develops open technical standards and guidelines to ensure the long-term growth, interoperability, and accessibility of the World Wide Web.\n","date":"3 February 2026","externalUrl":null,"permalink":"/en/glossary/w3c/","section":"Glossary","summary":"The World Wide Web Consortium (W3C) is an international standards organization founded in 1994 by Tim Berners-Lee that develops open technical standards and guidelines to ensure the long-term growth, interoperability, and accessibility of the World Wide Web.\n","title":"World Wide Web Consortium","type":"glossary"},{"content":"A Demilitarised Zone (DMZ) is an information security concept that refers to a physical or logical subnetwork that acts as an intermediate zone between an organisation’s internal network and the Internet.\nKey characteristics:\nSecurity isolation: It separates publicly accessible services (such as web, email or file servers) from the private internal network. Dual firewall: It is normally protected by two firewalls: one between the Internet and the DMZ, and another between the DMZ and the internal network. Risk minimisation: If a server in the DMZ is compromised, the attacker does not have direct access to the internal network. ","date":"1 February 2026","externalUrl":null,"permalink":"/en/glossary/dmz/","section":"Glossary","summary":"A Demilitarised Zone (DMZ) is an information security concept that refers to a physical or logical subnetwork that acts as an intermediate zone between an organisation’s internal network and the Internet.\n","title":"Demilitarized Zone","type":"glossary"},{"content":"Virtual Extensible LAN (VXLAN) is a network virtualization technology that encapsulates Layer 2 Ethernet frames within Layer 4 UDP datagrams, enabling the creation of scalable virtual networks over an underlying Layer 3 IP infrastructure.\nIt was developed to overcome the scalability limitations of traditional VLANs, which are restricted to 4,094 logical networks due to their 12-bit VLAN ID. VXLAN uses a 24-bit Virtual Network Identifier (VNI), allowing up to approximately 16 million unique network segments, making it ideal for large-scale data centers and cloud environments.\nVXLAN operates through VXLAN Tunnel Endpoints (VTEPs), which encapsulate and decapsulate traffic, enabling virtual machines across different physical locations to communicate as if on the same local network while maintaining Layer 2 semantics. It is standardized by the IETF in RFC 7348.\n","date":"1 February 2026","externalUrl":null,"permalink":"/en/glossary/vxlan/","section":"Glossary","summary":"Virtual Extensible LAN (VXLAN) is a network virtualization technology that encapsulates Layer 2 Ethernet frames within Layer 4 UDP datagrams, enabling the creation of scalable virtual networks over an underlying Layer 3 IP infrastructure.\n","title":"Virtual Extensible LAN","type":"glossary"},{"content":"TL;DR: If you are interested in using open source technologies on premise or on the European cloud, this is what I do.\nI would describe myself as a jack of many trades, master of some1. Way back, when I was still a teenager, the being good at one thing mantra did not resonate with me2 so, instead, I took a more holistic approach to life, work, and social relationships.\nSince then, I have spent all my life learning from many different practices, disciplines and roles in sports, at work, through hobbies and from people. This has turned me into a very versatile person, that easily adapts to change, with a broader perspective and a more open mind. I share John Carmack’s holistic understanding of technology.\nThe most important thing is to have a broad understanding of technology. You can be a specialist in one area, but you need to have a good understanding of the whole system. If you don’t, you will never be able to make the right decisions.\nAs a manager, I strongly believe in the power of transformation through good leadership. Across my career, I have successfully worked with, and within, non-technical departments such as product, marketing or support, and also operations, administration and finances. From my experience, these are the pillars I try to work with:\nPlan ahead and lead by example. Try to encourage independent problem solving and decision making within a well defined framework. Empower team members to take ownership while avoiding micromanaging. Provide constructive feedback using clear, honest and transparent communication. As a systems engineer, I am, mostly, a back-end guy: systems, platform, devops, site reliability, REST APIs, but I also have great interest in good software development practices and software architectures. I am a huge fan of TDD, VSA and DDD, and agile methodologies.\nIf you want, you can have a look at my curriculum vitae.\nThe whole quote being “A jack of all trades is a master of none, but oftentimes better than a master of one”. ↩︎\nPsychology suggests that my nervous system, when I was a kid, started building a cognitive architecture known as an M-shaped mind. ↩︎\n","date":"15 January 2026","externalUrl":null,"permalink":"/en/work/","section":"Calabruix","summary":"TL;DR: If you are interested in using open source technologies on premise or on the European cloud, this is what I do.\nI would describe myself as a jack of many trades, master of some1. Way back, when I was still a teenager, the being good at one thing mantra did not resonate with me2 so, instead, I took a more holistic approach to life, work, and social relationships.\n","title":"What I do","type":"page"},{"content":"Extensible Markup Language (XML) is a text-based format used to store and transport structured data in a way that is both human-readable and machine-readable. Its primary purpose is to facilitate data sharing between different systems and applications by providing a flexible, standardized way to define and organize information using custom tags.\n","date":"3 January 2026","externalUrl":null,"permalink":"/en/glossary/xml/","section":"Glossary","summary":"Extensible Markup Language (XML) is a text-based format used to store and transport structured data in a way that is both human-readable and machine-readable. Its primary purpose is to facilitate data sharing between different systems and applications by providing a flexible, standardized way to define and organize information using custom tags.\n","title":"eXtensible Markup Language","type":"glossary"},{"content":"Standard Generalized Markup Language (SGML) is a meta-language for defining markup languages that specify the structure and formatting of documents, serving as the ancestor of both HTML and XML.\n","date":"3 January 2026","externalUrl":null,"permalink":"/en/glossary/sgml/","section":"Glossary","summary":"Standard Generalized Markup Language (SGML) is a meta-language for defining markup languages that specify the structure and formatting of documents, serving as the ancestor of both HTML and XML.\n","title":"Standard Generalized Markup Language","type":"glossary"},{"content":"When monitoring Linux systems with Prometheus, Node Exporter provides essential hardware and OS-level metrics, like overall CPU and memory usage.\nHowever, to gain granular visibility into specific applications, such as tracking the number of Gunicorn workers, checking if a critical agent has died, or isolating which process is consuming too much RAM, we need a more specialised tool.\nThis is where the Prometheus Process Exporter comes in. It mines the Linux /proc filesystem to report detailed metrics on groups of processes defined by their name or command, allowing us to establish precise, application-centric monitoring and alerting.\nInstallation # We will install it from the Debian repository, then manually update the binary from the Prometheus Node Exporter releases page at Github.\napt-get update apt-get install prometheus-process-exporter ssl-cert adduser prometheus ssl-cert Optionally, update the binary file with the more modern version from Github:\nexport PROCESS_EXPORTER_VERSION=\u0026#34;0.8.7\u0026#34; wget https://github.com/ncabatoff/process-exporter/releases/download/v${PROCESS_EXPORTER_VERSION}/process-exporter-${PROCESS_EXPORTER_VERSION}.linux-amd64.tar.gz \\ --output-document=/tmp/process-exporter-${PROCESS_EXPORTER_VERSION}.linux-amd64.tar.gz tar --directory=/tmp --extract --gzip --file=/tmp/process-exporter-${PROCESS_EXPORTER_VERSION}.linux-amd64.tar.gz systemctl stop prometheus-process-exporter cp /tmp/process-exporter-${PROCESS_EXPORTER_VERSION}.linux-amd64/process-exporter /usr/bin/prometheus-process-exporter systemctl start prometheus-process-exporter You will have to repeat this installation in every VM and node, so you may want to automate it using Ansible.\nConfiguration # The configuration of the Process Exporter requires three files. Let’s begin by editing the file /etc/prometheus/process_exporter.yml, which contains the web configuration for the exporter.\n# Prometheus Process Exporter configuration # See: https://prometheus.io/docs/prometheus/latest/configuration/https/ # Allow TLS connections tls_server_config: cert_file: /etc/ssl/certs/localdomain.com.crt key_file: /etc/ssl/private/localdomain.com.key min_version: TLS12 # Enable HTTP/2 support, which is only supported with TLS http_server_config: http2: true The localdomain.com certificate in the example is a wildcard certificate for the local domain of the Proxmox VE cluster, managed internally via PowerDNS, and issued via Let’s Encrypt. Adapt it to your scenario.\nLet’s continue with the /etc/default/prometheus-process-exporter file, that contains the the command-line arguments passed to the binary:\n# Set the command-line arguments to pass to the server. ARGS=\u0026#34;--web.config.file /etc/prometheus/process_exporter.yml \\ --web.listen-address \u0026#39;:9256\u0026#39; \\ --web.telemetry-path \u0026#39;/metrics\u0026#39; \\ --config.path /etc/prometheus/process_mappings.yml \\ --recheck-with-time-limit 3s\u0026#34; In Go’s flag library, duration flags expect values like 30s, 5m, 1h, etc.\nOne last file is required, the mappings file where we will specify the processes we want to monitor.\nMappings # As you can see in our /etc/default/prometheus-process-exporter file, we are instructing the Process Exporter to load the mappings from the /etc/prometheus/process_mappings.yml file via the --config-path argument. This file allows us to specify which processes and under which rules the exporter must capture information about, using YAML format.\nThe contents of this file will vary depending on what processes we want to capture information about.\nGroups # A group is a collection of one or more running processes that the exporter monitors and reports on under a common metric label.\nThe goal of a good Process Exporter configuration is to explicitly monitor only the high-value application processes (e.g., Gunicorn workers, databases, agents) and ignore the rest to keep the metrics endpoint clean.\nFor that purpose, named groups are the entries you define under the process_names key in the YAML configuration. Each entry provides a name (the group name) and a matching rule (comm, exe, or cmdline).\nA process may only belong to one group, the first one listen, even if multiple items would match.\nGunicorn # Let’s say that we want to monitor Gunicorn, which is running our Django-based web application using the gthread model in a number of LXCs. Our /etc/prometheus/process_mappings.yml could look like this:\nprocess_names: # Gunicorn master process - name: gunicorn_master cmdline: \u0026#39;gunicorn: master \\[.+\\]\u0026#39; # Gunicorn worker processes - name: gunicorn_worker cmdline: \u0026#39;gunicorn: worker \\[.+\\]\u0026#39; We are defining two named groups in this configuration.\nKey takeaways for this setup:\nThe gunicorn_master entry explicitly targets the single master process using the full command line text. The gunicorn_worker group explicitly targets all workers. The \\[.+\\] expression (any character, one or more times, inside square brackets) matches the variable proc_name in the config.py used to in the systemd service file, or its --name equivalent parametre, which helps identify different Gunicorn servers running in the same guest. We use cmdline for because it contains the descriptive parts (master, worker, [proc_name]). The comm field is just the executable name, i.e.,gunicorn, which is too general for distinguishing master from worker. Adapt this to your needs. When you are done, restart the exporter:\nsystemctl restart prometheus-process-exporter.service We still need to configure our Prometheus server to pull metrics from the exporter.\nAdditional labels # Let’s say that we want to include more labels in our metrics. Process Exporter does not allow adding additional labels to series it exports, so we will have to resort to including them in the group name. We could modify the process_mappings.yml file as follows:\nprocess_names: # My web project: Gunicorn master - name: \u0026#34;gunicorn_master;environment=production;service_name=webapp\u0026#34; cmdline: - \u0026#39;gunicorn: master \\[webapp\\]\u0026#39; # My web project: Gunicorn worker - name: \u0026#34;gunicorn_worker;environment=production;service_name=webapp\u0026#34; cmdline: - \u0026#39;gunicorn: worker \\[webapp\\]\u0026#39; We could also include labels such as role=frontend or similar. Adapt this to your needs. When you are done, restart the exporter:\nsystemctl restart prometheus-process-exporter.service Anyhow, this will require using the metric_relabel_configs in our scrape_config in the Prometheus, which we will do in the next section.\nPrometheus server # In our Prometheus server, we need to configure a new job in our scrape configuration, such as:\nscrape_configs: # Process Exporter - job_name: \u0026#39;process_exporter\u0026#39; scrape_interval: 15s scheme: https metrics_path: /metrics tls_config: ca_file: /etc/ssl/certs/ISRG_Root_X1.pem insecure_skip_verify: false file_sd_configs: - files: - file_sd_configs/process_exporter/webapp.yml relabel_configs: - source_labels: [__address__] regex: \u0026#39;(\\w+)\\.localdomain\\.com:.*\u0026#39; target_label: host replacement: \u0026#39;$1\u0026#39; We have taken the chance to add a new host label, which includes the subdomain of the FQDN of our guest, useful to filter for all the metrics concerning a specific guest in the cluster. Finally, the /etc/prometheus/file_sd_configs/process_exporter/webapp.yml file with all the targets:\n- targets: - \u0026#39;webapp1.localdomain.com:9256\u0026#39; - \u0026#39;webapp2.localdomain.com:9256\u0026#39; - \u0026#39;webapp3.localdomain.com:9256\u0026#39; labels: group: \u0026#39;mywebproject\u0026#39; If we decided to add additional semicolon-separated labels to the group name, we will need additional configuration:\nscrape_configs: # Process Exporter - job_name: \u0026#39;process_exporter\u0026#39; [..] # Extract env/service from groupname (semicolon-separated) metric_relabel_configs: - source_labels: [groupname] regex: \u0026#39;.*;env=([^;]+).*\u0026#39; target_label: environment replacement: \u0026#39;$1\u0026#39; - source_labels: [groupname] regex: \u0026#39;.*;service=([^;]+).*\u0026#39; target_label: service_name replacement: \u0026#39;$1\u0026#39; # Relabeling is sequential, so we perform the cleanup last to # restore the original content of the groupname label - source_labels: [groupname] regex: \u0026#39;^([^;]+);.*\u0026#39; target_label: groupname replacement: \u0026#39;$1\u0026#39; When done, instruct Prometheus to reload the configuration file:\nsystemctl reload prometheus.service A good observability practice is to choose a consistent label schema early, e.g. host, service_name, job_name, environment, role, etc.\nAvailable metrics # This configuration would provide the following metrics in Prometheus, among others:\nNumber of workers: namedprocess_namegroup_num_procs{groupname=\u0026quot;gunicorn_worker\u0026quot;} Resident RAM usage of workers: namedprocess_namegroup_memory_bytes{groupname=\u0026quot;gunicorn_worker\u0026quot;,memtype=\u0026quot;resident\u0026quot;} Number of zombie processes: namedprocess_namegroup_states{state=\u0026quot;Zombie\u0026quot;} When configuring alerts, the expression namedprocess_namegroup_num_procs{groupname=\u0026quot;gunicorn_master\u0026quot;} == 0 would indicate that the master process is stopped, and the expression namedprocess_namegroup_num_procs{groupname=\u0026quot;gunicorn_worker\u0026quot;} \u0026lt; X would indicate that there are less worker processes than intended, where X corresponds to the value of the --workers parametre in your systemd service file, or config.py file.\nDo not forget to allow traffic to port 9256 of your guests in your firewall.\nYou can use curl to test connectivity and obtain a list of the available metrics:\ncurl -k https://webapp1.localdomain.com:9256/metrics ","date":"18 November 2025","externalUrl":null,"permalink":"/en/posts/grafana/process-exporter/","section":"Posts","summary":"Collect process metric data as using Prometheus Process Exporter","title":"Gathering process metrics with Process Exporter","type":"posts"},{"content":"The Prometheus Node Exporter is a fundamental component in any Prometheus monitoring stack, designed specifically to collect and expose a wide array of machine-level and operating system metrics from Linux, forming the backbone for comprehensive infrastructure monitoring and alerting.\nIt acts as an agent running on our Proxmox VMs and nodes (not containers), providing metrics such as CPU usage, memory consumption, disk I/O, network traffic, and filesystem capacity.\nInstallation # We will install it from the Debian repository, then manually update the binary from the Prometheus Node Exporter releases page at Github.\napt-get update apt-get install prometheus-node-exporter ssl-cert adduser prometheus ssl-cert Optionally, update the binary file with the more modern version from Github:\nexport NODE_EXPORTER_VERSION=\u0026#34;1.10.2\u0026#34; wget https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz \\ --output-document=/tmp/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz tar --directory=/tmp --extract --gzip --file=/tmp/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz cp /tmp/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter /usr/bin/prometheus-node-exporter You will have to repeat this installation in every VM and node, so you may want to automate it using Ansible.\nConfiguration # The configuration of the Node Exporter requires just two files. Begin by editing the configuration file /etc/prometheus/node.yml, which contains the web configuration for the exporter.\n# Prometheus Node Exporter configuration # See: https://prometheus.io/docs/prometheus/latest/configuration/https/ # Allow TLS connections tls_server_config: cert_file: /etc/ssl/certs/localdomain.com.crt key_file: /etc/ssl/private/localdomain.com.key min_version: TLS12 # Enable HTTP/2 support, which is only supported with TLS http_server_config: http2: true The localdomain.com certificate is a wildcard certificate for the local domain of the cluster, managed internally via PowerDNS, and issued via Let’s Encrypt. Adapt it to your scenario.\nAnd let’s finish with the /etc/default/prometheus-node-exporter file, that contains the the command-line arguments given to the binary:\n# Set the command-line arguments to pass to the server. ARGS=\u0026#34;--web.config.file=/etc/prometheus/node.yml \\ --collector.systemd \\ --collector.processes\u0026#34; At this point, the service file should be enabled and the daemon started, so all you need is to restart the server, then check its status.\nsystemctl restart prometheus-node-exporter systemctl status prometheus-node-exporter Prometheus # Let’s now switch to the LXC holding the Prometheus server. We need to configure it with all the targets where the Node Exporter is being run.\nAs a first step, if you have not already, create the directories for the file-based discovery configuration files:\nmkdir --parents --mode=0755 /etc/prometheus/file_sd_configs The file-based service discovery is a mechanism that allows Prometheus to automatically discover and manage scrape targets by reading the necessary information from files on disk. Prometheus periodically checks these files for changes, and upon detecting modifications, it updates its list of targets without requiring a restart or reload.\nThis approach is particularly useful for integrating custom or third-party service discovery systems, as it enables external processes, such as configuration management tools, cron jobs, or dedicated sidecar programs, to generate the target files.\nThe default refresh interval for file-based discovery is 5 minutes, but this can be configured using the refresh_interval parameter in the Prometheus configuration.\nExample /etc/prometheus/file_sd_configs/node_exporter.yml file:\n- targets: - \u0026#39;mongodb1.localdomain.com:9100\u0026#39; - \u0026#39;mongodb2.localdomain.com:9100\u0026#39; - \u0026#39;nfs1.localdomain.com:9100\u0026#39; - \u0026#39;nfs2.localdomain.com:9100\u0026#39; - \u0026#39;postgresql1.localdomain.com:9100\u0026#39; - \u0026#39;postgresql2.localdomain.com:9100\u0026#39; labels: group: \u0026#39;qemu\u0026#39; We are now ready to edit the /etc/prometheus/prometheus.yml configuration file of our Prometheus server to configure the new job under the scrape_configs key:\nscrape_configs: - job_name: \u0026#39;node_exporter\u0026#39; scrape_interval: 15s scheme: https tls_config: ca_file: /etc/ssl/certs/ISRG_Root_X1.pem insecure_skip_verify: false file_sd_configs: - files: - file_sd_configs/node_exporter.yml relabel_configs: - source_labels: [__address__] regex: \u0026#39;(\\w)\\.localdomain\\.com:.*\u0026#39; target_label: host replacement: \u0026#39;$1\u0026#39; Note the following aspects of this configuration file:\nscrape_interval: 15s, to increase how often the target is scraped (its default value is 1m). scheme: https, to encrypt communications between the Prometheus server and the Node Exporter daemons. insecure_skip_verify: false, the default value, to force Prometheus to perform a full TLS certificate validation. relabel_configs, to add the host label from the instance. This is done in all the jobs so that we can use it when filtering by all metrics belonging to a host, no matter the exporter that brought them in. Available metrics # This configuration would provide the following metrics in Prometheus, among many others:\nTotal CPU time spent waiting for I/O operations node_cpu_seconds_total{mode=\u0026quot;iowait\u0026quot;}. Total physical memory: node_memory_MemTotal_bytes. Estimated memory available for new workloads: node_memory_MemAvailable_bytes. Memory used for I/O buffering and caching: node_memory_Buffers_bytes, node_memory_Cached_bytes. Bytes read/written to disk: node_disk_read_bytes_total, node_disk_written_bytes_total. Number of completed read/write operations: node_disk_reads_completed_total, node_disk_writes_completed_total. Number of available bytes in disk: node_filesystem_avail_bytes{fstype!~\u0026quot;tmpfs|overlay|squashfs\u0026quot;}. Bytes received/transmitted per interface: node_network_receive_bytes_total, node_network_transmit_bytes_total. System load averages: node_load1, node_load5, node_load15. Timestamp of last boot: node_boot_time_seconds When configuring alerts, the following expression would let us know of a reboot of a VM during the last 10 minutes:\n( (pve_uptime_seconds{job=\u0026#34;pve-cluster\u0026#34;, id=~\u0026#34;qemu/.+\u0026#34;} \u0026lt; 300) and (pve_uptime_seconds{job=\u0026#34;pve-cluster\u0026#34;, id=~\u0026#34;qemu/.+\u0026#34;} offset 10m \u0026gt; 600) and on(id) pve_guest_info{job=\u0026#34;pve-cluster\u0026#34;, template=\u0026#34;0\u0026#34;} ) \u0026gt; 0 or ( pve_uptime_seconds{job=\u0026#34;pve-cluster\u0026#34;, id=~\u0026#34;qemu/.+\u0026#34;} * 0 and on(id) pve_guest_info{job=\u0026#34;pve-cluster\u0026#34;, template=\u0026#34;0\u0026#34;} ) Do not forget to allow traffic to port 9100 of your guests in your firewall.\nYou can use curl to test connectivity and obtain a list of the available metrics:\ncurl -k https://webapp1.localdomain.com:9100/metrics Collectors # As per the README file in its Github repository, Node Exporter provides a huge amount of collectors. This is the list of collectors that are enabled by default and are available in the Linux platform:\nCollector Description arp Exposes ARP statistics from /proc/net/arp bcache Exposes bcache statistics from /sys/fs/bcache/ bonding Exposes network bonding statistics from /sys/class/net/*/bonding/ boottime Exposes system boot time derived from /proc/stat conntrack Exposes conntrack statistics (connections, memory usage) cpu Exposes CPU usage metrics from /proc/stat cpufreq Exposes CPU frequency information diskstats Exposes disk I/O statistics from /proc/diskstats edac Exposes error detection and correction (EDAC) statistics entropy Exposes available entropy from /proc/sys/kernel/random/entropy_avail exec Exposes process execution statistics fibrechannel Exposes Fibre Channel device statistics filesystem Exposes filesystem usage (space, inodes) from /proc/mounts and /proc/self/mountstats hwmon Exposes hardware monitoring metrics from /sys/class/hwmon/ infiniband Exposes InfiniBand statistics from /sys/class/infiniband/ ipvs Exposes IPVS connection statistics loadavg Exposes load average from /proc/loadavg logind Exposes user session counts from logind mdadm Exposes RAID status from /proc/mdstat meminfo Exposes memory usage from /proc/meminfo netclass Exposes network interface info from /sys/class/net/ netdev Exposes network device statistics from /proc/net/dev netstat Exposes network statistics from /proc/net/netstat, /proc/net/snmp, etc. nfs Exposes NFS client statistics from /proc/net/rpc/nfs nfsd Exposes NFS server statistics from /proc/net/rpc/nfsd os Exposes OS-level information powersupplyclass Exposes power supply state from /sys/class/power_supply/ schedstat Exposes scheduler statistics from /proc/schedstat sockstat Exposes socket statistics from /proc/net/sockstat stat Exposes various system statistics from /proc/stat textfile Exposes metrics read from a text file (directory configured via flag) thermal_zone Exposes thermal zone info from /sys/class/thermal/ time Exposes the current system time timex Exposes time synchronization status from adjtimex() uname Exposes system information from uname() vmstat Exposes virtual memory statistics from /proc/vmstat xfs Exposes XFS filesystem statistics from /proc/fs/xfs/stat zfs Exposes ZFS performance and status metrics zswap Exposes zswap statistics from /sys/module/zswap/parameters/ In the example above, we enabled two additional collectors, systemd and processes, but the list of collectors disabled by default is much more extensive. This is the list of available collectors for the Linux platform:\nCollector Description buddyinfo Exposes memory fragmentation stats from /proc/buddyinfo cgroups Exposes cgroup summary (active/enabled) cpu_vulnerabilities Exposes CPU vulnerability info (Spectre, Meltdown) from /sys/devices/system/cpu/vulnerabilities/ drm Exposes GPU metrics via DRM (e.g., amdgpu) drbd Exposes DRBD (Distributed Replicated Block Device) stats ethtool Exposes network driver stats via ethtool -S interrupts Exposes detailed interrupt statistics kernel_hung Exposes hung task count from /proc/sys/kernel/hung_task_detect_count ksmd Exposes Kernel Same-page Merging stats lnstat Exposes netlink statistics from /proc/net/stat/ meminfo_numa Exposes NUMA memory stats from /sys/devices/system/node/ mountstats Exposes detailed NFS client stats from /proc/self/mountstats network_route Exposes routing table as metrics pcidevice Exposes PCI device info and link status perf Exposes performance counter metrics (kernel-dependent) processes Exposes aggregate process stats from /proc qdisc Exposes queuing discipline statistics slabinfo Exposes kernel slab allocator stats from /proc/slabinfo softirqs Exposes softirq statistics from /proc/softirqs sysctl Exposes arbitrary sysctl values swap Exposes swap usage from /proc/swaps systemd Exposes systemd service and unit status tcpstat Exposes TCP connection state from /proc/net/tcp wifi Exposes WiFi device and station stats xfrm Exposes IPsec statistics from /proc/net/xfrm_stat zoneinfo Exposes NUMA memory zone metrics All these collectors can be controlled via command-line flags in our /etc/default/prometheus-node-exporter file:\nTo enable a collector, use --collector.\u0026lt;name\u0026gt;. To disable a collector, use --no-collector.\u0026lt;name\u0026gt;. To disable all default collectors, use --collector.disable-defaults, then enable the ones you want one by one. For example, to enable only CPU and memory collectors, you would configure your /etc/default/prometheus-node-exporter file as follows:\n# Set the command-line arguments to pass to the server. ARGS=\u0026#34;--web.config.file=/etc/prometheus/node.yml \\ --collector.disable-defaults \\ ---collector.cpu \\ --collector.meminfo\u0026#34; You need to restart the exporter for these changes to take effect:\nsystemctl restart prometheus-node-exporter.service ","date":"18 November 2025","externalUrl":null,"permalink":"/en/posts/grafana/node-exporter/","section":"Posts","summary":"Collect system and hardware metric data as using Prometheus Node Exporter","title":"Gathering system and hardware metrics with Node Exporter","type":"posts"},{"content":"Grafana Alerting is an integrated alert management system embedded directly within the Grafana visualization platform. Tightly coupled with Grafana’s dashboarding capabilities, this alerting system allows creating alert rules based on the same metrics they already monitor and visualize.\nThe system evaluates these rules continuously against incoming data, transitioning alerts through defined states (normal, pending, alerting) as conditions evolve, with all alert management occurring within the same familiar interface used for data exploration.\nKey concepts # Grafana Alerting lets you define alert rules across multiple data sources and manage notifications with flexible routing. This is the list of the key concepts we will be working with:\nAlert rules. One or more queries and expressions that select the data to be measured. It also includes the threshold that an alert must meet or exceed to fire, as well as the contact point to receive the notification. Only alert instances that are in a firing or resolved state are sent in notifications, i.e., the same alert is not triggered more than once.\nAlert instances. Each alert rule can produce multiple alert instances, or alerts, one for each time series or dimension. This allows observing multiple resources in a single expression. For instance, CPU usage per core.\nContact points. They determine where notifications are sent and their content, e.g., send a text message to Slack or create an issue on Jira.\nNotification messages. They include alert details and can be customised.\nNotification policies. Defined in a tree structure, where the root is the default notification policy, they route alerts to contact points via label matching. Useful when managing large alerting systems, they allow handling notifications by distinct scopes, such as by team (e.g., operations or security) or service.\nNotification grouping. To reduce noise, related firing alerts a grouped into a single notification by default, but his behaviour can be customised.\nSilences and mute timings. They allow pausing notifications without interrupting alert rule evaluation. Silences are used on a one-time basis (e.g., maintenance windows), whereas mute timings are used to pause notifications at regular intervals (e.g., weekends).\nHow it works # At a glance, Grafana Alerting follows this workflow:\nIt periodically evaluates alert rules by executing queries via their data sources and checking their conditions. If a condition is met, an alert instance fires. Firing and resolved alert instances are sent for notifications, either directly to a contact point or through notification policies. Each alert rule can produce multiple alert instances, one per time series or dimension. For example, a rule using the following PromQL expression creates as many alert instances as the amount of CPUs after the first evaluation, enabling a single rule to report the status of each CPU.\nsum by(cpu) (rate(node_cpu_seconds_total{mode!=\u0026#34;idle\u0026#34;}[1m])) Alert instance Value State {cpu=\u0026quot;cpu-0\u0026quot;} 92 Firing {cpu=\u0026quot;cpu-1\u0026quot;} 30 Normal {cpu=\u0026quot;cpu-2\u0026quot;} 95 Firing {cpu=\u0026quot;cpu-3\u0026quot;} 26 Normal Multi-dimensional alerts help surfacing issues on individual components that might be missed when alerting on aggregated data (e.g., total CPU usage).\nEach alert instance targets a specific component, identified by its unique label set, which allow alerts to be more specific. In the previous example, we could have two firing alert instances displaying summaries such as:\nHigh CPU usage on cpu-0. High CPU usage on cpu-2. Alert configuration # Let us begin by configuring four basic alerts:\nHigh CPU usage. High system load. High RAM usage. High disk space usage. For this we have to go through these steps:\nEnable access to the Internet. Set up a contact point. Set up the alert rules. Receive firing and resolved alert notifications. Internet access # LinuX Containers in our Proxmox cluster do not have direct access to the Internet, but for a few excepptions, such as an NGINX reverse proxy, a bastion host, a DNS recursor, and some others. However, Grafana requires access to the Internet to send notifications. Because we do not want to assign a public IP address to our LXC, we will use an HTTP proxy.\nLet’s suppose that the LXC already has the an /etc/environment file with this:\nHTTP_PROXY=http://proxy.localdomain.com:8080 HTTPS_PROXY=http://proxy.localdomain.com:8080 NO_PROXY=localhost,127.0.0.1,127.0.1.1,192.168.0.0/16,.localdomain.com localdomain.com is the internal domain of our Proxmox cluster, its zone managed using PowerDNS.\nThe easiest and most convenient way to allow Grafana Alerting access to the Internet is to create a systemd override at /etc/systemd/system/grafana-server.service.d/override.conf with the following content:\n[Service] EnvironmentFile=/etc/environment Now all that is left is to instruct systemd to reload unit files and drop-ins, and restart Grafana:\nsystemctl daemon-reload systemctl restart grafana-server You can check the status of the server using systemctl status grafana-server. Most importantly, you can make sure that Grafana is seeing the environment variables with the following command:\nPID=$(cat /run/grafana/grafana-server.pid) cat /proc/$PID/environ | tr \u0026#39;\\0\u0026#39; \u0026#39;\\n\u0026#39; | grep -E \u0026#39;HTTP|NO_PROXY\u0026#39; Systemd’s EnvironmentFile parser expects strict KEY=value pairs: no quotes, no export, no spaces around =.\nSlack contact point # We will use Slack for our first contact point, this will be used for warning level notifications. Therefore, before delving into Grafana, we need to set up the Slack API token for our account.\nSlack app # To create a Slack app, follow these steps:\nLog into Slack using your credentials. Visit the Slack API: Applications page. Click on the Create new app button and choose From scratch. Follow the assistant to create the app that will be used by Grafana to post messages using these or similar details:\nApp name: Grafana Alerting Workspace: Pick one of your existing workspaces And click on the Create app button. In the new window, go to OAuth \u0026amp; Permissions and follow these steps:\nIn the Scopes \u0026gt; Bot token scopes section, use the Add an OAuth scope button to add the chat:write scope so that the app has the capacity to post to all channels it is a member of, public or private. Optionally, use the Restrict API Token usage section to add the list of IP addresses that Grafana Alerting will be using Slack from (e.g., your servers and office). Use the Save IP address ranges button when you have added them all. In to OAuth Tokens sections, click on the Install to \u0026lt;your workspace\u0026gt; button. Confirm the action in the next screen. When you are back, copy the Bot User OAuth Token, which starts with xoxb. This will be used to set up the contact point in Grafana Alerting. Optionally, before leaving Slack, go to Basic information \u0026gt; Display information and fill in a short and a long description, such as:\nShort description: “Sends notifications when things go wrong”. Long description: “Used by Grafana in our Proxmox VE, it sends messages when any alarm rule threshold is breached, which include details of the triggered alarm rule. It has permissions to post on any public or private channel it is a member of.”. More importantly, choose a background colour and upload an icon for the app. These will make it easier to tell apart from other apps and users when using the Slack desktop or mobile apps. For example:\nIcon: Alerting bell icon Background colour: #342abf Do not forget to click on the Save changes button before leaving the page.\nSlack workspace # All that is left is to create a channel and add the Grafana Alerting app to that channel.\nUse your browser to visit the Slack homepage, then use the Launch Slack button on the workspace where you created the Grafana Alerting app. If you have the desktop application installed, it will launch it, but you can also use the browser version by clicking the Use Slack in your browser link.\nYou can perform the next steps either way:\nRight-click on the Channels menu option, and select the Create \u0026gt; Create channel option. The Blank channel option is selected by default. Click the Next button. Type in the channel name, e.g., alerts, and set the visibility to Private if you prefer that (default is Public). Click the Create button. Optionally, add people to the channel or click the Skip for now button. The account you are logged in with is already a member of the new channel. Optionally, use the Add description button in the channel to add a description, e.g., “The channel where Grafana Alerting posts notifications when alert rules are fired”. Optionally, use the Notifications drop-down menu to get notifications for All new posts, so you do not miss any. Type the /add command on the message box and choose Add apps to this channel option. In the list of apps, find the Grafana Alerting app and click the Add button 1. You can always visit the list of available apps.\nGrafana # In your Grafana UI, navigate to Alerting \u0026gt; Contact points and click on the Create contact point button. Fill in the form as follows:\nName: Slack Integration: Slack Token: the Bot User OAuth Token you copied from the Slack app. If you have multiple workspaces, add its name to the contact point name.\nOptionally, use the Test button to test the configuration. It may come in handy if, for example, your Grafana requires an HTTP proxy to reach the Internet.\nFinally, click on the Save contact point button.\nAlert rules # Alert rules in Grafana Alerting will determine whether an alert fires and a notification is sent via a contact point. This is done via the Alerting \u0026gt; Alert rules of the Grafana UI.\nGrafana first introduced Unified Alerting for production use in version 9, where it officially became the default alerting system, and has been evolving it since then.\nAmong other things, it enforces a single condition block, meaning we cannot have two separate conditions with different thresholds (e.g., \u0026gt; 80 and \u0026gt; 95) being assigned different labels (e.g., warning and critical, respectively).\nBut, even if Grafana Alerting did not force us to have separate alert rules for the warning and the critical thresholds, because we have different queries with different semantics and metric sources2 for LXCs (PVE Exporter) and VMs (Node Exporter), we would still be keeping separate alert rules.\nOur scrape interval is configured to 15 seconds in Prometheus.\nWe will start with a few alert rules that monitor CPU, RAM, and disk usage on our guests, taking the Node Exporter Full and Proxmox via Prometheus dashboards as reference.\nThe following table summarises what we will be achieving with our first batch of alert rules:\nAlert Target Source Warning Critical Labels Disk usage LXC PVE 80% 90% host_type=lxc, alert_group=disk CPU usage LXC PVE 80% 95% host_type=lxc, alert_group=cpu RAM usage LXC PVE 80% 95% host_type=lxc, alert_group=ram Disk usage VM Node 80% 90% host_type=vm, alert_group=disk CPU usage VM Node 80% 95% host_type=vm, alert_group=cpu RAM usage VM Node 80% 95% host_type=vm, alert_group=ram This is a starting point. We will most probably have to adjust the window and the threshold as the system evolves.\nWhen you click the New alert rule button in the UI, you will note that the form is split into several sections:\nEnter alert rule name. Define query and alert condition. Add folders and labels. Set evaluation behavior. Configure notifications. Configure notification message. The alert rule name will appear in the alert notification, so keep it short and sweet.\nWhen setting up an alert rule, we need to apply a threshold to the query. For instance, given the following PromQL query:\n100 * avg( 1 - rate( node_cpu_seconds_total{ mode=\u0026#34;idle\u0026#34;,job=\u0026#34;node_exporter\u0026#34;,group=\u0026#34;qemu\u0026#34; }[5m] ) ) by (instance) \u0026gt; 80 This expression returns those instances whose 5-minute average CPU usage exceeds 80%. You can try this expression on the Prometheus UI.\nWhen creating alert rules, use the Duplicate option in the context menu to speed up the process.\nAs summarised in the table above, we will be using differnt thresholds for our warning and critical levels.\nCommon values # Next there is a list of the common values among the alert rules we will be creating:\nData source: Prometheus Folder: Create or reuse an Infrastructure folder. Evaluation group: Create or reuse a default evalution group, with an evaluation interval of 30s. Pending period: 2m. Keep firing for: None. Runbook URL: link to the page in your knowledge base that explains what to do when this alert rule triggers 3. Specific values # This section explains the values that differ in each alert rule.\nName When query Contact point Labels High disk usage in LXC is above: 80 Slack severity=warning Critical disk usage in LXC is above: 90 Click2Call severity=critical High disk usage in VM is above: 80 Slack severity=warning Critical disk usage in VM is above: 90 Click2Call severity=critical High CPU usage in LXC is above: 80 Slack severity=warning Critical CPU usage in LXC is above: 95 Click2Call severity=critical High CPU usage in VM is above: 80 Slack severity=warning Critical CPU usage in VM is above: 95 Click2Call severity=critical High CPU usage in LXC is above: 80 Slack severity=warning Critical CPU usage in LXC is above: 95 Click2Call severity=critical High CPU usage in VM is above: 80 Slack severity=warning Critical CPU usage in VM is above: 95 Click2Call severity=critical Optionally, set a summary and a description, adapting the threshold value in the summary for each rule:\nAlert group: disk: Summary: “Disk usage has exceeded 80%”. Description: “The disk usage on this guest has reached {{ $values.A.Value | printf “%.1f” }}%. Grafana evaluated this condition continuously for 2 minutes before firing the alert.” Alert group: cpu: Summary: “CPU usage has exceeded 80% for the last 5 minutes”. Description: “The CPU usage on this guest has reached {{ $values.A.Value | printf “%.1f” }}% over the last 5 minutes. Grafana evaluated this condition continuously for 2 minutes before firing the alert.” Alert group: ram: Summary: “RAM usage has exceeded 80%”. Description: “The RAM usage on this guest has reached {{ $values.A.Value | printf “%.1f” }}%. Grafana evaluated this condition continuously for 2 minutes before firing the alert.” The only bit we are missing now is the query. Given that they are different for each metric and guest type, they are explained in separate sections next.\nGrafana automatically assigns each query a letter name, starting with A, B, C, etc. Even if you never explicitly name it.\nDisk usage # We want to compute disk usage per instance. We will be using metrics from the Node Exporter for the VMs, and metrics from the PVE Exporter for the LXCs.\nFor our VMs, our PromQL query could look like this:\n100 * (1 - (node_filesystem_avail_bytes{fstype!~\u0026#34;tmpfs|overlay|squashfs\u0026#34;,job=\u0026#34;node_exporter\u0026#34;,group=\u0026#34;qemu\u0026#34;} / node_filesystem_size_bytes{fstype!~\u0026#34;tmpfs|overlay|squashfs\u0026#34;,job=\u0026#34;node_exporter\u0026#34;,group=\u0026#34;qemu\u0026#34;})) This query calculates the free space given the total space and the used space for each mount point of the VM, with a few exceptions we are not intersted in monitoring. Moreover, note that the query returns attributes for the device, the fstype and the mountpoint.\nFor our LXCs, the PVE Exporter offers the pve_disk_usage_bytes and pve_disk_size_bytes metrics, which will allow us to calculate the percentage of free disk space:\n(pve_disk_usage_bytes{id=~\u0026#34;lxc/.+\u0026#34;} / pve_disk_size_bytes{id=~\u0026#34;lxc/.+\u0026#34;}) * 100 CPU usage # We want to compute CPU usage percentage per instance. We will be using metrics from the Node Exporter for the VMs, and metrics from the PVE Exporter for the LXCs.\nFor our VMs, using a 5-minute rate window in order to smooth our short spikes, our PromQL query could look like this:\n100 * avg( 1 - rate( node_cpu_seconds_total{ mode=\u0026#34;idle\u0026#34;,job=\u0026#34;node_exporter\u0026#34;,group=\u0026#34;qemu\u0026#34; }[5m] ) ) by (instance) This returns the average CPU usage percentage over the last 5 minutes for each host, as we group by the instance label. Grouping by instance ensures one series (and thus one alert instance) per host.\nFor our convenience, Node Exporter is configured to set the label group=\u0026quot;qemu\u0026quot; when scrapping VMs.\nFor our LXCs, the PVE Exporter offers the pve_cpu_usage_ratio metric, which is a momentary ratio (0-1) reported by the Proxmox API. This means that it is already a smoothed, averaged value over the last few seconds from Proxmox itself. But, because we want extra smoothing of the usage reported by Proxmox, we will wrap it up with a moving average:\navg_over_time(pve_cpu_usage_ratio{id=~\u0026#34;lxc/.+\u0026#34;}[5m]) * 100 This will ignore occasional spikes before alerting, leading to the intended triggering of alerts only in case of sustained high usage of CPU.\nRegarding the 5-minute range vector in the PromQL query and Grafana’s Evaluation behavior \u0026gt; Pending period setting, it is important to note that they are two different things, working in conjunction.\nOn the one hand, the PromQL query we are using instructs Prometheus to, for each evaluation, calculate the average rate of idle CPU seconds over the past 5 minutes. This does not affect alert timing, but how the metric is calculated, producing a smoothed, averaged CPU usage value for each host at the moment of evaluation.\nOn the other hand, the Pending period in Grafana is an alert engine feature, therefore it does not change what PromQL computes. Instead, it controls when the alert actually fires once the threshold condition is met.\nIn our case, combining both aligns with our sustained high CPU logic we want to watch for.\nRAM # We want to compute RAM usage per instance. We will be using metrics from the Node Exporter for the VMs, and metrics from the PVE Exporter for the LXCs.\nFor our VMs, our PromQL query could look like this:\n(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100 This query calculates the percentage of RAM used from the amount of bytes avalable at a given time and the total amount of bytes available in the VM.\nFor our LXCs, the PVE Exporter offers the pve_memory_usage_bytes and pve_memory_size_bytes metrics, which will allow us to calculate the percentage of free RAM:\n(pve_memory_usage_bytes{id=~\u0026#34;lxc/.+\u0026#34;} / pve_memory_size_bytes{id=~\u0026#34;lxc/.+\u0026#34;}) * 100 Tips # Some tips when creating new alert rules:\nUse the Run queries button to preview the results of the PromQL query. Use the Preview alert rule condition to preview the alert rule firing (if the condition is met). It is to our convenience for the evaluation interval to be close to the scrape interval defined in Prometheus. In our case, because our scrape interval is 15s and the evaluation interval needs to be a multiple of 10s, we set it to 30s. Keep the summary of the notification concise and easily scannable. Use the description field only if you do not have an external runbook URL to link to. System load # Once we have configured a basic set of alarm rules over our guests, let’s delve into more complex queries. Let’s say that we now want to compute system load percentage per VM instance. The Node Exporter dashboard uses the node_load1 metric via the following PromQL query:\nscalar( node_load1{instance=\u0026#34;$node\u0026#34;,job=\u0026#34;$job\u0026#34;} ) * 100 / count( count( node_cpu_seconds_total{instance=\u0026#34;$node\u0026#34;,job=\u0026#34;$job\u0026#34;} ) by (cpu) ) PVE Exporter neither exports the system load of nodes nor guests.\nThis query expresses the system load as a percentage of total CPU capacity, using node_load1 normalized by number of CPU cores. Before diving into the query, some context:\nCores Load Load % Interpretation 1 1 100% Fully loaded 2 1 50% Half-loaded 2 2 100% Fully loaded 2 3 150% Processes waiting for CPU time 4 1 25% Light load 4 2 50% Half-loaded 4 4 100% Fully loaded 4 8 200% Queue building up 8 4 50% Moderate load 8 8 100% Fully loaded 8 12 150% Some CPU contention So, roughly:\nLess than 100% means it is running comfortably. 100% means that the number of runnable processes approximately equals the number of cores. Greater than 100% means that the system is busier than the CPU can handle (context switching, waiting). The query above is designed for a single host, because the dashboard variable $node filters to one instance. If we consider a 5-minute average window our target, we can rewrite it as follows:\n100 * avg(node_load5) by (instance) / count( count(node_cpu_seconds_total) by (instance, cpu) ) by (instance) \u0026gt; 85 This query calculates the 5-minute average system load as a percentage, and it triggers when it exceeds 85%. You can try this expression on the Prometheus UI. Let’s break it down, for reference:\nnode_load5 returns the 5-minute average number of runnable processes4, i.e., those either using or waiting for CPU. It is not normalized by CPU count, e.g., a 4-core VM with node_load5 = 4 is fully loaded (100%), while a 1-core VM with node_load5 = 4 is overloaded (400%). node_cpu_seconds_total has one time series per CPU core and per mode. Counting distinct cpu labels gives the total number of logical cores. Regarding the denominator:\ninstance is each unique target scraped by Prometheus, typically a hostname and port pair. cpu is the logical CPU core number within each instance, e.g., cpu=\u0026quot;0\u0026quot;, cpu=\u0026quot;1\u0026quot;, etc. Each instance has multiple time series with different cpu values. That is why the denominator uses count(count(node_cpu_seconds_total) by (instance, cpu)) by (instance) to count how many CPU cores belong to each instance.\nFurthermore, note that the metrics node_load1, node_load5, and node_load15 are exponentially decaying averages computed by the kernel5 over 1, 5, and 15 minutes, respectively. Unlike CPU usage, which Prometheus derives using rate() on raw counters, these load averages are already smoothed over time by the kernel.\nTherefore, there are three time-based controls we can use for alerting:\nThe buit-in load average, which can be shorter or longer (from 1 to 15 minutes average). The threshold that will trigger the alert rule (85% in the example above). The pending period of the alert rule. For the example above, we will be using a 2-minute pending period. The table next helps illustrate how we can adjust this alert rule to find what is best for our system:\nUse case Metric Condition For Purpose Immediate alert node_load1 \u0026gt; 150% 2m Catch short, critical spikes that impact responsiveness Typical load warning node_load5 \u0026gt; 85% 2m Early warning before saturation Sustained overload node_load5 \u0026gt; 150% 5m Detect chronic overload or resource contention For database servers, spikes during checkpoints may be expected, but sustained load often indicates inefficient queries or insufficient CPUs. For shared virtual machines, temporary contention is okay, but if load stays high the hypervisor may be oversubscribed.\nFolders and labels # Folders in Grafana Alerting are primarily for organizing and scoping alert rules. They control permissions, visibility, and namespacing. How you organise your folders depends on your needs, but common strategies are:\nStrategy Example folder names When By layer system, apps, network, databases Separate node and app-level alerts By environment production, staging, developmnet Different risk levels By team backend, frontend, dba Clear team ownership By service pve, web, backoffice, api, dns Each service has several nodes/alerts Labels in Grafana Alerting are extremely helpful for filtering and routing. They do not affect logic, but they let you:\nFilter alert lists in Grafana’s “Alert rules” view. Route alerts by tag in contact point policies. Group related alerts in notifications. Common tagging practices are:\nTag key Example value Purpose environment production, staging Routing, severity and silences service webapp, pdns, nginx Which service generated the alert team dba, backoffice, website Ownership and routing severity warning, critical Escalation policies category cpu, ram, disk, network Filter alerts by resource type job node_exporter, promtail Source of information cluster hetzner, ovh, pve-bcn Distinguish segments or datacenters Severity and routing # It is common practice to define a number of severity levels, so they are handled differently. This will be very different depending on the needs of the organisation, but a good starting point could be:\nSeverity Example use info Low-impact, for awareness only warning Needs attention but not urgent critical Service or user impact likely Then, severity would be set via rule labels, which would be used in the notification policy. A tool such as Grafana OnCall could come in handy.\nStatus monitoring # In order to monitor whether hosts are up and running, we will be using data from the Node Exporter for our VMs and nodes, and data from the PVE Exporter for all our guests and nodes.\nFor hosts with Node Exporter, use the standard up metric. An alert rule will fire if the target is unreachable.\n- alert: InstanceDown expr: up == 0 for: 2m labels: severity: critical annotations: summary: \u0026#34;Instance {{ $labels.instance }} down\u0026#34; description: \u0026#34;{{ $labels.job }} instance {{ $labels.instance }} has been down for more than 2 minutes.\u0026#34; The PVE Exporter provides a pve_up metric for Proxmox nodes and guests (VMs and LXCs). To alert on any guest being down, we will use a join with pve_guest_info.\n- alert: ProxmoxGuestDown expr: (pve_guest_info * on(id) group_left(name) pve_up) == 0 for: 5m labels: severity: critical annotations: summary: \u0026#34;Proxmox guest {{ $labels.name }} down\u0026#34; description: \u0026#34;Guest {{ $labels.name }} (ID: {{ $labels.id }}) on node {{ $labels.instance }} has been down for more than 5 minutes.\u0026#34; This rule multiplies pve_guest_info (which has a constant value of 1 for every guest) with pve_up (1 if up, 0 if down), joining on the guest ID. When a guest is down, the result is 0, triggering the alert. Using pve_guest_info in combination with pve_up provides enriched labels like name, tags, and type in the alert.\nIf you ever need to remove the app from the channel, use the /remove @grafana_alerting command. ↩︎\nThey have different units, smoothing, scaling, sensitivity and, potentially, thresholds. ↩︎\nThere are many open source options to build your knowledge base, such as Docmost, Appflowy, or Outline. ↩︎\nThe same value shown by the uptime or top commands. ↩︎\nThe kernel indeed computes them using an exponential decay formula, not a simple arithmetic mean. Also called exponential moving average, or EMA, this formula gives more weight to recent samples and less weight to older ones, but never discards them entirely. The contribution of an old sample decays exponentially with time. ↩︎\n","date":"28 October 2025","externalUrl":null,"permalink":"/en/posts/grafana/alerting/","section":"Posts","summary":"Create, manage and respond to alert rules based on metrics and logs from multiple data sources","title":"Using Grafana Alerting to detect and notify issues","type":"posts"},{"content":"The Proxmox VE Exporter for Prometheus collects metrics from the cluster, its nodes and its guests. Specifically, it supports the following metrics for guests (LXCs and VMs):\nCPU usage: pve_cpu_usage_ratio and pve_cpu_usage_limit. RAM usage: pve_memory_usage_bytes and pve_memory_size_bytes (free/used). Disk space: pve_disk_usage_bytes and pve_disk_size_bytes (used/total for root image). Network I/O: pve_network_transmit_bytes and pve_network_receive_bytes (cumulative since start). Disk I/O: pve_disk_write_bytes and pve_disk_read_bytes (cumulative since start). Status: pve_up (whether guests are running). Uptime: pve_uptime_seconds. Metadata: pve_guest_info (name, node, type, tags). The PVE Exporter uses the Proxmox VE API to collect data, which is pulled by our Prometheus server, as usual. Therefore, this exporter can sit anywhere in the cluster:\nAlongside the existing Prometheus server, provided it has enough resources. In a dedicated, small LXC. In each node of the cluster. For optimal performance, the exporter should be as close as possible (in terms of network hops) to the nodes. This is because it executes a lot of requests to obtain all the data it needs.\nInstallation # We will be installing the exporter in each node. Therefore, the Prometheus server will contact the exporter in each node, which will gather the required metrics by sending a number of requests to the PVE API via the localhost. This will reduce the amount of traffic over the network and speed things up noticeably.\nIncidentally, because our Prometheus server only had access to the private network of the guests and had to go through an HTTP proxy to access the Internet, we will be adding a public IP address to the LXC where it runs. This will reduce the number of network hops requests have to go through even further.\nWherever you decide to install the PVE Exporter, make sure you have a recent enough version of Python. At the moment of writing, the PVE Exporter requires Python 3.9+, so any Debian GNU/Linux from Bullseye onwards will do.\nThese are the steps we will follow:\nCreate a prometheus user. Install a virtual environment for the application. Install prometheus-pve-exporter in the virtual environment. Let’s start by making sure we have installed the necessary packages:\napt-get update apt-get install --yes ca-certificates curl python3 \\ python3-pip python3-venv ssl-cert Now let’s create the user and add it to the ssl-cert group, so it can read the TLS certificate used for encrypted communication between the exporter and Prometheus:\nadduser --system --disabled-login --comment \u0026#34;Prometheus daemon\u0026#34; \\ --home /var/lib/prometheus --groups ssl-cert prometheus We are now ready to create the virtual environment:\npython3 -m venv /opt/prometheus-pve-exporter source /opt/prometheus-pve-exporter/bin/activate And, finally, we can install the prometheus-pve-exporter into the virtual environment:\npip install prometheus-pve-exporter deactivate So that the prometheus user can operate without issues, the /opt/prometheus-pve-exporter folder and all files and subdirectories have to be readable by everyone. This should already be the case, as the default UMASK is 022, as defined in the /etc/login.defs file. You can check it out with the following command:\ngrep ^UMASK /etc/login.defs Optionally, you can use the find command to make sure:\nfind /opt/prometheus-pve-exporter ! -perm -o=r If the above command returns no results, you are ready to start the configuration steps.\nAPI token # We are going to need to generate a user and a token so that the Prometheus PVE Exporter can request the data it needs to generate the metrics. The easiest way to do this is via the terminal in any of the nodes:\npveum user add prometheus@pve --comment \u0026#34;Prometheus Monitoring\u0026#34; pveum user token add prometheus@pve monitoring --privsep=0 This will output a token. Save it in some vault, such as Proton Pass or Vaultwarden, and use it later on, when configuring the /etc/prometheus/pve_exporter.yml file.\nKey Value full-tokenid prometheus@pve!monitoring info {\u0026quot;privsep\u0026quot;:\u0026quot;0\u0026quot;} value xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Finally, grant the PVEAuditor role (read-only) to the user:\npveum acl modify / --user prometheus@pve --role PVEAuditor Configuration # So that we have a consistent way to deploy Prometheus exporters them across our cluster, we will mimic the way they are packaged in Debian, that is, a file with the command-line arguments at /etc/default/ and a main configuration file inside /etc/prometheus/.\nCommand line # Let’s start with the command-line arguments file at /etc/default/prometheus-pve-exporter:\n# Environment variables for prometheus-pve-exporter # See: https://github.com/prometheus-pve/prometheus-pve-exporter # # Bind to all interfaces. # Disable the config collector for our large deployment (100+ guests), # as it makes one API call per guest. # ARGS=\u0026#34;--config.file=\u0026#39;/etc/prometheus/pve_exporter.yml\u0026#39; \\ --web.listen-address=\u0026#39;[::]:9221\u0026#39; \\ --collector.status \\ --collector.version \\ --collector.node \\ --collector.cluster \\ --collector.resources \\ --collector.replication \\ --no-collector.config \\ --server.keyfile=\u0026#39;/etc/ssl/private/localdomain.com.key\u0026#39; \\ --server.certfile=\u0026#39;/etc/ssl/certs/localdomain.com.crt\u0026#39;\u0026#34; The localdomain.com certificate in the example is a wildcard certificate for the local domain of the cluster, managed internally via PowerDNS, and issued via Let’s Encrypt. Adapt it to your scenario.\nMain options # Given that this will probably be the first Prometheus-related package installed on the node, you will need to create the configuration directory first:\nmkdir --parents --mode=0755 /etc/prometheus You can now create the main configuration file at /etc/prometheus/pve_exporter.yml, with the following content:\n# Prometheus PVE Exporter configuration # See: https://github.com/prometheus-pve/prometheus-pve-exporter default: user: prometheus@pve token_name: \u0026#34;monitoring\u0026#34; token_value: \u0026#34;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\u0026#34; verify_ssl: false Since the exporter will use the localhost to connect to the API, there is no point in verifying the TLS certificate of the connection.\nDo not forget to restrict permissions on the /etc/prometheus/pve_exporter.yml file, given that it contains sensitive information:\nchown prometheus:prometheus /etc/prometheus/pve_exporter.yml chmod 600 /etc/prometheus/pve_exporter.yml Systemd # Let’s end with the systemd service file at /etc/systemd/system/prometheus-pve-exporter.service:\n[Unit] Description=Prometheus exporter for Proxmox VE Documentation=https://github.com/prometheus-pve/prometheus-pve-exporter After=network.target [Service] Type=simple User=prometheus Group=prometheus EnvironmentFile=/etc/default/prometheus-pve-exporter ExecStart=/opt/prometheus-pve-exporter/bin/pve_exporter $ARGS # Security hardening NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/var/log # Restart policy Restart=on-failure RestartSec=5s # Resource limits LimitNOFILE=8192 [Install] WantedBy=multi-user.target Starting up # Our first moment of truth, let’s enable and start the service:\nsystemctl daemon-reload systemctl enable --now prometheus-pve-exporter.service You can check the status of the service with the following command:\nsystemctl status prometheus-pve-exporter.service And you can monitor the logs produced by the service with this command:\njournalctl --follow --unit=prometheus-pve-exporter.service Do not forget to adjust the rules of your firewall so that the LXC with the Prometheus server can access the nodes with the PVE Exporter on port 9221. Remember that firewall rules at the datacentre level apply to all nodes.\nYou can now test the exporter from the terminal of the node:\ncurl \u0026#34;https://proxmox1.localdomain.com:9221/pve?module=default\u0026amp;cluster=1\u0026amp;node=1\u0026#34; The list of available metrics will be useful when configuring Alert Rules in Grafana, so you may want to save it:\ncurl \u0026#34;https://proxmox1.localdomain.com:9221/pve?module=default\u0026amp;cluster=1\u0026amp;node=1\u0026#34; \u0026gt; ~/pve_exporter_metrics.txt The value of the module parametre in the query string corresponds to the configuration key we used in the main configuration file, i.e., default.\nNetwork traffic # Because of how the Proxmox VE API is designed, the PVE Exporter needs to perform a fairly big amount of calls to it in order to get all the information it requires. Here you are some stats, for reference.\nLet’s say we have 10 nodes and 200 guests, the scrape interval is set to 30 seconds and we are using the default 29 seconds cache duration of the exporter, without enabling the config collector.\nJob type Endpoint GET /api2/json Calls Metrics gathered Cluster /cluster/resources 1 Nodes, VMs, LXCs, storage, and metrics for guests Cluster /nodes 1 List of nodes and HA state information Node /nodes/{node}/status 10 Node status Node /nodes/{node}/storage 10 Storage information per node Node /nodes/{node}/disks/list 10 Physical disk information and SMART status Node /nodes/{node}/certificates/info 10 TLS certificate expiration information Node /nodes/{node}/version 10 PVE version information per node Node /nodes/{node}/replication 10 VM/LXC replication status This totals 62 calls.\nIf we were to enable the config collector, assuming we had 180 LXCs and 20 VMs, we would be adding:\nJob type Endpoint GET /api2/json Calls Observations Guest /nodes/{node}/qemu 10 Lists all VMs on each node Guest /nodes/{node}/lxc 10 Lists all LXCs on each node Guest /nodes/{node}/qemu/{vmid}/config 20 Individual VM configuration Guest /nodes/{node}/lxc/{ctid}/config 180 Individual LXC configuration This totals 220 calls.\nThe config collector provides an additional metric: pve_onboot_status. This shows whether each VM/LXC is configured to start automatically on node boot. You need to consider whether this information is relevant enough in your case to justify an additional 220 HTTP requests to the PVE API.\nPrometheus # We will add two scrape configurations to the /etc/prometheus/prometheus.yml file of our Prometheus server. The first one to gather cluster-level metrics:\nscrape_configs: - job_name: \u0026#39;pve-cluster\u0026#39; static_configs: - targets: - proxmox1.localdomain.com metrics_path: /pve params: module: [default] cluster: [\u0026#39;1\u0026#39;] node: [\u0026#39;0\u0026#39;] And the second one to gather node-level metrics:\nscrape_configs: - job_name: \u0026#39;pve-nodes\u0026#39; file_sd_configs: - files: - file_sd_configs/pve_exporter.yml metrics_path: /pve params: module: [default] cluster: [\u0026#39;0\u0026#39;] node: [\u0026#39;1\u0026#39;] And our /etc/prometheus/file_sd_configs/pve_exporter.yml would have the following content:\n- targets: - \u0026#39;proxmox1.localdomain.com:9221\u0026#39; - \u0026#39;proxmox2.localdomain.com:9221\u0026#39; - \u0026#39;proxmox3.localdomain.com:9221\u0026#39; - \u0026#39;proxmox4.localdomain.com:9221\u0026#39; - \u0026#39;proxmox5.localdomain.com:9221\u0026#39; - \u0026#39;proxmox6.localdomain.com:9221\u0026#39; - \u0026#39;proxmox7.localdomain.com:9221\u0026#39; - \u0026#39;proxmox8.localdomain.com:9221\u0026#39; - \u0026#39;proxmox9.localdomain.com:9221\u0026#39; - \u0026#39;proxmox10.localdomain.com:9221\u0026#39; labels: group: \u0026#39;pve\u0026#39; You can skip the node-level metrics if you do not use replication.\nWe need to ask Prometheus to reload its configuration file for the changes to take effect:\nsystemctl reload prometheus This configuration efficiently scrapes cluster and guest metrics once and node-specific metrics once per node, which is the recommended approach for large clusters. All guest (VM/LXC) metrics are included automatically in the cluster-wide scrape, so you will get metrics for all your containers without needing to scrape them individually.\nGrafana dashboard # The Prometheus PVE Exporter repository provides a link to a Proxmox via Prometheus Grafana dashboard, which we can use as a starting point. Follow these simple steps:\nVisit the Grafana Dashboard webiste. Download the dashboard in JSON format using the Download JSON button. In your Grafana, navigate to the Dashboards menu option. Use the New \u0026gt; Import button and choose the downloaded JSON file. Change the default name if you wish, assign a folder and select the Prometheus data source. Click Import. Once loaded, optionally, click on Settings and add some tags to it. You are set.\n","date":"27 October 2025","externalUrl":null,"permalink":"/en/posts/grafana/pve-exporter/","section":"Posts","summary":"Collect metric data from the cluster, its nodes and all its guests using PVE Exporter.","title":"Gathering cluster-wide metrics with Proxmox VE Exporter","type":"posts"},{"content":"The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks. DHCP automates the process of configuring devices on IP networks, thus allowing them to use the network without requiring manual intervention.\n","date":"19 August 2025","externalUrl":null,"permalink":"/en/glossary/dhcp/","section":"Glossary","summary":"The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks. DHCP automates the process of configuring devices on IP networks, thus allowing them to use the network without requiring manual intervention.\n","title":"Dynamic Host Configuration Protocol","type":"glossary"},{"content":"The Extensible Firmware Interface (EFI) is a specification that defines a software interface between an operating system and platform firmware. It is designed to replace the traditional BIOS firmware interface found in older computers. EFI provides a more flexible and modern approach to booting and managing hardware, allowing for faster boot times, improved security features, and support for larger hard drives.\n","date":"18 August 2025","externalUrl":null,"permalink":"/en/glossary/efi/","section":"Glossary","summary":"The Extensible Firmware Interface (EFI) is a specification that defines a software interface between an operating system and platform firmware. It is designed to replace the traditional BIOS firmware interface found in older computers. EFI provides a more flexible and modern approach to booting and managing hardware, allowing for faster boot times, improved security features, and support for larger hard drives.\n","title":"Extensible Firmware Interface","type":"glossary"},{"content":"GRand Unified Bootloader (GRUB) is a widely used boot loader for Linux-based operating systems. It is the first program that runs when a computer starts up, responsible for loading the operating system kernel into memory. GRUB allows users to select which operating system or kernel to boot into, especially useful for multi-booting systems.\n","date":"18 August 2025","externalUrl":null,"permalink":"/en/glossary/grub/","section":"Glossary","summary":"GRand Unified Bootloader (GRUB) is a widely used boot loader for Linux-based operating systems. It is the first program that runs when a computer starts up, responsible for loading the operating system kernel into memory. GRUB allows users to select which operating system or kernel to boot into, especially useful for multi-booting systems.\n","title":"GRand Unified Bootloader","type":"glossary"},{"content":"GUID Partition Table (GPT) is a modern standard for the layout of partition tables on physical storage devices like hard drives and SSDs. It’s part of the UEFI (Unified Extensible Firmware Interface) standard and is designed to overcome the limitations of the older MBR (Master Boot Record) scheme. GPT allows for larger disk capacities, more partitions, and enhanced data integrity features compared to MBR.\n","date":"18 August 2025","externalUrl":null,"permalink":"/en/glossary/gpt/","section":"Glossary","summary":"GUID Partition Table (GPT) is a modern standard for the layout of partition tables on physical storage devices like hard drives and SSDs. It’s part of the UEFI (Unified Extensible Firmware Interface) standard and is designed to overcome the limitations of the older MBR (Master Boot Record) scheme. GPT allows for larger disk capacities, more partitions, and enhanced data integrity features compared to MBR.\n","title":"GUID Partition Table","type":"glossary"},{"content":"Unified Extensible Firmware Interface (UEFI) is a modern replacement for the traditional BIOS (Basic Input/Output System) found in computers. It acts as a bridge between the operating system and the computer’s hardware, managing the boot process and providing a standardized interface for both. UEFI offers several advantages over BIOS, including support for larger storage devices, faster boot times, and enhanced security features.\n","date":"18 August 2025","externalUrl":null,"permalink":"/en/glossary/uefi/","section":"Glossary","summary":"Unified Extensible Firmware Interface (UEFI) is a modern replacement for the traditional BIOS (Basic Input/Output System) found in computers. It acts as a bridge between the operating system and the computer’s hardware, managing the boot process and providing a standardized interface for both. UEFI offers several advantages over BIOS, including support for larger storage devices, faster boot times, and enhanced security features.\n","title":"Unified Extensible Firmware Interface","type":"glossary"},{"content":"Read-Modify-Write (RMW) is a term used in storage systems to describe a process where a read operation is performed to retrieve data, followed by a modification of that data, and finally a write operation to store the modified data back.\nThis cycle can lead to inefficiencies, especially in systems like ZFS, where it can cause fragmentation and performance issues.\n","date":"12 August 2025","externalUrl":null,"permalink":"/en/glossary/rmw/","section":"Glossary","summary":"Read-Modify-Write (RMW) is a term used in storage systems to describe a process where a read operation is performed to retrieve data, followed by a modification of that data, and finally a write operation to store the modified data back.\n","title":"Read-Modify-Write","type":"glossary"},{"content":"Long Term Support (LTS) refers to a version of software that is maintained for an extended period, typically several years, with a focus on stability and security.\nLTS releases receive regular updates, including security patches and bug fixes, without introducing new features that could potentially disrupt existing functionality.\n","date":"11 August 2025","externalUrl":null,"permalink":"/en/glossary/lts/","section":"Glossary","summary":"Long Term Support (LTS) refers to a version of software that is maintained for an extended period, typically several years, with a focus on stability and security.\nLTS releases receive regular updates, including security patches and bug fixes, without introducing new features that could potentially disrupt existing functionality.\n","title":"Long Term Support","type":"glossary"},{"content":"Silicon Graphics International (SGI) was a company that specialized in high-performance computing, graphics, and visualization solutions. Founded in 1982, SGI became known for its powerful workstations and servers, which were widely used in industries such as film and animation, scientific research, and engineering.\n","date":"10 August 2025","externalUrl":null,"permalink":"/en/glossary/sgi/","section":"Glossary","summary":"Silicon Graphics International (SGI) was a company that specialized in high-performance computing, graphics, and visualization solutions. Founded in 1982, SGI became known for its powerful workstations and servers, which were widely used in industries such as film and animation, scientific research, and engineering.\n","title":"Silicon Graphics International","type":"glossary"},{"content":"Advanced Vector Extensions (AVX) are a set of instructions for performing single instruction, multiple data (SIMD) operations on floating-point data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/avx/","section":"Glossary","summary":"Advanced Vector Extensions (AVX) are a set of instructions for performing single instruction, multiple data (SIMD) operations on floating-point data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","title":"Advanced Vector Extensions","type":"glossary"},{"content":"Advanced Vector Extensions 2 (AVX2) are an extension of the original AVX instruction set, adding new features and capabilities for performing SIMD operations on integer data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/avx2/","section":"Glossary","summary":"Advanced Vector Extensions 2 (AVX2) are an extension of the original AVX instruction set, adding new features and capabilities for performing SIMD operations on integer data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","title":"Advanced Vector Extensions 2","type":"glossary"},{"content":"Bit Manipulation Instruction Set 1 (BMI1) is a set of instructions for performing bit manipulation operations in a more efficient manner. It is designed to improve performance in applications that require high computational power, such as cryptography, data compression, and error detection.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/bmi1/","section":"Glossary","summary":"Bit Manipulation Instruction Set 1 (BMI1) is a set of instructions for performing bit manipulation operations in a more efficient manner. It is designed to improve performance in applications that require high computational power, such as cryptography, data compression, and error detection.\n","title":"Bit Manipulation Instruction Set 1","type":"glossary"},{"content":"Bit Manipulation Instruction Set 2 (BMI2) includes additional instructions for more complex bit manipulation tasks, such as bit field extraction, population count, and bitwise operations. BMI2 is particularly useful in applications that require high-performance bit manipulation, such as cryptography, data compression, and error detection.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/bmi2/","section":"Glossary","summary":"Bit Manipulation Instruction Set 2 (BMI2) includes additional instructions for more complex bit manipulation tasks, such as bit field extraction, population count, and bitwise operations. BMI2 is particularly useful in applications that require high-performance bit manipulation, such as cryptography, data compression, and error detection.\n","title":"Bit Manipulation Instruction Set 2","type":"glossary"},{"content":"Fused Multiply–Add (FMA) is a floating-point operation that performs multiplication and addition in a single step, which can improve performance and reduce rounding errors in numerical computations. It is particularly useful in high-performance computing applications, such as scientific simulations and machine learning.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/fma/","section":"Glossary","summary":"Fused Multiply–Add (FMA) is a floating-point operation that performs multiplication and addition in a single step, which can improve performance and reduce rounding errors in numerical computations. It is particularly useful in high-performance computing applications, such as scientific simulations and machine learning.\n","title":"Fused Multiply–Add","type":"glossary"},{"content":"Streaming SIMD Extensions 4.2 (SSE4.2) are an extension of the original SSE instruction set, adding new features and capabilities for performing SIMD operations on both integer and floating-point data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","date":"6 August 2025","externalUrl":null,"permalink":"/en/glossary/sse42/","section":"Glossary","summary":"Streaming SIMD Extensions 4.2 (SSE4.2) are an extension of the original SSE instruction set, adding new features and capabilities for performing SIMD operations on both integer and floating-point data. They are designed to improve performance in applications that require high computational power, such as scientific simulations, financial modeling, and machine learning.\n","title":"Streaming SIMD Extensions 4.2","type":"glossary"},{"content":"The Basic Input/Output System (BIOS) is firmware that initializes and tests hardware components during the booting process of a computer. It is the first software that runs when a computer is powered on, and it is responsible for loading the operating system from a storage device into the computer’s memory.\n","date":"3 August 2025","externalUrl":null,"permalink":"/en/glossary/bios/","section":"Glossary","summary":"The Basic Input/Output System (BIOS) is firmware that initializes and tests hardware components during the booting process of a computer. It is the first software that runs when a computer is powered on, and it is responsible for loading the operating system from a storage device into the computer’s memory.\n","title":"Basic Input/Output System","type":"glossary"},{"content":"This article explains how to create a Cloud-Init based template to be cloned when creating new VMs in our Proxmox cluster. Proxmox offers native mechanisms to create templates from existing VMs, to be later reused, but making them Cloud-Init enabled goes a long way towards automation. Moreover, Ansible will help us wrap it up nicely.\nCloud images # Cloud images are lightweight snapshots of a configured OS created for use with cloud infrastructure (e.g., VPS, VM). They provide a way to repeatably create identical copies of a machine across platforms.\nDebian provides official cloud images of its operating system, packaged into a format suitable for cloud platforms (e.g., qcow2, raw), which include tools like Cloud-Init to facilitate automated configuration and customization upon startup.\nCloud images are not meant for direct installation on physical hardware.\nCloud-Init # Cloud-Init is the industry standard method for cloud instance initialization. During boot, it identifies the cloud it is running on and initializes the system accordingly. Configuration instructions can be reused and always get consistent, reliable results.\nCloud-Init can handle a range of tasks that normally happen when a new instance is created. It is responsible for activities like setting the hostname and the default locale, configuring network interfaces, creating user accounts, generating SSH skeys, and even running scripts. This streamlines the deployment process, as cloud instances will all be automatically configured in the same way, which reduces the chance to introduce human error.\nThe operation takes place in two separate phases. The first phase is during the early (local) boot stage, before networking has been enabled. The second is during the late boot stages, after Cloud-Init has applied the networking configuration.\nDuring early boot, Cloud-Init discovers the datasource, obtains all the configuration data from it, and configures networking.\nDuring late boot, Cloud-Init runs through the tasks that were not critical for provisioning. This is where it configures the running instance according to your needs. This process can be done by interacting with Ansible.\nISO download # We will be using the genericcloud version of the image in qcow2 (QEMU Copy On Write) format.\nBecause the Download from URL button in the ISO Images menu option of our node only allows us to download images in ISO format, we will use the terminal to perform this operation.\nWe will be using the Debian 13 Trixie cloud image and SHA 512 sum.\nOn your first node, e.g., proxmox1, download the image:\nmkdir --parents /var/lib/vz/template/cloud wget https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-amd64.qcow2 \\ --output-document=/var/lib/vz/template/cloud/debian-13-genericcloud-amd64.qcow2 For security, calculate its SHA 512 checksum and compare it with the one from the SHA512SUMS file:\nsha512sum /var/lib/vz/template/cloud/debian-13-genericcloud-amd64.qcow2 wget --quiet https://cloud.debian.org/images/cloud/trixie/latest/SHA512SUMS -O- \\ | grep debian-13-genericcloud-amd64.qcow2 Optionally, copy the qcow2 image to the rest of nodes (adapt to your cluster):\nNUM_NODES=$(pvecm nodes | grep -cE \u0026#39;^\\s+[0-9]+\\s+[0-9]+\\s+proxmox[0-9]+\u0026#39;) SRC_FILE=\u0026#34;/var/lib/vz/template/cloud/debian-13-genericcloud-amd64.qcow2\u0026#34; for i in `seq 2 ${NUM_NODES}` do echo \u0026#34;Copying `basename ${SRC_FILE}` to proxmox${i}\u0026#34; rsync --rsh=ssh ${SRC_FILE} proxmox${i}:/var/lib/vz/template/cloud/ done For Debian 12 and 11, the process is similar, but you will have to download different images:\nDebian 12 Bookworm cloud image and SHA 512 sum. Debian 11 Bullseye cloud image and SHA 512 sum. Templating # We need to create a virtual machine, then turn it into a template. The Proxmox assistant will not let us create a VM without an image, and it only accepts ISO images. Therefore, we will resort to the terminal.\nAs an example, we will create a VM with id 9000 for Debian 12. You may want to use successive ids for other versions of Debian, and adapt the commands accordingly.\nJust in case it has not been done before, create the resource pool of your liking:\npvesh create /pools --poolid templates --comment \u0026#34;Templates for VMs\u0026#34; First of all, create an empty virtual machine:\nqm create 9000 --name \u0026#34;debian-12-tmpl\u0026#34; --cores 2 --cpu host \\ --balloon 1024 --memory 2048 --onboot 0 \\ --net0 virtio,bridge=vmbr4002,firewall=1,mtu=1400 \\ --scsihw virtio-scsi-single \\ --ostype l26 --bios seabios \\ --agent enabled=1,fstrim_cloned_disks=1,type=virtio \\ --pool templates --description \u0026#34;Debian 12 Bookworm cloud template\u0026#34; Using processor type host exposes modern CPU features such as AVX, AVX2, SSE4.2, BMI1/BMI2, and FMA. We trade better performance and compatibility with modern software for less portability, i.e., VM live migration between nodes may fail when using very different CPU architectures.\nOptionally, add tags to the VM to help identify it later:\nqm set 9000 --tags debian12,local Choosing a very big VM ID is not mandatory, but rather a quick way to identify VM templates in our cluster.\nNext, import the cloud image as a disk:\nqm disk import 9000 --format qcow2 \\ /var/lib/vz/template/cloud/debian-12-genericcloud-amd64.qcow2 local In Proxmox, raw and qcow2 are common disk image formats, each with distinct advantages and disadvantages. The former offers potentially better performance due to its simplicity, while the latter provides features like snapshots, compression, and dynamic resizing, albeit with a slight performance overhead. The choice depends on specific needs and the underlying storage type1.\nNext, attach the disk to the VM:\nqm set 9000 --scsi0 local:9000/vm-9000-disk-0.qcow2,format=qcow2,iothread=1,discard=on,serial=os Using virtio-scsi-single type of virtual SCSI controller and the serial attribute helps ensure a consistent and unique identifier for the disk (such as /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os), which can then be safely used in Ansible playbooks and configuration files.\nIf you consistently use virtio-scsi-single and always set a unique serial for each disk, the /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_\u0026lt;serial\u0026gt; symlink will be stable across reboots and clones, regardless of device order. However, changing controller type, omitting/changing the serial, or upgrading to a Proxmox/QEMU version that alters disk presentation could result in a different symlink.\nThe next step is to configure a CD-ROM drive, which will be used to pass the Cloud-Init data to the VM:\nqm set 9000 --ide2 local:cloudinit --cdrom is an alias for --ide2. Using --ide2 sets media=cdrom.\nTo be able to boot directly from the Cloud-Init image, we need to set the boot parameter to order=scsi0 to restrict the BIOS to boot from this disk only. This will speed up booting, because it skips the testing for a bootable CD-ROM.\nqm set 9000 --boot order=scsi0 For many Cloud-Init images, it is required to configure a serial console and use it as a display. However, if the configuration does not work for a given image, switch back to the default display instead.\nqm set 9000 --serial0 socket --vga serial0 Now is the time to visit the Cloud-Init menu option of our newly-created, not-yet-started VM with ID 9000, and configure the following options with some default values (adapt to your needs):\nUser: ansible Password: \u0026lt;password\u0026gt; DNS domain: localdomain.com DNS servers: 192.168.0.2 192.168.0.3 SSH public key: ssh-ed25519 AAAAC3N [..] Ansible IP Config (net0): DHCP Use a randomnly generated password for your ansible user, then save it in a vault, such as Proton Pass or Vaultwarden. Also add it to the Ansible vault, so it can be used later to provision the VM.\nOnce you are finished, do not forget to use the Regenerate image button to update the CD-ROM containing the Cloud-Init configuration. Or you can use the following command from the terminal:\nqm cloudinit update 9000 In order to keep our template small and simple, we will use just once disk. Later on we will add a second disk to it, to be used as swap. Thus, this is a summary of the disk our template will have:\nOption OS disk Notes Bus/Device SCSI 0 VirtIO SCSI driver works well with discard Storage local Disk size (GiB) 3 Format qcow2 QCOW 2 supports snapshots Cache No cache IO thread Yes Enable parallel access Backup Yes Include disk in backup jobs Async IO io_uring Most compatible and reliable Discard Yes Enable TRIM/UNMAP We are now ready to convert the VM into a template. From this template we will be able to quickly create clones. Either right-click on the VM and choose the Convert to template option, or use the terminal:\nqm template 9000 Templating a VM is a one-way ticket. The VM is converted, not duplicated into a template.\nBy not starting the VM before converting it into a template, we are preventing the Debian bootstrap process from executing. For your reference, bootstrapping means setting up:\nMachine id, stored in /etc/machine-id, which is used by D-Bus and systemd for various purposes, including identifying the system. Disk UUID, used in /etc/fstab, which allows for reliable mounting even if device names change. SSH host keys, stored in /etc/ssh/ssh_host_*, which are used for secure remote access to the system. Ansible # In the previous section, we neither configured the VM’s Cloud-Init options, nor did we install basic shell tools and utilities.\nThis choice is intentional, as we want to keep our template as clean as possible so that we do not have to undo or correct anything in the future, and because we will be using Ansible to provision and configure it.\nTo provision VMs from our template, including setting up Cloud-Init configurations, we will use the Ansible Proxmox KVM module, which you will have to install manually:\nansible-galaxy collection install community.proxmox Provisioning # The process of provisioning a virtual machine from a template follows these steps:\nClone the virtual machine from the template. Configure Cloud-Init options. Start the virtual machine. Optionally, customise the virtual machine. To keep it simple, a lot of variables are hardcoded in the following example, but you can easily adapt it to your needs. For context, the following code would exist in the following Ansible structure:\nInventory file at inventory/myapp.yml. Variables for all groups at inventory/group_vars/all/vars.yml. Playbook templates at plays/templates/provision/. Playbook tasks at plays/tasks/provision/. Playbook at plays/provision.yml. # inventory/myapp.yml myapp: hosts: myapp1.localdomain.com: ansible_host: 192.168.0.21 proxmox_vmid: 121 vm_template: \u0026#34;debian12-tmpl\u0026#34; # inventory/group_vars/all/vars.yml proxmox_api_user: \u0026#34;{{ vault_proxmox_api_user | default(\u0026#39;root@pam\u0026#39;) }}\u0026#34; proxmox_api_token_id: \u0026#34;{{ vault_proxmox_api_token_id }}\u0026#34; proxmox_api_token_secret: \u0026#34;{{ vault_proxmox_api_token_secret }}\u0026#34; proxmox_ci_password: \u0026#34;{{ vault_proxmox_ci_password }}\u0026#34; # plays/tasks/provision/clone.yml - name: Check if the virtual machine already exists register: vm_status failed_when: false # Do not fail when the VM does not exist delegate_to: localhost community.general.proxmox_kvm: # API api_host: \u0026#34;proxmox1.localdomain.com\u0026#34; api_user: \u0026#34;{{ proxmox_api_user }}\u0026#34; api_token_id: \u0026#34;{{ proxmox_api_token_id }}\u0026#34; api_token_secret: \u0026#34;{{ proxmox_api_token_secret }}\u0026#34; # VM. Use `vmid` to checking status. vmid: \u0026#34;{{ proxmox_vmid }}\u0026#34; node: \u0026#34;proxmox1\u0026#34; state: current - name: Clone the virtual machine from the template when: vm_status.status is not defined or vm_status.status == \u0026#34;absent\u0026#34; delegate_to: localhost community.general.proxmox_kvm: state: present # API api_host: \u0026#34;proxmox1.localdomain.com\u0026#34; api_user: \u0026#34;{{ proxmox_api_user }}\u0026#34; api_token_id: \u0026#34;{{ proxmox_api_token_id }}\u0026#34; api_token_secret: \u0026#34;{{ proxmox_api_token_secret }}\u0026#34; # VM. Use `newid` when cloning. newid: \u0026#34;{{ proxmox_vmid }}\u0026#34; node: \u0026#34;proxmox1\u0026#34; name: \u0026#34;{{ inventory_hostname_short }}\u0026#34; # Cloning storage: \u0026#34;local\u0026#34; format: \u0026#34;qcow2\u0026#34; clone: \u0026#34;{{ vm_template }}\u0026#34; full: true description: \u0026#34;Cloned from {{ vm_template }}\u0026#34; - name: Update the virtual machine Cloud-Init configuration delegate_to: localhost community.general.proxmox_kvm: update: true # API api_host: \u0026#34;{{ proxmox_api_host }}\u0026#34; api_user: \u0026#34;{{ proxmox_api_user }}\u0026#34; api_token_id: \u0026#34;{{ proxmox_api_token_id }}\u0026#34; api_token_secret: \u0026#34;{{ proxmox_api_token_secret }}\u0026#34; # VM. Use `vmid` when updating. vmid: \u0026#34;{{ proxmox_vmid }}\u0026#34; node: \u0026#34;{{ proxmox_node }}\u0026#34; cores: \u0026#34;4\u0026#34; memory: \u0026#34;8192\u0026#34; balloon: \u0026#34;4096\u0026#34; # Cloud-Init credentials ciuser: \u0026#34;ansible\u0026#34; cipassword: \u0026#34;{{ proxmox_ci_password }}\u0026#34; sshkeys: \u0026#34;{{ lookup(\u0026#39;ansible.builtin.file\u0026#39;, \u0026#39;~/.ssh/ansible.pub\u0026#39;) }}\u0026#34; # Cloud-Init network ipconfig: ipconfig0: \u0026#34;ip={{ ansible_host }}/16\u0026#34; nameservers: - \u0026#34;192.168.0.4\u0026#34; - \u0026#34;192.168.0.5\u0026#34; searchdomains: \u0026#34;localdomain.com\u0026#34; # plays/tasks/provision/start.yml - name: Start virtual machine delegate_to: localhost community.general.proxmox_kvm: state: started timeout: 10 # API api_host: \u0026#34;proxmox1.localdomain.com\u0026#34; api_user: \u0026#34;{{ proxmox_api_user }}\u0026#34; api_token_id: \u0026#34;{{ proxmox_api_token_id }}\u0026#34; api_token_secret: \u0026#34;{{ proxmox_api_token_secret }}\u0026#34; node: \u0026#34;proxmox1\u0026#34; vmid: \u0026#34;{{ proxmox_vmid }}\u0026#34; - name: Wait for the virtual machine to be accessible ansible.builtin.wait_for: host: \u0026#34;{{ ansible_host }}\u0026#34; port: 22 timeout: 300 Debian 11 # When provisioning a virtual machine from the Debian 11 template, you will notice that the bootstrap process takes a long time. This is because the Debian 11 cloud image includes an ifupdown configuration that attempts a DHCP request on the interface (commonly ens18), whatever the network configuration in the Cloud-Init menu option you set up before converting the VM into a template.\nIf there is no DHCP server available, the interface hangs for a minute until the timeout occurs, which can be observed in the console as a “A start job is running for Raise network interfaces…” message.\nThe only effective fix is to modify the /etc/network/interfaces.d/ens18 inside the image to set:\nauto ens18 iface ens18 inet manual Unfortunately, we cannot apply this fix because our template has not been bootstrapped yet. Any attempts at instructing Cloud-Init to execute a custom snippet before configuring the network via the cicustom attribute of the proxmox_kvm module will not be successful due to the order of preference when the bootstrap process occurs.\nFor your reference, the proxmox_kvm Ansible module includes the cicustom attribute, which is a mechanism to override any of the Cloud-Init drives (user, network, or meta) with a file stored in /var/lib/vz/snippets/ on the node.\nIn our case, the only solution is to set up a DHCP server and match it with the inventory in Ansible. This is outside the scope of this article and series, though.\nSwap disk # When marked as such, via the proxmox_swap attribute in our inventory, we can provision a second disk to the VM, to be used as swap. Again, many variables are hardcoded in the following example, but you can easily adapt it to your needs.\n# inventory/myapp.yml myapp: hosts: myapp1.localdomain.com: ansible_host: 192.168.0.21 proxmox_vmid: 121 proxmox_swap: 1 # GB # plays/tasks/provision/swap.yml - name: Create and attach swap disk to VM when: proxmox_swap | default(0) delegate_to: localhost community.proxmox.proxmox_kvm: update: true update_unsafe: true # Allow updating `scsi` # API api_host: \u0026#34;{{ proxmox_api_host }}\u0026#34; api_user: \u0026#34;{{ proxmox_api_user }}\u0026#34; api_token_id: \u0026#34;{{ proxmox_api_token_id }}\u0026#34; api_token_secret: \u0026#34;{{ proxmox_api_token_secret }}\u0026#34; # VM vmid: \u0026#34;{{ proxmox_vmid }}\u0026#34; node: \u0026#34;{{ proxmox_node }}\u0026#34; scsi: scsi1: \u0026#34;local:{{ proxmox_swap }},format=raw,discard=on,backup=0,serial=swap\u0026#34; This is a summary of the disk we are adding to our VM:\nOption Swap disk Notes Bus/Device SCSI 1 VirtIO SCSI driver works well with discard Storage local Disk size (GiB) 1 Format raw Prefer speed to snapshot support Cache No cache IO thread No Enable parallel access Backup No No need to back up this disk Async IO io_uring Most compatible and reliable Discard Yes Enable TRIM/UNMAP Once the disk has been attached, we need to format it as swap and enable it. To keep things as simple as possible, we will make use of the serial parametrer of the disk, which is set to swap, to identify it in the /dev/disk/by-id directory. Because this path will always point to the correct device, we can use it in our playbook without worrying about the actual device name or its UUID.\n# plays/tasks/provision/swap.yml - name: Wait for swap disk to appear register: wait_for_swap_disk ansible.builtin.wait_for: path: \u0026#34;/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_swap\u0026#34; state: present timeout: 30 - name: Configure swap disk in VM when: - not wait_for_swap_disk.failed - wait_for_swap_disk.state == \u0026#39;link\u0026#39; block: - name: Create swap filesystem on disk community.general.filesystem: fstype: swap dev: \u0026#34;/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_swap\u0026#34; - name: Add swap entry to \u0026#39;/etc/fstab\u0026#39; ansible.posix.mount: src: \u0026#34;/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_swap\u0026#34; path: none fstype: swap opts: sw state: present - name: Activate swap partition ansible.builtin.command: cmd: \u0026#34;swapon --all --verbose\u0026#34; register: swapon_result failed_when: false changed_when: - swapon_result.rc != 0 - \u0026#34;\u0026#39;already active\u0026#39; not in swapon_result.stdout\u0026#34; Resizing the OS disk # The cloud images of Debian 11 Bullseye and Debian 12 Bookworm we installed on the SCSI-0 disk present the following partition layout:\n# fdisk -l /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os Device Start End Sectors Size Type /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os-part1 262144 6289407 6027264 2.9G Linux root (x86-64) /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os-part14 2048 8191 6144 3M BIOS boot /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os-part15 8192 262143 253952 124M EFI System The partition table was created using GPT and 512-byte sector size (physical and logical).\nTaking into consideration that partition table entries are not in disk order, by checking the start and end sectors we can figure out that there are three partitions, in the following order from closest to the start of the disk to the end:\nBIOS boot partition2 (3 MiB) EFI System partition3 (124 MiB) Linux root partition (2.9 GiB) Therefore, to extend the size of our OS disk (a virtual disk using QCOW2 format), we need to follow these steps:\nResize the virtual disk using the Proxmox CLI (or GUI, if you prefer). Grow the partition. Resize the filesystem inside the VM. Use the terminal of the host to execute the following command (adapt the value to your needs):\nqm resize 121 scsi0 +1G If you check the kernel messages using dmesg, you will notice the following messages (numbers will vary depending on your previous size and how much space you added):\nsd 2:0:0:0: Capacity data has changed sd 2:0:0:0: [sda] 12582912 512-byte logical blocks: (6.44 GB/6.00 GiB) sd 2:0:0:0 sda: detected capacity change from 5368709120 to 6442450944 If you now log into the VM via SSH, you can use lsblk to realise that the new disk size has already been caught up by the kernel. However, the /dev/sda1 partition still shows the old size:\n# lsblk /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 6G 0 disk ├─sda1 8:1 0 4.9G 0 part / ├─sda14 8:14 0 3M 0 part └─sda15 8:15 0 124M 0 part /boot/efi At this point, use growpart in the console to resize the partition:\ngrowpart /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os 1 We can now see the changes in the partition using lsblk:\n# lsblk /dev/sda NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 6G 0 disk ├─sda1 8:1 0 5.9G 0 part / ├─sda14 8:14 0 3M 0 part └─sda15 8:15 0 124M 0 part /boot/efi In Debian, the growpart command is part of the cloud-guest-utils package, which is pre-installed on cloud images.\nHowever, the filesystem still shows the previous value:\n# df -h / Filesystem Size Used Avail Use% Mounted on /dev/sda1 4.8G 1.8G 2.8G 40% / Therefore, all that is left is to use the EXT4 resizer to resize the filesystem:\nresize2fs /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_os-part1 And verify the results:\n# df -h / Filesystem Size Used Avail Use% Mounted on /dev/sda1 5.8G 1.8G 3.7G 33% / The Proxmox storage documentation explains how /var/lib/vz maps to the local storage type. ↩︎\nA BIOS boot partition is used when booting a computer with a traditional BIOS and a GPT disk. This partition stores the second stage of the GRUB bootloader, allowing the system to locate and load the operating system. ↩︎\nThe EFI System Partition is a special partition that stores boot loaders and other files necessary for the UEFI firmware to start an operating system. ↩︎\n","date":"3 August 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/cloud-init/","section":"Posts","summary":"Provisioning Debian VMs on Proxmox using cloud-init, cloud images and Ansible","title":"Provisioning VMs on Proxmox using Cloud-Init and Ansible","type":"posts"},{"content":"A Virtual Private Server (VPS) is a virtualised server environment created on a physical server, offering dedicated resources and greater control than shared hosting, but at a lower cost than a dedicated server. It is a popular choice for those needing more resources and control than shared hosting, but not requiring the full resources of a dedicated server\n","date":"28 July 2025","externalUrl":null,"permalink":"/en/glossary/vps/","section":"Glossary","summary":"A Virtual Private Server (VPS) is a virtualised server environment created on a physical server, offering dedicated resources and greater control than shared hosting, but at a lower cost than a dedicated server. It is a popular choice for those needing more resources and control than shared hosting, but not requiring the full resources of a dedicated server\n","title":"Virtual Private Server","type":"glossary"},{"content":"Copy On Write (COW) is an optimization strategy used in computer programming and file systems to efficiently manage memory and storage. The basic idea behind COW is to delay the copying of data until it is absolutely necessary, which can help reduce overhead and improve performance.\n","date":"27 July 2025","externalUrl":null,"permalink":"/en/glossary/cow/","section":"Glossary","summary":"Copy On Write (COW) is an optimization strategy used in computer programming and file systems to efficiently manage memory and storage. The basic idea behind COW is to delay the copying of data until it is absolutely necessary, which can help reduce overhead and improve performance.\n","title":"Copy On Write","type":"glossary"},{"content":"A Separate LOG (SLOG) is a dedicated device or partition used in ZFS to improve the performance of synchronous writes. By offloading these writes to a faster storage medium, such as an SSD, the SLOG can help reduce latency and increase overall system responsiveness.\n","date":"27 July 2025","externalUrl":null,"permalink":"/en/glossary/slog/","section":"Glossary","summary":"A Separate LOG (SLOG) is a dedicated device or partition used in ZFS to improve the performance of synchronous writes. By offloading these writes to a faster storage medium, such as an SSD, the SLOG can help reduce latency and increase overall system responsiveness.\n","title":"Separate LOG","type":"glossary"},{"content":"Fourth Extended Filesystem (EXT4) is a widely used journaling file system for Linux. It is the successor to EXT3 and it is the default file system for many Linux distributions and is known for its stability and performance.\nKey features include journaling, support for large files and volumes, extents for efficient file management, delayed allocation for improved performance, backward compatibility with EXT3 and EXT2 file systems and online defragmentation capabilities.\n","date":"4 July 2025","externalUrl":null,"permalink":"/en/glossary/ext4/","section":"Glossary","summary":"Fourth Extended Filesystem (EXT4) is a widely used journaling file system for Linux. It is the successor to EXT3 and it is the default file system for many Linux distributions and is known for its stability and performance.\n","title":"Fourth Extended Filesystem","type":"glossary"},{"content":"Network File System (NFS) is a distributed file system protocol that allows clients to access files over a network as if they were local. It is commonly used for sharing files between servers and clients in a networked environment.\n","date":"4 July 2025","externalUrl":null,"permalink":"/en/glossary/nfs/","section":"Glossary","summary":"Network File System (NFS) is a distributed file system protocol that allows clients to access files over a network as if they were local. It is commonly used for sharing files between servers and clients in a networked environment.\n","title":"Network File System","type":"glossary"},{"content":"Simple Storage Service (S3) is an object storage service, originally provided by Amazon Web Services (AWS), that allows users to store and retrieve data from anywhere on the web. Nowadays, many cloud providers offer S3-compatible object storage services.\n","date":"4 July 2025","externalUrl":null,"permalink":"/en/glossary/s3/","section":"Glossary","summary":"Simple Storage Service (S3) is an object storage service, originally provided by Amazon Web Services (AWS), that allows users to store and retrieve data from anywhere on the web. Nowadays, many cloud providers offer S3-compatible object storage services.\n","title":"Simple Storage Service","type":"glossary"},{"content":"X File System (XFS) is a high-performance journaling file system designed for scalability and efficiency, primarily used in enterprise environments. It was originally developed by Silicon Graphics, Inc. (SGI) and is now widely adopted in Linux systems.\n","date":"4 July 2025","externalUrl":null,"permalink":"/en/glossary/xfs/","section":"Glossary","summary":"X File System (XFS) is a high-performance journaling file system designed for scalability and efficiency, primarily used in enterprise environments. It was originally developed by Silicon Graphics, Inc. (SGI) and is now widely adopted in Linux systems.\n","title":"X File System","type":"glossary"},{"content":"A time series database (TSDB) is a database optimized for time-stamped or time series data. Time series data are simply measurements or events that are tracked, monitored, downsampled, and aggregated over time.\n","date":"25 May 2025","externalUrl":null,"permalink":"/en/glossary/tsdb/","section":"Glossary","summary":"A time series database (TSDB) is a database optimized for time-stamped or time series data. Time series data are simply measurements or events that are tracked, monitored, downsampled, and aggregated over time.\n","title":"Time Series Database","type":"glossary"},{"content":"YAML (originally said to mean Yet Another Markup Language, was repurposed as YAML Ain’t Markup Language, a recursive acronym) is a human-readable data serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted.\n","date":"13 April 2025","externalUrl":null,"permalink":"/en/glossary/yaml/","section":"Glossary","summary":"YAML (originally said to mean Yet Another Markup Language, was repurposed as YAML Ain’t Markup Language, a recursive acronym) is a human-readable data serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted.\n","title":"YAML Ain't Markup Language","type":"glossary"},{"content":"The Log Query Language (LogQL) is the main way to query and manipulate log data within Loki. It allows you to filter, aggregate, and analyze log streams, akin to a distributed grep.\n","date":"8 April 2025","externalUrl":null,"permalink":"/en/glossary/logql/","section":"Glossary","summary":"The Log Query Language (LogQL) is the main way to query and manipulate log data within Loki. It allows you to filter, aggregate, and analyze log streams, akin to a distributed grep.\n","title":"Log Query Language","type":"glossary"},{"content":"The Prometheus Query Language (PromQL) is the main way to query metrics within Prometheus. It is a nested functional language, where data appears as nested expressions within larger expressions. The outermost expression defines the final value, while nested expressions represent values for arguments and operands.\n","date":"8 April 2025","externalUrl":null,"permalink":"/en/glossary/promql/","section":"Glossary","summary":"The Prometheus Query Language (PromQL) is the main way to query metrics within Prometheus. It is a nested functional language, where data appears as nested expressions within larger expressions. The outermost expression defines the final value, while nested expressions represent values for arguments and operands.\n","title":"Prometheus Query Language","type":"glossary"},{"content":"A Write-Ahead Log (WAL) is a standard method for ensuring data integrity. Its central concept is that changes to data files must be written only after those changes have been logged, that is, after WAL records describing the changes have been flushed to permanent storage.\n","date":"24 March 2025","externalUrl":null,"permalink":"/en/glossary/wal/","section":"Glossary","summary":"A Write-Ahead Log (WAL) is a standard method for ensuring data integrity. Its central concept is that changes to data files must be written only after those changes have been logged, that is, after WAL records describing the changes have been flushed to permanent storage.\n","title":"Write-Ahead Log","type":"glossary"},{"content":"Artificial intelligence (AI) is a field of science concerned with building computers and machines that can reason, learn, and act in such a way that would normally require human intelligence or that involves data whose scale exceeds what humans can analyze.\n","date":"23 February 2025","externalUrl":null,"permalink":"/en/glossary/ai/","section":"Glossary","summary":"Artificial intelligence (AI) is a field of science concerned with building computers and machines that can reason, learn, and act in such a way that would normally require human intelligence or that involves data whose scale exceeds what humans can analyze.\n","title":"Artificial Intelligence","type":"glossary"},{"content":"A chief technology officer (CTO) is an officer tasked with managing technical operations of an organization. They oversee and supervise research and development and serve as a technical advisor to a higher executive such as a chief executive officer. It is very similar to a chief information officer.\n","date":"23 February 2025","externalUrl":null,"permalink":"/en/glossary/cto/","section":"Glossary","summary":"A chief technology officer (CTO) is an officer tasked with managing technical operations of an organization. They oversee and supervise research and development and serve as a technical advisor to a higher executive such as a chief executive officer. It is very similar to a chief information officer.\n","title":"Chief Technology Officer","type":"glossary"},{"content":"Domain-driven design (DDD) is a major software design approach that focuses on modeling software to match a domain according to input from that domain’s experts. It is against the idea of having a single unified model; instead it divides a large system into bounded contexts, each of which have their own model.\nDomain-driven design is predicated on the following goals:\nPlacing the project’s primary focus on the core domain and domain logic layer; P*asing complex designs on a model of the domain; Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems. ","date":"22 February 2025","externalUrl":null,"permalink":"/en/glossary/ddd/","section":"Glossary","summary":"Domain-driven design (DDD) is a major software design approach that focuses on modeling software to match a domain according to input from that domain’s experts. It is against the idea of having a single unified model; instead it divides a large system into bounded contexts, each of which have their own model.\n","title":"Domain Driven Design","type":"glossary"},{"content":"Test-Driven Development (TDD) is a technique for building software that guides software development by writing tests. It was developed by Kent Beck in the late 1990’s as part of Extreme Programming. In essence we follow three simple steps repeatedly:\nWrite a test for the next bit of functionality you want to add. Write the functional code until the test passes. Refactor both new and old code to make it well structured. ","date":"22 February 2025","externalUrl":null,"permalink":"/en/glossary/tdd/","section":"Glossary","summary":"Test-Driven Development (TDD) is a technique for building software that guides software development by writing tests. It was developed by Kent Beck in the late 1990’s as part of Extreme Programming. In essence we follow three simple steps repeatedly:\n","title":"Test Driven Development","type":"glossary"},{"content":"The vertical slice architecture (VSA) is an architectural pattern used in software development that structures the codebase of an application by creating complete end-to-end slices of functionality, which span across all layers of the application.\nRather than structuring codebase by layer, the vertical slice architecture structures the codebase around a single feature, including all the necessary code components such as UI, domain, infrastructure, and application layers.\n","date":"22 February 2025","externalUrl":null,"permalink":"/en/glossary/vsa/","section":"Glossary","summary":"The vertical slice architecture (VSA) is an architectural pattern used in software development that structures the codebase of an application by creating complete end-to-end slices of functionality, which span across all layers of the application.\n","title":"Vertical Slice Architecture","type":"glossary"},{"content":"Voice over Internet Protocol (VoIP), also known as IP telephony, refers to a set of technologies used for voice communication sessions over Internet Protocol networks, such as the Internet.\nMoreover, it is a communications technology that enables you to make phone calls using your broadband connection instead of landline service.\nA typical setup involves a router for the internet with a handset connected. The handset or business phone system uses the internet to transmit your speech like a physical landline would. The only difference is that the underlying technology is not a landline but the Internet.\n","date":"22 February 2025","externalUrl":null,"permalink":"/en/glossary/voip/","section":"Glossary","summary":"Voice over Internet Protocol (VoIP), also known as IP telephony, refers to a set of technologies used for voice communication sessions over Internet Protocol networks, such as the Internet.\nMoreover, it is a communications technology that enables you to make phone calls using your broadband connection instead of landline service.\n","title":"Voice over Internet Protocol","type":"glossary"},{"content":"Site reliability engineering (SRE) is a practice that focuses on improving and maintaining the reliability of a software system. It utilizes software tools and automated tasks like application monitoring and reliability tasks to accomplish that.\n","date":"11 February 2025","externalUrl":null,"permalink":"/en/glossary/sre/","section":"Glossary","summary":"Site reliability engineering (SRE) is a practice that focuses on improving and maintaining the reliability of a software system. It utilizes software tools and automated tasks like application monitoring and reliability tasks to accomplish that.\n","title":"Site Reliability Engineering","type":"glossary"},{"content":"Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.\n","date":"10 February 2025","externalUrl":null,"permalink":"/en/glossary/http/","section":"Glossary","summary":"Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.\n","title":"Hypertext Transfer Protocol","type":"glossary"},{"content":"The Internet Group Management Protocol (IGMP) is the protocol that enables multicast communication by allowing devices to join and leave multicast groups. Instead of sending the same data to each node individually (unicast), multicast allows the data to be sent once and received by all nodes that have joined the relevant multicast group.\nThis multicast communication, facilitated by IGMP, is crucial for clusters to maintain quorum (ensuring a majority of nodes are available) and for other cluster-related tasks. For IGMP and multicast to work correctly in a cluster, the physical switches in the network need to be multicast-aware and IGMP snooping capable.\n","date":"10 February 2025","externalUrl":null,"permalink":"/en/glossary/igmp/","section":"Glossary","summary":"The Internet Group Management Protocol (IGMP) is the protocol that enables multicast communication by allowing devices to join and leave multicast groups. Instead of sending the same data to each node individually (unicast), multicast allows the data to be sent once and received by all nodes that have joined the relevant multicast group.\n","title":"Internet Group Management Protocol","type":"glossary"},{"content":"Internet Small Computer Systems Interface (iSCSI) is an Internet Protocol-based storage networking standard for linking data storage facilities. iSCSI provides block-level access to storage devices by carrying SCSI commands over a TCP/IP network.\n","date":"10 February 2025","externalUrl":null,"permalink":"/en/glossary/iscsi/","section":"Glossary","summary":"Internet Small Computer Systems Interface (iSCSI) is an Internet Protocol-based storage networking standard for linking data storage facilities. iSCSI provides block-level access to storage devices by carrying SCSI commands over a TCP/IP network.\n","title":"Internet Small Computer Systems Interface","type":"glossary"},{"content":"The Lightweight Directory Access Protocol (LDAP) is an open, vendor-neutral, industry standard application protocol for accessing and maintaining distributed directory information services over an Internet Protocol network.\n","date":"10 February 2025","externalUrl":null,"permalink":"/en/glossary/ldap/","section":"Glossary","summary":"The Lightweight Directory Access Protocol (LDAP) is an open, vendor-neutral, industry standard application protocol for accessing and maintaining distributed directory information services over an Internet Protocol network.\n","title":"Lightweight Directory Access Protocol","type":"glossary"},{"content":"Zettabyte File System (ZFS) is an advanced file system and volume manager which was originally developed for Solaris and is now maintained by the OpenZFS community.\n","date":"10 February 2025","externalUrl":null,"permalink":"/en/glossary/zfs/","section":"Glossary","summary":"Zettabyte File System (ZFS) is an advanced file system and volume manager which was originally developed for Solaris and is now maintained by the OpenZFS community.\n","title":"Zettabyte File System","type":"glossary"},{"content":"Kernel-based Virtual Machine (KVM) is a virtualisation technology for Linux operating systems, which allows it to function as a hypervisor that runs multiple, isolated virtual machines (VM).\n","date":"4 February 2025","externalUrl":null,"permalink":"/en/glossary/kvm/","section":"Glossary","summary":"Kernel-based Virtual Machine (KVM) is a virtualisation technology for Linux operating systems, which allows it to function as a hypervisor that runs multiple, isolated virtual machines (VM).\n","title":"Kernel-based Virtual Machine","type":"glossary"},{"content":"The ZFS 2nd Level Adaptive Replacement Cache (L2ARC) is an SSD based cache that is accessed before reading from the much slower pool disks.\nWhen a system gets read requests, ZFS uses ARC (RAM) to serve those requests. When the ARC is full and there are L2ARC drives allocated to a ZFS pool, ZFS uses the L2ARC to serve the read requests that overflowed from the ARC. This reduces the use of slower hard drives and therefore increases system performance.\nThe L2ARC is currently intended for random read workloads.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/l2arc/","section":"Glossary","summary":"The ZFS 2nd Level Adaptive Replacement Cache (L2ARC) is an SSD based cache that is accessed before reading from the much slower pool disks.\nWhen a system gets read requests, ZFS uses ARC (RAM) to serve those requests. When the ARC is full and there are L2ARC drives allocated to a ZFS pool, ZFS uses the L2ARC to serve the read requests that overflowed from the ARC. This reduces the use of slower hard drives and therefore increases system performance.\n","title":"2nd Level Adaptive Replacement Cache","type":"glossary"},{"content":"The ZFS Adaptive Replacement Cache (ARC) is a memory-based caching system that enhances read performance by storing frequently accessed data and metadata in RAM.\nIt prioritises recently and frequently used information to optimise data access, and it can dynamically adjust its size to accommodate system needs.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/arc/","section":"Glossary","summary":"The ZFS Adaptive Replacement Cache (ARC) is a memory-based caching system that enhances read performance by storing frequently accessed data and metadata in RAM.\nIt prioritises recently and frequently used information to optimise data access, and it can dynamically adjust its size to accommodate system needs.\n","title":"Adaptive Replacement Cache","type":"glossary"},{"content":"The central processing unit (CPU) is the primary component of a computer that acts as its control center. It interprets, processes and executes instructions, such as arithmetic, logic, controlling, and input/output (I/O) operations, most often from the hardware and software programs running on the device.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/cpu/","section":"Glossary","summary":"The central processing unit (CPU) is the primary component of a computer that acts as its control center. It interprets, processes and executes instructions, such as arithmetic, logic, controlling, and input/output (I/O) operations, most often from the hardware and software programs running on the device.\n","title":"Central Process Unit","type":"glossary"},{"content":"The Cloud Native Computing Foundation (CNCF) is the vendor-neutral hub of cloud native computing, dedicated to making cloud native ubiquitous.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/cncf/","section":"Glossary","summary":"The Cloud Native Computing Foundation (CNCF) is the vendor-neutral hub of cloud native computing, dedicated to making cloud native ubiquitous.\n","title":"Cloud Native Computing Foundation","type":"glossary"},{"content":"Coordinated Universal Time (UTC) is the primary time standard globally used to regulate clocks and time. It establishes a reference for the current time, forming the basis for civil time and time zones. UTC facilitates international communication, navigation, scientific research, and commerce.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/utc/","section":"Glossary","summary":"Coordinated Universal Time (UTC) is the primary time standard globally used to regulate clocks and time. It establishes a reference for the current time, forming the basis for civil time and time zones. UTC facilitates international communication, navigation, scientific research, and commerce.\n","title":"Coordinated Universal Time","type":"glossary"},{"content":"The Domain Name System (DNS), the phonebook of the Internet, is a hierarchical and distributed name service that provides a naming system for computers, services, and other resources on the Internet or other Internet Protocol (IP) networks.\nMost prominently, it translates readily memorized domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.\nIn case of the World Wide Web, humans access information online through domain names, like calabruix.es. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/dns/","section":"Glossary","summary":"The Domain Name System (DNS), the phonebook of the Internet, is a hierarchical and distributed name service that provides a naming system for computers, services, and other resources on the Internet or other Internet Protocol (IP) networks.\n","title":"Domain Name System","type":"glossary"},{"content":"Gbps, or gigabits per second, is the unit of measurement for data transfer speeds that is one thousand times faster than the Mbps, or megabits per second.\nGBps (Gigabytes per second, or GB/s) and Gbps (Gigabits per second, or Gb/s) both measure data transfer rate, but the former refers to the transfer of 8-bit bytes, while the latter refers to the transfer of 1-bit units. One GB/s is equal to 8 Gb/s.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/gpbs/","section":"Glossary","summary":"Gbps, or gigabits per second, is the unit of measurement for data transfer speeds that is one thousand times faster than the Mbps, or megabits per second.\nGBps (Gigabytes per second, or GB/s) and Gbps (Gigabits per second, or Gb/s) both measure data transfer rate, but the former refers to the transfer of 8-bit bytes, while the latter refers to the transfer of 1-bit units. One GB/s is equal to 8 Gb/s.\n","title":"Gigabits per second","type":"glossary"},{"content":"Hard disk drives (HDD) and solid state drives (SSD) are data storage devices. HDDs store data in mechanically-moving, magnetic platters, while SSDs store data in flash memory (electronic circuits). SSDs offer more speed and efficiency. However, HDDs are a more cost-efficient option.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/hdd/","section":"Glossary","summary":"Hard disk drives (HDD) and solid state drives (SSD) are data storage devices. HDDs store data in mechanically-moving, magnetic platters, while SSDs store data in flash memory (electronic circuits). SSDs offer more speed and efficiency. However, HDDs are a more cost-efficient option.\n","title":"Hard Disk Drive","type":"glossary"},{"content":"The Internet protocol (IP) is the network layer communications protocol in the Internet protocol suite for relaying datagrams across network boundaries.\nIt has the task of delivering packets from the source host to the destination host solely based on the IP addresses in the packet headers. For this purpose, it defines packet structures that encapsulate the data to be delivered. It also defines addressing methods that are used to label the datagram with source and destination information.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/ip/","section":"Glossary","summary":"The Internet protocol (IP) is the network layer communications protocol in the Internet protocol suite for relaying datagrams across network boundaries.\nIt has the task of delivering packets from the source host to the destination host solely based on the IP addresses in the packet headers. For this purpose, it defines packet structures that encapsulate the data to be delivered. It also defines addressing methods that are used to label the datagram with source and destination information.\n","title":"Internet Protocol","type":"glossary"},{"content":"LinuX Containers (LXC) is an operating system-level virtualization method for running multiple isolated Linux systems on a control host using a single Linux kernel. It combines the kernel’s control groups and support for isolated namespaces to provide an isolated environment for applications.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/lxc/","section":"Glossary","summary":"LinuX Containers (LXC) is an operating system-level virtualization method for running multiple isolated Linux systems on a control host using a single Linux kernel. It combines the kernel’s control groups and support for isolated namespaces to provide an isolated environment for applications.\n","title":"LinuX Container","type":"glossary"},{"content":"MTA may refer to a Mail Transfer Agent, a Message Transfer Agent, or a Mail Transport Agent. No matter which name you use, MTAs play an essential role in the Internet message handling system. They transfer electronic mail messages between the computers of a sender and a recipient.\nAn MTA is just an element of the email delivery process. It receives an email from the mail/message submission agent (MSA), which, in turn, receives it from the mail user agent (MUA). The MUA is commonly known as an email client – an app you use to handle email-related stuff.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/mta/","section":"Glossary","summary":"MTA may refer to a Mail Transfer Agent, a Message Transfer Agent, or a Mail Transport Agent. No matter which name you use, MTAs play an essential role in the Internet message handling system. They transfer electronic mail messages between the computers of a sender and a recipient.\n","title":"Mail Transport Agent","type":"glossary"},{"content":"In computer networks, various types of addresses are introduced, each working at a different layer. A Medium Access Control (MAC) address is a unique, 48-bit hardware address that is embedded into a network card during manufacturing and works at the data link layer for use as a network address in communications within a network segment.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/mac/","section":"Glossary","summary":"In computer networks, various types of addresses are introduced, each working at a different layer. A Medium Access Control (MAC) address is a unique, 48-bit hardware address that is embedded into a network card during manufacturing and works at the data link layer for use as a network address in communications within a network segment.\n","title":"Medium Access Control","type":"glossary"},{"content":"NetBIOS, which stands for Network Basic Input/Output System, is a networking protocol that enables applications on different computers to communicate over a local area network (LAN). It provides a set of services, including name resolution, session management, and datagram communication, that allow devices to discover each other and exchange data.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/netbios/","section":"Glossary","summary":"NetBIOS, which stands for Network Basic Input/Output System, is a networking protocol that enables applications on different computers to communicate over a local area network (LAN). It provides a set of services, including name resolution, session management, and datagram communication, that allow devices to discover each other and exchange data.\n","title":"Network Basic Input/Output System","type":"glossary"},{"content":"A network interface card, or controller (NIC), is a computer hardware component that connects a computer to a computer network. It allows computers to communicate over a computer network, either by using cables or wirelessly.\nIt is both a physical layer and data link layer device, as it provides physical access to a networking medium and provides a low-level addressing system through the use of MAC addresses that are uniquely assigned to network interfaces.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/nic/","section":"Glossary","summary":"A network interface card, or controller (NIC), is a computer hardware component that connects a computer to a computer network. It allows computers to communicate over a computer network, either by using cables or wirelessly.\n","title":"Network Interface Card","type":"glossary"},{"content":"Non-volatile memory express (NVMe) is a storage access and transport protocol for flash and solid-state drives (SSD). By its design, NVM Express allows hardware and software to fully exploit the levels of parallelism possible in modern SSDs. As a result, it reduces input/output overhead and brings performance improvements such as multiple long command queues, and reduced latency.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/nvme/","section":"Glossary","summary":"Non-volatile memory express (NVMe) is a storage access and transport protocol for flash and solid-state drives (SSD). By its design, NVM Express allows hardware and software to fully exploit the levels of parallelism possible in modern SSDs. As a result, it reduces input/output overhead and brings performance improvements such as multiple long command queues, and reduced latency.\n","title":"Non-Volatile Memory express","type":"glossary"},{"content":"An operating system (OS) is system software that manages computer hardware and software resources for its users and their applications. They include a kernel, which is the portion of the operating system code that is always resident in memory and facilitates interactions between hardware and software components.\nThere are three main purposes that an operating system fulfills:\nAllocate resources among applications. The operating system gives each application a share of the resource, either in time (CPU) or space (memory), and isolates applications from each other to protect them from errors, but enable communications between different applications.\nProvide an interface that abstracts the details of accessing hardware details (such as physical memory) to make things easier for programmers.\nProvide common services, such as an interface for accessing network and disk devices, enabling an application to be run on different hardware without needing to be rewritten.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/os/","section":"Glossary","summary":"An operating system (OS) is system software that manages computer hardware and software resources for its users and their applications. They include a kernel, which is the portion of the operating system code that is always resident in memory and facilitates interactions between hardware and software components.\n","title":"Operating System","type":"glossary"},{"content":"Random access memory (RAM), one of the most fundamental elements of computing, is a temporary memory bank where a computer stores data it needs to retrieve quickly. It keeps data easily accessible so your processor can quickly find it without having to go into long-term storage to complete immediate processing tasks.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/ram/","section":"Glossary","summary":"Random access memory (RAM), one of the most fundamental elements of computing, is a temporary memory bank where a computer stores data it needs to retrieve quickly. It keeps data easily accessible so your processor can quickly find it without having to go into long-term storage to complete immediate processing tasks.\n","title":"Random Access Memory","type":"glossary"},{"content":"Redundant array of independent disks (RAID) is a type of storage that writes data across multiple drives within the same system to accomplish performance or redundancy goals not attainable with one large drive. This array of drives appears to the computer as a single logical storage unit or drive.\nDifferent configurations are expressed as numbers, such as RAID 0, RAID 1, or RAID 5. Each RAID type gives users different benefits (increased performance, greater fault tolerance, or a combination of both), depending on how it writes and distributes your data.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/raid/","section":"Glossary","summary":"Redundant array of independent disks (RAID) is a type of storage that writes data across multiple drives within the same system to accomplish performance or redundancy goals not attainable with one large drive. This array of drives appears to the computer as a single logical storage unit or drive.\n","title":"Redundant Array of Independent Disks","type":"glossary"},{"content":"Remote Procedure Call (RPC) is a protocol that allows a program on one computer to call a procedure or function on another computer across a network, as if it were a local call. This abstraction simplifies distributed systems by hiding the complexities of network communication.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/rpc/","section":"Glossary","summary":"Remote Procedure Call (RPC) is a protocol that allows a program on one computer to call a procedure or function on another computer across a network, as if it were a local call. This abstraction simplifies distributed systems by hiding the complexities of network communication.\n","title":"Remote Procedure Call","type":"glossary"},{"content":"Server Message Block (SMB) is a network file sharing protocol that allows computers to share files, printers, and other resources over a network. It establishes a client-server relationship where a client (like a computer user) requests access to resources on a server (like a file server).\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/smb/","section":"Glossary","summary":"Server Message Block (SMB) is a network file sharing protocol that allows computers to share files, printers, and other resources over a network. It establishes a client-server relationship where a client (like a computer user) requests access to resources on a server (like a file server).\n","title":"Server Message Block","type":"glossary"},{"content":"The Simple Protocol for Independent Computing Environments (SPICE) is a remote display system used by Proxmox VE to provide access to virtual machines. It allows users to interact with virtual machines through a graphical interface, enabling features like clipboard sharing, file transfer, and USB redirection.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/spice/","section":"Glossary","summary":"The Simple Protocol for Independent Computing Environments (SPICE) is a remote display system used by Proxmox VE to provide access to virtual machines. It allows users to interact with virtual machines through a graphical interface, enabling features like clipboard sharing, file transfer, and USB redirection.\n","title":"Simple Protocol for Independent Computing Environments","type":"glossary"},{"content":"The Simple Service Discovery Protocol (SSDP) is a network protocol that enables devices to automatically discover and advertise network services, particularly within a local network (LAN). It is a key component of Universal Plug and Play (UPnP) and allows devices to announce their presence and available services without needing manual configuration.\nSSDP uses multicast messages to broadcast this information, allowing other devices on the same network to easily identify and interact with them.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/ssdp/","section":"Glossary","summary":"The Simple Service Discovery Protocol (SSDP) is a network protocol that enables devices to automatically discover and advertise network services, particularly within a local network (LAN). It is a key component of Universal Plug and Play (UPnP) and allows devices to announce their presence and available services without needing manual configuration.\n","title":"Simple Service Discovery Protocol","type":"glossary"},{"content":"Solid state drives (SSD) and hard disk drives (HDD) are data storage devices. SSDs store data in flash memory (electronic circuits), while HDDs store data in mechanically-moving, magnetic platters. SSDs offer more speed and efficiency. However, HDDs are a more cost-efficient option.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/ssd/","section":"Glossary","summary":"Solid state drives (SSD) and hard disk drives (HDD) are data storage devices. SSDs store data in flash memory (electronic circuits), while HDDs store data in mechanically-moving, magnetic platters. SSDs offer more speed and efficiency. However, HDDs are a more cost-efficient option.\n","title":"Solid State Drive","type":"glossary"},{"content":"A top-level domain (TLD) is the last segment of a domain name, located after the final dot. For example, in the domain name www.example.com, the TLD is .com. TLDs are an essential part of the Domain Name System (DNS) and help to organize the internet’s namespace.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/tld/","section":"Glossary","summary":"A top-level domain (TLD) is the last segment of a domain name, located after the final dot. For example, in the domain name www.example.com, the TLD is .com. TLDs are an essential part of the Domain Name System (DNS) and help to organize the internet’s namespace.\n","title":"Top Level Domain","type":"glossary"},{"content":"A Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID), is a 128-bit number used to uniquely identify information in computer systems.\nIt is designed to be unique across space and time, meaning it is extremely unlikely that two different systems will generate the same UUID.\nUUIDs are typically represented as 36-character strings, formatted as 8-4-4-4-12 hyphen-separated hexadecimal values.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/uuid/","section":"Glossary","summary":"A Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID), is a 128-bit number used to uniquely identify information in computer systems.\nIt is designed to be unique across space and time, meaning it is extremely unlikely that two different systems will generate the same UUID.\n","title":"Universally Unique IDentifier","type":"glossary"},{"content":"Virtual Input and Output (VirtIO) is a standardized interface which allows virtual machines access to simplified “virtual” devices, such as block devices, network adapters and consoles.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/virtio/","section":"Glossary","summary":"Virtual Input and Output (VirtIO) is a standardized interface which allows virtual machines access to simplified “virtual” devices, such as block devices, network adapters and consoles.\n","title":"Virtual Input and Output","type":"glossary"},{"content":"A virtual local area network (VLAN) is a virtualized connection that connects multiple devices and network nodes from different LANs into one logical network.\nA VLAN behaves like a virtual switch or network link that can share the same physical structure with other VLANs while staying logically separate from them. Between network devices, VLANs work by applying tags to network frames and handling these tags in networking systems, creating the appearance and functionality of network traffic that is physically on a single network but acts as if it were split between separate networks.\nIn this way, VLANs can keep network applications separate despite being connected to the same physical network, and without requiring multiple sets of cabling and networking devices to be deployed.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/vlan/","section":"Glossary","summary":"A virtual local area network (VLAN) is a virtualized connection that connects multiple devices and network nodes from different LANs into one logical network.\nA VLAN behaves like a virtual switch or network link that can share the same physical structure with other VLANs while staying logically separate from them. Between network devices, VLANs work by applying tags to network frames and handling these tags in networking systems, creating the appearance and functionality of network traffic that is physically on a single network but acts as if it were split between separate networks.\n","title":"Virtual Local Area Network","type":"glossary"},{"content":"A virtual machine (VM) is the virtualization or emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer.\n","date":"16 September 2024","externalUrl":null,"permalink":"/en/glossary/vm/","section":"Glossary","summary":"A virtual machine (VM) is the virtualization or emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer.\n","title":"Virtual Machine","type":"glossary"},{"content":"Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.\n","date":"12 September 2024","externalUrl":null,"permalink":"/en/glossary/html/","section":"Glossary","summary":"Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.\n","title":"Hypertext Markup Language","type":"glossary"},{"content":"The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite. It has no formal membership roster or requirements and all its participants are volunteers.\n","date":"12 September 2024","externalUrl":null,"permalink":"/en/glossary/ietf/","section":"Glossary","summary":"The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite. It has no formal membership roster or requirements and all its participants are volunteers.\n","title":"Internet Engineering Task Force","type":"glossary"},{"content":"A local area network (LAN) is a computer network that interconnects computers within a limited area such as a server rack, a building, a residence, school, laboratory, university campus or office. By contrast, a wide area network (WAN) not only covers a larger geographic distance, but also generally involves leased telecommunication circuits.\n","date":"12 September 2024","externalUrl":null,"permalink":"/en/glossary/lan/","section":"Glossary","summary":"A local area network (LAN) is a computer network that interconnects computers within a limited area such as a server rack, a building, a residence, school, laboratory, university campus or office. By contrast, a wide area network (WAN) not only covers a larger geographic distance, but also generally involves leased telecommunication circuits.\n","title":"Local Area Network","type":"glossary"},{"content":"This article will show you how to use Hugo and Blowfish to get your blog up and running from scratch. Hugo is one of the most popular open-source static site generators and Blowfish is a powerful, lightweight theme for Hugo.\nWe will be using the Debian distribution of Linux, but these instructions apply to all Debian derivatives. Moreover, if you are using other distros such as Fedora, you will only need to change the way you install Git and Hugo.\nSystem dependencies # In our scenario, the Git distributed version control system is the only tool required. We will use to install the Blowfish theme as a Git submodule, to access commit information from a local Git repository, to save a copy of our website on Github.\nsudo apt install git Install Hugo # We will install the extended edition of Hugo, as recommended in their installation instructions, using a Debian package that we will download from the latest release page at Github. The following set of commands will automate the task (adjust the version in the first line, if needed):\nHUGO_VERSION=\u0026#34;0.167.0\u0026#34; wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \\ --output-document /tmp/hugo_extended_${HUGO_VERSION}_linux-amd64.deb sudo dpkg --install /tmp/hugo_extended_${HUGO_VERSION}_linux-amd64.deb rm /tmp/hugo_extended_${HUGO_VERSION}_linux-amd64.deb When in need to upgrade to a newer version of Hugo, we will download a new version of the package and install it, overwriting the existing one.\nYou can check the installed version with the hugo version command.\nRepository # Create a new repository on Github.\nGive it a short, memorable name, e.g., mywebsite. Add a description, e.g., “My personal website using Hugo and Blowfish”. Make it public or private, depending on your needs. Optionally, check the box to add a README.md file. There is no .gitignore template for Hugo on Github, so we will create one later. Choose a licence for your project, e.g., AGPL-3.0. Github offers some well-crafted guidelines on how to write a good README file, and on how to choose a licence for your repository.\nClone the repository to your local machine. We will be using the ~/Sites parent directory for our projects, but you can choose any other location.\ncd ~/Sites git clone [email protected]:\u0026lt;username\u0026gt;/mywebsite.git Refer to the documentation to learn how to set up SSH access to your Github account.\nCreate the site # Creating the Hugo site is a very simple process. Just execute the following command in the root directory of the repository that you just cloned.\ncd ~/Sites/mywebsite hugo new site . --force Install Blowfish # We will install Blowfish as a Git submodule, as recommended in their installation instructions. We will be using the latest version of Blowfish from its main branch, with shallow depth:\ncd ~/Sites/mywebsite git submodule add --branch main --depth 1 \\ https://github.com/nunocoracao/blowfish.git themes/blowfish You can check the maximum Hugo version supported by the theme in its config.toml file and adjust your Hugo version accordingly.\nWhen in need to upgrade to a newer version of the theme, use the following Git command at the root directory of the website.\ncd ~/Sites/mywebsite git submodule update --remote --merge After updating the submodule, we still need to stage and commit the changes:\ngit add themes/blowfish git commit -m \u0026#34;chore: bump Blowfish to version x.y.z\u0026#34; Once the submodule has been updated, the site needs to be rebuilt.\nMark the submodule as shallow, so only the latest revision is downloaded when cloning the repository again in the future:\ncd ~/Sites/mywebsite git config -f .gitmodules submodule.themes/blowfish.shallow true This command just added shallow = true to the themes/blowfish submodule in the .gitmodules file.\nWhen in need to clone the repository into another computer, you have to keep in mind that, when cloning a repository that contains submodules, you have to initialise them explicitly.\nGIT_SSH_COMMAND=\u0026#34;ssh -i ~/.ssh/your_key -o IdentitiesOnly=yes\u0026#34; \\ git clone --recurse-submodules \\ [email protected]:\u0026lt;username\u0026gt;/mywebsite.git If you only have one SSH key, you can skip the GIT_SSH_COMMAND option.\nNow, run the following commands inside the new repository directory so that you can start working with it immediately:\ngit config core.sshCommand \u0026#34;ssh -i ~/.ssh/your_key -o IdentitiesOnly=yes\u0026#34; git config user.name \u0026#34;Your Name\u0026#34; git config user.email \u0026#34;[email protected]\u0026#34; Finally, we will create a .gitignore file to exclude certain files from the repository automatically.\n# Hugo .DS_Store .hugo_build.lock *.test imports.* dist/ public/ We are now ready to commit our first changes to the repository.\ngit add . git commit -a -m \u0026#34;Added Blowfish theme and gitignore file\u0026#34; As you advance through this tutorial, do not forget to commit your changes to your local repository every time you think that you have a new, stable version. For that, use the following commands:\nCommand Description git add . Add all changes to the staging area git commit -m “Message” Commit the changes with a message git push Push the changes to the remote repository Throughout the article I will be ommitting the git push command, as I will be assuming that you will be pushing your changes to the remote repository at the end of each section. However, you can push your changes at any time.\nConfigure Blowfish # Delete the hugo.toml file from the root folder of the website that was generated by Hugo, then copy the *.toml files from the themes/blowfish/config/_default/ sub-directory into the config/_default/ folder. This will ensure that you have all the correct configuration files so that you can start customising them.\ncd ~/Sites/mywebsite rm hugo.toml mkdir --parents config/_default cp --archive themes/blowfish/config/_default/*.toml config/_default/ Before creating any content we will go through all the configuration files and set a few directives.\nSite configuration # First, edit the hugo.toml file to set the theme, the language and the base URL of the site. The languageCode should be set to the main language that you will be using to author your content.\n# config/_default/hugo.toml theme = \u0026#34;blowfish\u0026#34; baseURL = \u0026#34;https://mywebsite.com/\u0026#34; languageCode = \u0026#34;en\u0026#34; Languages # Next we will configure the language settings. Blowfish supports multi-lingual but, for now, we will configure the main language only.\nLocate the languages.en.toml file in the config/_default/ configuration folder. If you just configured a different language in the hugo.toml, rename the file to match it. For example, for Catalan, you would have used languageCode = \u0026quot;ca\u0026quot; and would rename the file to languages.ca.toml.\ntitle = \u0026#34;The title of my website\u0026#34; [params] logo = \u0026#34;img/logo.png\u0026#34; [params.author] name = \u0026#34;My Name\u0026#34; image = \u0026#34;img/author.jpg\u0026#34; headline = \u0026#34;This text will appear beneath the author profile in the home page\u0026#34; bio = \u0026#34;This text will appear next to the author icon in each article\u0026#34; links = [ { email = \u0026#34;mailto:[email protected]\u0026#34; }, { github = \u0026#34;https://github.com/\u0026lt;username\u0026gt;/\u0026#34; }, ] The image in the logo attribute will be shown left of the site name, in the header.\nThe [author] configuration determines how the author information is displayed on the website. The image should be placed in the assets/ folder. Links will be displayed in the order they are listed.\nThis is a quick overview of the current structure of folders.\n. ├── assets │ └── img │ └── author.jpg ├── config │ └── _default │ ├── hugo.toml │ ├── languages.en.toml │ ├── menus.en.toml │ └── params.toml ├── content └── themes └── blowfish Colour scheme # Blowfish includes some colour schemes out of the box. To change the scheme, simply set the colorScheme theme parameter to any of the valid options in your config/_default/params.toml configuration file.\ncolorScheme = \u0026#34;avocado\u0026#34; defaultAppearance = \u0026#34;dark\u0026#34; autoSwitchAppearance = true Notice that we switched the default appearance from light to dark. However, setting the autoSwitchAppearance parametre to true renders this option useless, as Blowfish will use the visitor’s operating system configuration.\nMoreover, going back to the config/_default/languages.en.toml configuration file, we have the option to set a complimentary logo for the secondary appearance, which would be light in our case:\n[params] logo = \u0026#34;img/logo.png\u0026#34; secondaryLogo = \u0026#34;img/secondary-logo.png\u0026#34; Privacy settings # If, like me, you do not plan on integrating your Hugo website with external services, you can take advantage of the privacy configuration options in the hugo.toml file to disable all services.\n[privacy] [privacy.disqus] disable = true [privacy.googleAnalytics] disable = true [privacy.instagram] disable = true [privacy.twitter] disable = true [privacy.vimeo] disable = true [privacy.youtube] disable = true Optionally, commit these changes to the repository:\ngit add . git commit -m \u0026#34;Configured the site, language, colour and privacy settings\u0026#34; Organising content # In Hugo, your content should be organized in a manner that reflects the rendered website. All content is placed within the content folder. While Hugo supports content nested at any level, the top levels (i.e., content/\u0026lt;directory\u0026gt;) are special and are considered the content type used to determine layouts.\nHugo defaults to using posts, tags and categories out of the box. Hence, Blowfish is configured to use posts by default. You can notice this default behaviour by checking the value of the showMoreLinkDest option in the config/_default/params.toml configuration file.\nHowever, Blowfish does not force you to use any particular content type. You may want to use pages for a static site, posts for a blog, or projects for a portfolio. Whatever option you end up with, it is important to have a good understanding of how Hugo expects content to be organised, as the theme is designed to take full advantage of Hugo page bundles.\nMoreover, a taxonomy is a categorization that can be used to classify content in a logical manner so users can easily navigate the site and understand its purpose. A term is a key within the taxonomy. And a value is a piece of content assigned to a term. Visually, this may look like different sections and pages within a website, or categories within a blog.\nBy default, Blowfish defines the following taxonomies in the config/_default/hugo.toml configuration file:\n[taxonomies] tag = \u0026#34;tags\u0026#34; category = \u0026#34;categories\u0026#34; author = \u0026#34;authors\u0026#34; series = \u0026#34;series\u0026#34; Note: There is a convention to use singular = \u0026quot;plural\u0026quot;.\nCategories organize your site and allow readers to find the information they want. They are high-level topics that make it easy for people to understand what your blog is about and navigate to the content that interests them. The categories provide structure to your site by organizing individual posts and sub-topics under several main topics.\nOn the other hand, a tag is an indicator of what a particular post is about. Each tag is one to three words that sort your post into a particular archive. Tags should not have the same names as categories to prevent overlap.\nTherefore, we just found an easy way to get started using Hugo for our blog:\nAll articles will be of a single content type, posts. Each article will belong to a single category, e.g., frameworks, virtualisation, automation and monitoring, to get started with. Each article will have a number of tags, e.g. hugo, proxmox, ansible, prometheus, and so on. When taxonomies are used, Hugo will automatically create both a page listing all the taxonomy’s terms and individual pages with lists of content associated with each term. With the default values, Hugo will create:\nA single page at mywebsite.com/categories/ that lists all the terms within the taxonomy. Individual taxonomy list pages (e.g., mywebsite.com/categories/some-term/) for each of the terms that shows a listing of all pages marked as part of that taxonomy. Note: mywebsite.com/index.xml is essentially your RSS feed, you can target any section of your site by changing the URL. So for instance mywebsite.com/posts/index.xml is an RSS feed for your posts folder.\nCreating content # So, to get started we will create the subdirectory content/posts/ for our posts content type and we will create a few markdown files inside the content/ and the content/posts/ folders.\nAll of them will include front matter at the top, as this is how we add metadata to our content. Hugo accepts YAML, TOML and JSON for the front matter. Although TOML used to be the default format, YAML has become the de facto standard and, therefore, we will use it was well.\nThe number of available fields is extensive, but we will get started with the title, description and date fields for all our files and, in case of a post, we will include the summary, categories and tags fields as well.\n# Example of content/_index.md --- title: \u0026#34;The title of the home page\u0026#34; description: \u0026#34;The description of the home page.\u0026#34; date: \u0026#34;2024-07-18\u0026#34; --- Additional content displayed in the home page. # Example of content/about.md --- title: \u0026#34;The title of the about me page\u0026#34; description: \u0026#34;The description of the about me page.\u0026#34; date: \u0026#34;2024-07-18\u0026#34; --- This is the content of the about me page. # Example of content/posts/_index.md --- title: \u0026#34;Blog posts\u0026#34; description: \u0026#34;List of articles, grouped by year.\u0026#34; --- List of articles in the blog, grouped by year. # Example of content/posts/ansible-proxmox-lxc.md --- title: \u0026#34;Ansible playbook to provision LXC in Proxmox\u0026#34; description: \u0026#34;This text will appear in the description meta tag.\u0026#34; summary: \u0026#34;This text will be displayed when the article appears in a list.\u0026#34; date: \u0026#34;2024-08-22\u0026#34; categories: [\u0026#34;automation\u0026#34;] tags: [\u0026#34;proxmox\u0026#34;, \u0026#34;ansible\u0026#34;, \u0026#34;pve\u0026#34;] slug: \u0026#34;ansible-proxmox-lxc\u0026#34; --- This article explains how to create an Ansible playbook that leverages the `proxmoxer` module to provision a LinuX Container in our Proxmox Virtual Environment. Taking these three examples as reference, we can create the rest of article files and have a content tree that looks like this.\n. └── content ├── _index.md → / ├── about.md → /about/ ├── posts │ ├── _index.md → /posts/ │ ├── ansible-proxmox-lxc.md → /posts/ansible-proxmox-lxc/ │ ├── hugo-installation.md → /posts/hugo-installation/ │ ├── hugo-key-concepts.md → /posts/hugo-key-concepts/ │ ├── pbs-introduction.md → /posts/pbs-introduction/ │ ├── pve-design.md → /posts/pve-design/ │ ├── pve-introduction.md → /posts/pve-introduction/ │ ├── pve-os-configuration.md → /posts/pve-os-configuration/ │ └── pve-os-installation.md → /posts/pve-os-installation/ └── privacy.md → /privacy/ Regarding the content/_index.md and content/posts/_index.md files, _index.md has a special role in Hugo. It allows you to add front matter and content to home, section, taxonomy, and term pages. You can create one _index.md for your home page and one in each of your content sections, taxonomies, and terms.\nRegarding the content/about.md file, that is just a standalone page.\nYou can now start the server inside the root directory of the website. The web server makes itself available at the http://localhost:1313/ address by default.\nhugo server --buildDrafts The buildDrafts option passed to the server will make it include articles marked with draft: true in their front matter, which is a very useful tool when you are writing a new article but you are not finished yet.\nLet’s suppose that taxonomies were use like this.\nArticle Category Tags ansible-proxmox-lxc automation ansible, proxmox, pve hugo-installation frameworks hugo, blowfish hugo-key-concepts frameworks hugo pbs-introduction infrastructure proxmox, pbs pve-introduction virtualisation proxmox, pve pve-design virtualisation proxmox, pve pve-os-configuration virtualisation proxmox, pve pve-os-installation virtualisation proxmox, pve Hugo would generate the following additional URLs.\nhttp://localhost:1313/categories/automation http://localhost:1313/categories/frameworks http://localhost:1313/categories/infrastructure http://localhost:1313/categories/virtualisation Each of these URLs would list the articles that have been asigned to the corresponding category. Furthermore, Hugo would also generate the following additional URLs.\nhttp://localhost:1313/tags/ansible http://localhost:1313/tags/blowfish http://localhost:1313/tags/hugo http://localhost:1313/tags/proxmox http://localhost:1313/tags/pbs http://localhost:1313/tags/pve Each of these URLs would list the articles that have been associated with the corresponding tag.\nMoreover, all of the above URLs include both an index.html and index.xml, where the latter acts as a RSS feed for the section.\nSimilarly to the home page example given before in this section, you can customise the introductory text and the metadata of any taxonomy or term.\n# Example of content/categories/_index.md --- title: \u0026#34;Categories\u0026#34; description: \u0026#34;The list of categories this blog is split into.\u0026#34; date: \u0026#34;2024-07-18\u0026#34; --- These are the available categories in this blog. Click on any of them to see the list of articles, its amount being displayed as a counter in each card. # Example of content/categories/frameworks/_index.md --- title: \u0026#34;Frameworks\u0026#34; description: \u0026#34;The list of articles in the frameworks category.\u0026#34; date: \u0026#34;2024-07-18\u0026#34; --- This is the frameworks category, which covers all articles related to software development frameworks, such as Hugo or Django. # Example of content/categories/virtualisation/_index.md --- title: \u0026#34;Virtualisation\u0026#34; description: \u0026#34;The list of articles in the virtualisation category.\u0026#34; date: \u0026#34;2024-07-18\u0026#34; --- This is the virtualisation category term, which covers all articles related to technologies that allow dividing of physical computing resources into a series of virtual machines, operating systems, processes or containers, mainly via the Proxmox Virtual Environment. --- Most of the changes made to the files in your project will be automatically available in your browser, as Hugo will detect them, recompile the necessary files and reload the page for you. However, some changes will not, so they will require you to stop the server and launch it again.\nMenus # The Blowfish theme includes two menus. The main menu in the header and the footer menu appears at the bottom of the page. Both menus are configured in the menus.en.toml file. Similarly to the languages config file, if you configured a different language in the hugo.toml, rename the file to match it.\nThe name parametre specifies the text that is used in the menu link. Optionally, a title can be provided which will be used in the corresponding attribute of the HTML tag.\nThe pageRef parametre allows you to easily reference Hugo content pages and taxonomies, whereas the url parametre is used to link to external URLs.\nThe pre parametre allows you to choose an icon from Blowfish’s icon set to be displayed next to the name of the menu entry.\nBy default the menu is ordered alphabetically. This can be overridden by using the weight parametre. The menu will then be ordered by weight from lowest to highest.\nAgain, by default Blowfish comes configured to use the posts content type as well as the categories and tags taxonomies so, in order to match our current conent, we will just need to uncomment a few entries and add a few more in the config/_default/menus.en.toml.\n[[main]] name = \u0026#34;Blog\u0026#34; title = \u0026#34;The list of articles in this blog\u0026#34; pageRef = \u0026#34;posts\u0026#34; weight = 10 [[main]] name = \u0026#34;Categories\u0026#34; pageRef = \u0026#34;categories\u0026#34; weight = 20 [[main]] name = \u0026#34;Tags\u0026#34; pageRef = \u0026#34;tags\u0026#34; weight = 30 [[main]] name = \u0026#34;About\u0026#34; pageRef = \u0026#34;about\u0026#34; weight = 40 [[main]] name = \u0026#34;About\u0026#34; title = \u0026#34;About me\u0026#34; pageRef = \u0026#34;about\u0026#34; weight = 40 [[main]] identifier = \u0026#34;Github\u0026#34; pre = \u0026#34;github\u0026#34; url = \u0026#34;https://github.com/username\u0026#34; weight = 50 [[main]] identifier = \u0026#34;Email\u0026#34; pre = \u0026#34;email\u0026#34; url = \u0026#34;mailto:[email protected]\u0026#34; weight = 70 [[footer]] name = \u0026#34;Privacy policy\u0026#34; pageRef = \u0026#34;privacy\u0026#34; weight = 10 Thumbnails # Blowfish offers an easy way to add visual support to your posts in the form of thumbnails, which will also be used for oEmbed cards across social platforms. In order to take advantage of this feature, you need to change it from a single Markdown file into a folder, i.e., a leaf bundle.\nTo do so, first create a directory with the same name of the article, then create a index.md file inside, with the contents of the article. Finally, place an image file named featured.webp (JPG, PNG, SVG and WebP formats are supported).\nThe configuration file config/_default/params.toml allows lists of articles to be rendered as rows or a gallery of cards via the cardView parametre. The size of the canvas will determine how the image will be rendered. Height will range from 180 to 320 pixels, whereas width will range between 260 and ~580 px.\nImages with an aspect ratio of 3:2 (e.g., 600x400 px) should fit in nicely. An online tool such as RedKetchup’s Image Resizer will be of help.\nThe end result will be similar to this.\n. └── content ├── _index.md → / ├── about.md → /about/ ├── posts │ ├── ansible-proxmox-lxc │ │ ├── index.md → /posts/ansible-proxmox-lxc/ │ │ └── featured.webp │ ├── hugo-installation │ │ ├── index.md → /posts/hugo-installation/ │ │ └── featured.webp │ ├── hugo-key-concepts │ │ ├── index.md → /posts/hugo-key-concepts/ │ │ └── featured.webp │ ├── pbs-introduction │ │ ├── index.md → /posts/pbs-introduction/ │ │ └── featured.webp │ ├── pve-design │ │ ├── index.md → /posts/pve-design/ │ │ └── featured.webp │ ├── pve-introduction │ │ ├── index.md → /posts/pve-introduction/ │ │ └── featured.webp │ ├── pve-os-configuration │ │ ├── index.md → /posts/pve-os-configuration/ │ │ └── featured.webp │ └── pve-os-installation │ ├── index.md → /posts/pve-os-installation/ │ └── featured.webp └── privacy.md → /privacy/ Note that the file with the article content, index.md, does not beging with an underscore.\nFavicons # In order to override the default set of blank icons provided by the Blowfish theme, the favicon assets need to be placed directly under the static/ folder, named as per the listing below.\n. └── static ├─ android-chrome-192x192.png ├─ android-chrome-512x512.png ├─ apple-touch-icon.png ├─ favicon-16x16.png ├─ favicon-32x32.png ├─ favicon.ico └─ site.webmanifest The recommended way to obtain these is to generate them using a third-party provider such as RedKetchup’s Favicon Generator or favicon.io’s Favicon Generator, which will produce exactly these filenames. Just upload your image (at least 512x512 pixels) and download the Zip archive with all the necessary files, which you can unarchive directly into the static/ folder of your website.\nFinetuning the layout # Some final, optional touches to the way articles, lists of articles and taxonomy terms are displayed in your blog. All of these parametres are available in the config/_default/params.toml configuration file.\nArticles # The list of parametres applying to article pages is very extensive, but here you are some of the most relevant.\nshowDateUpdated allows the date of the last update to be displayed in the article header. This is useful if you are updating articles frequently. enableCodeCopy decides whether copy-to-clipboard buttons are enabled for \u0026lt;code\u0026gt; blocks. Useful if you are displaying programming code. showBreadcrumbs allows breadcrumbs to be displayed in the article header. showTableOfContents shows the table of contents is displayed on articles, by default in a column on the right. showTaxonomies allows taxonomies related to an article to be displayed beneath its title. showZenMode activates the Zen Mode reading feature for articles, which takes out the right column with the table of contents so the content of the article takes all the space. enableCodeCopy = true [article] showDateUpdated = true showBreadcrumbs = true showTableOfContents = true # showRelatedContent = true # relatedContentLimit = 3 showTaxonomies = true showZenMode = true When you have added enough content to your website, you may want to list related articles at the bottom of your posts. The default configuration of Blowfish requires you to just comment out the following parametres:\nshowRelatedContent will display related content for each post. relatedContentLimit will limit the number of related articles to display. Hugo allows finetuning the way related content is indexed, both on the global and language levels if needed. The configuration options are available in the [related] section of the config/_default/hugo.toml file. Playing with these paramtres will change how Hugo decides which articles will be displayed in the Related section.\n[related] threshold = 0 toLower = false [[related.indices]] name = \u0026#34;tags\u0026#34; weight = 100 [[related.indices]] name = \u0026#34;categories\u0026#34; weight = 100 [[related.indices]] name = \u0026#34;series\u0026#34; weight = 50 [[related.indices]] name = \u0026#34;authors\u0026#34; weight = 20 [[related.indices]] name = \u0026#34;date\u0026#34; weight = 10 [[related.indices]] applyFilter = false name = \u0026#39;fragmentrefs\u0026#39; type = \u0026#39;fragments\u0026#39; weight = 10 The above configuration, being the default taken from Blowfish, is instructing Hugo to use tags and categories that articles may have in common as they main criteria, then the series articles may belong to and, finally, shared author and same date. The last block is instructing Hugo to index the metadata of the articles to calculate related content.\nLists of articles # The list of parametres applying to article pages is fairly extensive. These are just a noteworthy few.\nshowSummary includes the summary in each listed article. Summaries, when not included in the front matter of each article, are generated using the summaryLength in the config/_default/hugo.toml configuration file. showCards makes each article to be displayed as a card instead of as simple inline text. cardView displays lists as a gallery of cards. constrainItemsWidth limits item width to the width of the summary to increase readability when no feature images are available. [list] showSummary = true showCards = true cardView = true constrainItemsWidth = false Taxonomies # Regarding taxonomies and taxonomy terms, a relevant one so that the style of the blog is coherent:\ncardView displays lists as a gallery of cards. These are the\n[taxonomy] cardView = true [term] cardView = false The taxonomy section refers to the /tags/ and /categories/ in our example website, whereas the term section refers to each term page of each taxonomy, e.g., /tags/proxmox/ or /categories/frameworks/.\nConfiguring the home page # Blowfish provides a variety of layouts for your home page. As with articles, lists, taxonomies and terms, you can find a number parametres to finetune the layout of your choice in the config/_default/params.toml configuration file.\n# We only want entries of content type `posts` to be listed # in the recent section of the homepage. mainSections = [\u0026#34;posts\u0026#34;] highlightCurrentMenuArea = true [homepage] layout = \u0026#34;profile\u0026#34; showRecent = true showRecentItems = 6 showMoreLink = true showMoreLinkDest = \u0026#34;/posts\u0026#34; cardView = true The above configuraration will use the default profile layout, highlight the current option in the menu, show the six most recent articles (sorted by the date in the metadata) using the card view and display and show Show More button at the bottom of the list of recent articles, linking to /posts.\nIf you would like to use a backoground image, you need to change the layout parametre and add an image to your assets/ folder. You will notice that Blowfish will adapt the image to the colour scheme defined in the config/_default/params.toml configuration file and the selected layout for the home page.\n[homepage] layout = \u0026#34;background\u0026#34; homepageImage = \u0026#34;img/background.webp\u0026#34; Series # If you would like to split very long subjects into different posts, i.e., to group articles together, Blowfish series is the feature you are looking for.\nAssigning articles to a series will provide a quick way to navigate amongst them at the top and bottom of each article. Blowfish comes preconfigured with a series taxonomy in the config/_default/hugo.toml configuration, so all we need to do is to mark articles using the series and series_order parametres in the front matter.\nTaking our four articles in the virtualisation category, we would edit their front matter to look something like this.\n# content/posts/pve-introduction/index.md --- title: \u0026#34;Your Proxmox VE 7 cluster at Hetzner\u0026#34; date: 2024-07-30 description: \u0026#34;Install and configure a multi-node Proxmox Virtual Environment cluster using dedicated servers at Hetzner.\u0026#34; summary: \u0026#34;Plan, install and configure a Proxmox VE cluster using dedicated servers at Hetzner\u0026#34; categories: [\u0026#34;virtualisation\u0026#34;] tags: [\u0026#34;proxmox\u0026#34;, \u0026#34;pve\u0026#34;] slug: \u0026#34;pve-introduction\u0026#34; series: [\u0026#34;PVE\u0026#34;] series_order: 1 --- # content/posts/pve-design/index.md --- title: \u0026#34;Design considerations\u0026#34; date: \u0026#34;2024-07-30\u0026#34; description: \u0026#34;Giving our Proxmox cluster some thought before getting started.\u0026#34; summary: \u0026#34;Design the network configuration of your cluster before you get started.\u0026#34; categories: [\u0026#34;virtualisation\u0026#34;] tags: [\u0026#34;proxmox\u0026#34;, \u0026#34;pve\u0026#34;] slug: \u0026#34;pve-design\u0026#34; series: [\u0026#34;PVE\u0026#34;] series_order: 2 --- You can choose whether the series section is collapsed or expanded by default both at the global level, via the seriesOpened in the config/_default/params.toml configuration file, and at the article level via the seriesOpened parametre in the front-matter of each article. The default behaviour is for the section to be collapsed.\nThe values assigned to the series_order parametre do not need to be consecutive, but they are supposed to be because of the way Blowfish renders the section.\nImproving content organisation using sections # By now you must have realised that we have been somewhat prefixing the folder names of the articles to avoid conflicts and also to make them easier to notice. Eventually, though, our content/posts/ folder will be clutered with many folders and files.\nRemember that Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.\nA section is a top-level content directory or any content directory with an _index.md file, also known as a branch bundle. Analogous to a physical branch, a branch bundle may have descendants including leaf bundles and other branch bundles.\nA content type is also considered a section, although it does not have an _index.md file inside it, because it is a top-level content directory.\nA folder inside content/posts/ with an _index.md file in it, i.e., a section, becomes part of the path in the URL, has logical ancestors and descendants, which would help rendering the content in a hierarchical manner and a list page, correponding with their respective _index.md files, which will list the articles in that section.\nPosts inside a section will not be included in top-level lists (e.g., /posts/) but, instead, the section will. They will still appear in blocks of recent or related posts, though. Moreover, the list of posts in a section (e.g., content/posts/hugo/) will only include first level descendants.\nA folder inside content/posts/ (e.g., content/posts/hugo/) without an _index.md file in it, i.e., a non-section, becomes part of the path in the URL but does not have a list page.\nTherefore, non-sections will return a 404 Page Not Found error, although they will not be listed anywhere in the generated site. Their only purpose is to help organise the content on disk, with that structure being part of the path.\nExpanding on our example, we could restructure the content in a more hierarchical manner using non-sections. We would keep using one single content type, i.e., posts, and keep taxonomies without changes.\n. └── content ├── _index.md → / ├── about.md → /about/ ├── posts │ ├── _index.md → /posts/ │ ├── ansible → /posts/ansible/ │ │ └── lxc-provisioning │ │ ├── index.md → /posts/ansible/lxc-provisioning/ │ │ └── featured.webp │ ├── hugo │ │ ├── installation │ │ │ ├── index.md → /posts/hugo/installation/ │ │ │ └── featured.webp │ │ └── key-concepts │ │ ├── index.md → /posts/hugo/key-concepts/ │ │ └── featured.webp │ └── proxmox │ ├── pbs │ │ ├── index.md → /posts/proxmox/pbs/ │ │ └── featured.webp │ └── pve │ ├── _index.md → /posts/proxmox/pve/ │ ├── featured.md │ ├── design │ │ ├── index.md → /posts/pve/design/ │ │ └── featured.webp │ ├── introduction │ │ ├── index.md → /posts/pve/introduction/ │ │ └── featured.webp │ ├── os-configuration │ │ ├── index.md → /posts/pve/os-configuration/ │ │ └── featured.webp │ └── os-installation │ ├── index.md → /posts/pve/os-installation/ │ └── featured.webp └── privacy.md → /privacy/ Note how sections and non-sections are being used. content/posts/ansible/, content/posts/hugo/ and content/posts/proxmox/ are non-sections, used to organise the content in subdirectories only, whereas content/posts/proxmox/pve/ is a section, used to mask all the posts beneath it by grouping them into a single entry (as opposed to having them all show separately).\n# Example of content/posts/proxmox/pve/_index.md --- title: \u0026#34;Your Proxmox VE cluster\u0026#34; description: \u0026#34;Install and configure a multi-node Proxmox Virtual Environment cluster.\u0026#34; summary: \u0026#34;Plan, install and configure a Proxmox VE cluster using dedicated servers.\u0026#34; categories: [\u0026#34;virtualisation\u0026#34;] tags: [\u0026#34;proxmox\u0026#34;, \u0026#34;pve\u0026#34;] --- Install and configure a multi-node Proxmox Virtual Environment cluster using dedicated servers at Hetzner. Should you want to customise the path of each article, you can use permalink tokens in the url parametre of the front matter of the _index.md file of the section, or in the site configuration file.\n# Example of config/_default/hugo.toml [permalinks] [permalink.posts] posts = \u0026#34;/:sections/:slugorfilename\u0026#34; Emphasising categories # If you would like to bring up the relevance of categories, to boost your SEO and enhance site nativation by establishing a clear hierarchy, you could turn them into top-level sections, which would render them unnecessary in the front matter of the articles.\n. └── content ├── _index.md ├── about.md ├── automation │ ├── _index.md │ ├── lxc │ └── proxmox ├── frameworks │ ├── _index.md │ └── hugo ├── infrastructure │ ├── _index.md │ ├── databases │ ├── monitoring │ └── pbs ├── virtualisation │ ├── _index.md │ └── pve └── privacy.md This would require adapting the menu options in the config/_default/menus.en.toml file, maybe adding a new Articles menu entry with the sections as submenu options.\nThere are infinite ways to organise the content. As with everything in life, the best way to achieve a good result will be through observation, planning and experimentation.\nPublishing # As you finish writing articles, or maybe also while you are writing them, you want to keep your changes committed to the repository. This will allow you to keep track of your changes and revert them if necessary.\ngit add . git commit -m \u0026#34;Added a new article about Hugo and Blowfish\u0026#34; Once you are happy with the content of your blog, you will want to publish it. There are two ways to do so:\nAutomatically, by connecting your repository to a hosting provider that supports Hugo. Manually, by generating the static files and uploading them to a web server. In the second case, you will have to use the hugo command:\ncd ~/Sites/mywebsite hugo --minify --cleanDestinationDir The resulting files will be placed in the public/ directory.\nThe --minify option will minify the HTML, CSS and JavaScript files, which will reduce the size of the files and improve the loading time of your website.\nThe --cleanDestinationDir option will remove any files in the public/ directory that are not present in the source files, which is useful to keep the generated site clean.\nCloudflare Pages # There are certain prerequisites that you need to meet before you can deploy your Hugo site to Cloudflare Pages, namely:\nYou registered a domain name with some domain registrar. You registered an account at Cloudflare. You added your domain to Cloudflare. You have configured your domain name to use Cloudflare’s nameservers. Cloudflare calls this configuration a full setup. You do not need to register your domain with Cloudflare to use Cloudflare Pages, but you do need to add your domain to Cloudflare and configure it to use Cloudflare’s nameservers.\nOnce you have completed the full setup, you can easily deploy your Hugo site by following these steps:\nLog into your Cloudflare dashboard and select your account (should you have more than one). In account home, select Compute (Workers) \u0026gt; Workers \u0026amp; Pages. Select the Pages tab. Click on the Get started button on the Import an existing Git repository card. Select the Github tab and click on the Connect GitHub button. Select your Github account where you have your Hugo site repository. Select the Only select repositories and choose the repository from the dropdown list. Click on the Install \u0026amp; Authorize button. Back at Cloudflare, select the repository you just connected and click the Begin setup button. In the Set up builds and deployments step, fill in the following fields and click Continue: Field name Value Notes Project name mywebsite The name of your project Production branch main Default value should do Build command hugo Optionally, add --minify --cleanDestinationDir to the command Build output directory public Clodflare Pages will start the building and deploying process. The operation should end successfully in a few seconds, as you already have a working Hugo site in your repository. Click on the Add custom domain card to add your domain name to the project1. In the next page, click the Set up a custom domain button and enter your domain name, e.g., mywebsite.com. Click on the Continue button. Click on the Activate domain button. Cloudflare will change the DNS records and issue the SSL certificate. In the next page you will see Cloudflare verifying the changes and waiting for the DNS propagation to complete. Once complete, you will see the Verifying status change to Active. You may now visit your website at https://mywebsite.com/. At the Cloudflare Workers \u0026amp; Pages dashboard you will see four tabs:\nDeployments: Shows the list of deployments made to your project. You can view the log of each deployment by clicking on the View details link. Metrics: Shows the metrics of your project, such as the number of requests. It lets you enable Web Analytics, should you wish to do so. Custom domains: Shows the list of domains associated with your project. We were just there. Settings: Allows you to change the settings of your project, such as the build command and, more importantly, use a specific version of Hugo by setting the HUGO_VERSION environment variable. This is useful if you want to use a specific version of Hugo that is not the latest one. New commits will trigger Cloudflare to automatically build and deploy your changes.\nPreview end result by visiting your project at mywebsite.pages.dev. ↩︎ ","date":"5 September 2024","externalUrl":null,"permalink":"/en/posts/hugo/blog-with-blowfish/","section":"Posts","summary":"Install and configure the Hugo site generator with the Blowfish theme for your blog website.","title":"Build your blog using Hugo and Blowfish","type":"posts"},{"content":"This site neither uses cookies nor any software that tracks or collects data in the background. Moreover, I recommend using browsers that respect privacy.\nAll of the software used in this website adheres to the open-source philosophy. If you appreciate my work and it has saved you time, please consider supporting me with a donation through PayPal, buying me a coffee, or buying me a Ko-Fi.\nAll articles in this website are based on free and open source software, and are licensed under Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0).\n","date":"22 August 2024","externalUrl":null,"permalink":"/en/privacy/","section":"Calabruix","summary":"This site neither uses cookies nor any software that tracks or collects data in the background. Moreover, I recommend using browsers that respect privacy.\nAll of the software used in this website adheres to the open-source philosophy. If you appreciate my work and it has saved you time, please consider supporting me with a donation through PayPal, buying me a coffee, or buying me a Ko-Fi.\n","title":"Privacy policy","type":"page"},{"content":"I am a long-time systems engineer who got his first taste of Linux via Debian GNU/Linux back in the mid 90s. I started as a software developer (front-end and back-end), but soon dwelled into Internet services operations through dedicated servers and, later, virtualisation.\nAlong the way, I also learned about monitoring, automation, and configuration management. What is now known nowadays as DevOps was common sense to me when I was in my twenties, as I never shared that development versus operations divide.\nI spent some years alternating the roles of project manager and systems engineer and, eventually, co-founded a company offering VoIP and systems engineering services, which led me to a general manager role in the public administration for two terms (my small public service contribution).\nBeautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.\nOffline, I practice lots of sports (swimming, beach volleyball, stand-up paddle and hiking, among others) and I coach volleyball players.\nThe thing I like the most in life is learning, so I am always eager to meet new people and share knowledge and experiences. Usually very passionate about everything I do, I like practicing sports, attending to opera and classical music events, reading books, cooking, and watching films and series.\nAnd I also like writing about what I learn and what I do, hence this blog. All the articles in it are based on free and open source software, and are licensed under Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0).\nAbout the site # In Catalan, calabruix means hail, hailstones, or hailstorm, depending on how you use it. Hailstones are formed when raindrops are carried upward by thunderstorm updrafts into extremely cold areas of the atmosphere and freeze. Hailstones then grow by colliding with liquid water drops that freeze onto the hailstone’s surface.\nThe Summer storms are the wildest. They can really rip a place apart. There is nothing soft or gentle about the rain: it purs down, a huge, heavy torrent. The thunder is so close and loud, you feel it all around you. And sometimes there is hail.\nBackground picture in the home page by Korawat Thatinchan.\n","date":"11 August 2024","externalUrl":null,"permalink":"/en/about/","section":"Calabruix","summary":"I am a long-time systems engineer who got his first taste of Linux via Debian GNU/Linux back in the mid 90s. I started as a software developer (front-end and back-end), but soon dwelled into Internet services operations through dedicated servers and, later, virtualisation.\n","title":"About me","type":"page"},{"content":"Welcome to my website, a blog about systems engineering and technology.\n","date":"9 November 2026","externalUrl":null,"permalink":"/en/","section":"Calabruix","summary":"Welcome to my website, a blog about systems engineering and technology.\n","title":"Calabruix","type":"page"},{"content":"List of abbreviations, both acronyms and initialisms, used across the articles in this blog.\n","date":"9 November 2026","externalUrl":null,"permalink":"/en/glossary/","section":"Glossary","summary":"List of abbreviations, both acronyms and initialisms, used across the articles in this blog.\n","title":"Glossary","type":"glossary"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/categories/infrastructure/","section":"Categories","summary":"","title":"Infrastructure","type":"categories"},{"content":"List of articles in the blog, grouped by year.\n","date":"4 September 2026","externalUrl":null,"permalink":"/en/posts/","section":"Posts","summary":"List of articles in the blog, grouped by year.\n","title":"Posts","type":"posts"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/tags/shell/","section":"Tags","summary":"","title":"Shell","type":"tags"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/tags/terminal/","section":"Tags","summary":"","title":"Terminal","type":"tags"},{"content":"Here you will find a number of articles about how I use a variety of tools and utilities in the context of Linux, and especially DevOps with Linux, including:\nThe Z shell. Vi Improved. Articles are usually standalone.\n","date":"4 September 2026","externalUrl":null,"permalink":"/en/posts/tooling/","section":"Posts","summary":"Console tools and utilities used on DevOps with Linux","title":"Tooling","type":"posts"},{"content":"","date":"4 September 2026","externalUrl":null,"permalink":"/en/tags/tooling/","section":"Tags","summary":"","title":"Tooling","type":"tags"},{"content":"","date":"2026年09月04日","externalUrl":null,"permalink":"/categories/%E5%9F%BA%E7%A1%80%E8%AE%BE%E6%96%BD/","section":"Categories","summary":"","title":"基础设施","type":"categories"},{"content":"","date":"2026年09月04日","externalUrl":null,"permalink":"/tags/%E5%B7%A5%E5%85%B7/","section":"Tags","summary":"","title":"工具","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/alerting/","section":"Tags","summary":"","title":"Alerting","type":"tags"},{"content":"Here you will find a number of articles that relate to the installation, configuration and operation of Grafana Labs open-source software products. Grafana Labs develops an open-source observability platform centered around Grafana for visualization, Prometheus for metrics collection, Loki for log aggregation, Promtail as a log collector for Loki, and Grafana Alerting for unified alerting across metrics and logs.\nGrafana is an open-source platform for visualizing and analyzing time-series data. Prometheus is an open-source monitoring and alerting toolkit for collecting metrics. Loki is a horizontally scalable, multi-tenant log aggregation system that indexes logs via labels. Grafana Alerting enables unified alert creation and management across metrics, logs, and traces. Promtail is a log collector that ships logs to Loki with labeling and filtering capabilities. Articles are usually grouped into series.\n","date":"18 November 2025","externalUrl":null,"permalink":"/en/posts/grafana/","section":"Posts","summary":"Learn to install, configure and operate Grafana solutions in your Proxmox infrastructure","title":"Grafana","type":"posts"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/series/grafana/","section":"Series","summary":"","title":"Grafana","type":"series"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/grafana/","section":"Tags","summary":"","title":"Grafana","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/loki/","section":"Tags","summary":"","title":"Loki","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/categories/monitoring/","section":"Categories","summary":"","title":"Monitoring","type":"categories"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/monitoring/","section":"Tags","summary":"","title":"Monitoring","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/prometheus/","section":"Tags","summary":"","title":"Prometheus","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/tags/proxmox/","section":"Tags","summary":"","title":"Proxmox","type":"tags"},{"content":"","date":"18 November 2025","externalUrl":null,"permalink":"/en/series/","section":"Series","summary":"","title":"Series","type":"series"},{"content":"","date":"2025年11月18日","externalUrl":null,"permalink":"/categories/%E7%9B%91%E6%8E%A7/","section":"Categories","summary":"","title":"监控","type":"categories"},{"content":"","date":"27 October 2025","externalUrl":null,"permalink":"/en/tags/pve/","section":"Tags","summary":"","title":"Pve","type":"tags"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/nfs/","section":"Tags","summary":"","title":"Nfs","type":"tags"},{"content":"This series of articles will guide you through the process of setting up an NFS server on your Proxmox VE cluster using VMs both for the server and the clients, then configuring it for performance. It includes finetuning the VM parametres, the block sizes of every I/O layer used and the actual NFS server and clients.\n","date":"12 August 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/nfs/","section":"Posts","summary":"Set up an NFS server on Proxmox VE and optimise for performance","title":"NFS","type":"posts"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/series/nfs/","section":"Series","summary":"","title":"NFS","type":"series"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/pbs/","section":"Tags","summary":"","title":"Pbs","type":"tags"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/pmg/","section":"Tags","summary":"","title":"Pmg","type":"tags"},{"content":"Here you will find a number of articles that relate to the installation, configuration and operation of Proxmox open-source software products, including:\nProxmox Virtual Environment (PVE), which offers compute, network, and storage in a single solution. Proxmox Backup Servers (PBS), an open-source enterprise backup solution. Proxmox Mail Gateway (PMG), a comprehensive open-source email security platform. Articles are usually grouped into series.\n","date":"12 August 2025","externalUrl":null,"permalink":"/en/posts/proxmox/","section":"Posts","summary":"Learn to install, configure and operate Proxmox solutions in your IT infrastructure","title":"Proxmox","type":"posts"},{"content":"Here you will find a number of articles that relate to the installation, configuration and operation of Proxmox Virtual Environment clusters on dedicated servers. Articles are usually grouped into series.\n","date":"12 August 2025","externalUrl":null,"permalink":"/en/posts/proxmox/pve/","section":"Posts","summary":"Learn to install, configure and operate Proxmox clusters using dedicated servers","title":"PVE","type":"posts"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/categories/virtualisation/","section":"Categories","summary":"","title":"Virtualisation","type":"categories"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/vm/","section":"Tags","summary":"","title":"Vm","type":"tags"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/xfs/","section":"Tags","summary":"","title":"Xfs","type":"tags"},{"content":"","date":"12 August 2025","externalUrl":null,"permalink":"/en/tags/zfs/","section":"Tags","summary":"","title":"Zfs","type":"tags"},{"content":"","date":"2025年08月12日","externalUrl":null,"permalink":"/categories/%E8%99%9A%E6%8B%9F%E5%8C%96/","section":"Categories","summary":"","title":"虚拟化","type":"categories"},{"content":"","date":"3 August 2025","externalUrl":null,"permalink":"/en/tags/ansible/","section":"Tags","summary":"","title":"Ansible","type":"tags"},{"content":"","date":"3 August 2025","externalUrl":null,"permalink":"/en/tags/cloud-init/","section":"Tags","summary":"","title":"Cloud-Init","type":"tags"},{"content":"","date":"2 June 2025","externalUrl":"https://calabruix.es/downloads/cv/jaume-sabater-november-2026.pdf","permalink":"/en/posts/resume/","section":"Posts","summary":"Available online on this website, made with rendercv, it includes my education, work experience, skills, and more.","title":"Curriculum vitae","type":"posts"},{"content":"","date":"2 June 2025","externalUrl":null,"permalink":"/en/tags/resume/","section":"Tags","summary":"","title":"Resume","type":"tags"},{"content":"","date":"24 September 2024","externalUrl":null,"permalink":"/en/tags/promtail/","section":"Tags","summary":"","title":"Promtail","type":"tags"},{"content":"","date":"5 September 2024","externalUrl":null,"permalink":"/en/tags/blowfish/","section":"Tags","summary":"","title":"Blowfish","type":"tags"},{"content":"","date":"5 September 2024","externalUrl":null,"permalink":"/en/categories/frameworks/","section":"Categories","summary":"","title":"Frameworks","type":"categories"},{"content":"","date":"5 September 2024","externalUrl":null,"permalink":"/en/tags/hugo/","section":"Tags","summary":"","title":"Hugo","type":"tags"},{"content":"","date":"2024年09月05日","externalUrl":null,"permalink":"/categories/%E6%A1%86%E6%9E%B6/","section":"Categories","summary":"","title":"框架","type":"categories"},{"content":"","date":"1 August 2023","externalUrl":null,"permalink":"/en/series/pve7/","section":"Series","summary":"","title":"PVE7","type":"series"},{"content":"This series of articles will guide you through the process of setting up a basic Proxmox VE cluster, from the initial planning stages to the final configuration and management of virtual machines and containers. The necessary dedicated servers will be hosted at Hetzner. It is an entry-level proposal aimed at companies or individuals that want to self-host the software required to run their operations.\n","date":"1 August 2023","externalUrl":null,"permalink":"/en/posts/proxmox/pve/basic/","section":"Posts","summary":"Plan, install and configure Proxmox VE clusters using dedicated servers","title":"Your first Proxmox cluster at Hetzner","type":"posts"},{"content":"Here you will find a number of articles that relate to the installation, configuration and operation of Ansible, the open source IT automation engine.\nAnsible is a suite of software tools that enables infrastructure as code, including software provisioning, configuration management, and application deployment functionality.\nArticles are usually grouped into series.\n","externalUrl":null,"permalink":"/en/posts/ansible/","section":"Posts","summary":"Posts related to the open-source suite of software tools that enable infrastructure as code","title":"Ansible","type":"posts"},{"content":"","externalUrl":null,"permalink":"/en/categories/automation/","section":"Categories","summary":"","title":"Automation","type":"categories"},{"content":"","externalUrl":null,"permalink":"/categories/%E8%87%AA%E5%8A%A8%E5%8C%96/","section":"Categories","summary":"","title":"自动化","type":"categories"}]