Skip to the relevant sections if needed.
#!/bin/bash | |
# btrfs-undelete | |
# Copyright (C) 2013 Jörg Walter <[email protected]> | |
# This program is free software; you can redistribute it and/or modify it under | |
# the term of the GNU General Public License as published by the Free Software | |
# Foundation; either version 2 of the License, or any later version. | |
if [ ! -b "$1" -o -z "$2" -o -z "$3" ]; then | |
echo "Usage: $0 <dev> <file/dir> <dest>" 1>&2 | |
echo |
This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.
Description | Syntax |
---|---|
Get the length of a string | ${#VARNAME} |
Get a single character | ${VARNAME[index]} |
Excerpts from the Proxmox VE Administration Guide]
LVM normally allocates blocks when you create a volume. LVM thin pools instead allocates blocks when they are written. This behaviour is called thin-provisioning, because volumes can be much larger than physically available space.
8.10.2. Trim/Discard It is good practice to run fstrim (discard) regularly on VMs and containers. This releases data blocks that the filesystem isn’t using anymore. It reduces data usage and resource load. Most modern operating systems issue such discard commands to their disks regularly. You only need to ensure that the Virtual Machines enable the disk discard option.
Somehow my BTRFS file system became corrupted by what appears to be a single bit flip in a metadata field. Rather than copying all the data and reformatting the file system, which would have required another disk at least as large as the original, I decided to try to fix this manually, which appears to have worked. I've documented the procedure I've used here, in case I need it again or someone else runs into a similar issue and finds it useful.
The first thing you should do is run btrfs check
. For me this produced the following output:
Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p1
UUID: ec7afe1c-8478-450a-82fc-d17b32d8ca3d
;; nano-emacs.el --- NANO Emacs (minimal version) -*- lexical-binding: t -*- | |
;; Copyright (c) 2025 Nicolas P. Rougier | |
;; Released under the GNU General Public License 3.0 | |
;; Author: Nicolas P. Rougier <[email protected]> | |
;; URL: https://github.com/rougier/nano-emacs | |
;; This is NANO Emacs in 256 lines, without any dependency | |
;; Usage (command line): emacs -Q -l nano.el -[light|dark] |