diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-18 14:38:31 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-18 14:38:31 -0600 |
| commit | 2c563706150794206a586d9f670d1b4950698e52 (patch) | |
| tree | 10a08d2d76d7f98c380cfafe404a985934048a02 | |
| parent | adcf0be760d6b28a64203d37a63e10823b1b471e (diff) | |
| download | archangel-2c563706150794206a586d9f670d1b4950698e52.tar.gz archangel-2c563706150794206a586d9f670d1b4950698e52.zip | |
Add rescue tools and ZFS rescue guide
- Add tealdeer, pv, rsync, mbuffer, lsof to ISO packages
- Pre-populate tealdeer cache during build for offline tldr
- Create RESCUE-GUIDE.txt with comprehensive ZFS recovery section
- Copy rescue guide to /root/ on ISO
| -rwxr-xr-x | build.sh | 26 | ||||
| -rw-r--r-- | custom/RESCUE-GUIDE.txt | 230 |
2 files changed, 256 insertions, 0 deletions
@@ -128,6 +128,14 @@ fzf # For installation scripts dialog + +# Rescue/Recovery tools +tealdeer +pv +rsync +mbuffer +lsof + EOF # Get kernel version for ISO naming @@ -195,6 +203,10 @@ cp "$CUSTOM_DIR/zfs-snap-prune" "$PROFILE_DIR/airootfs/usr/local/bin/" mkdir -p "$PROFILE_DIR/airootfs/root" cp "$CUSTOM_DIR/install-archzfs.conf.example" "$PROFILE_DIR/airootfs/root/" +# Copy rescue guide +info "Copying rescue guide..." +cp "$CUSTOM_DIR/RESCUE-GUIDE.txt" "$PROFILE_DIR/airootfs/root/" + # Set permissions in profiledef.sh info "Setting file permissions..." if grep -q "file_permissions=" "$PROFILE_DIR/profiledef.sh"; then @@ -226,6 +238,20 @@ if [[ -d /home/cjennings/code/archsetup ]]; then rm -rf "$PROFILE_DIR/airootfs/code/archsetup/.claude" fi +# Pre-populate tealdeer (tldr) cache for offline use +info "Pre-populating tealdeer cache..." +if command -v tldr &>/dev/null; then + tldr --update 2>/dev/null || true + if [[ -d "$HOME/.cache/tealdeer" ]]; then + mkdir -p "$PROFILE_DIR/airootfs/root/.cache" + cp -r "$HOME/.cache/tealdeer" "$PROFILE_DIR/airootfs/root/.cache/" + info "Tealdeer cache copied (~27MB)" + fi +else + warn "tealdeer not installed on build host, skipping cache pre-population" + warn "Install with: pacman -S tealdeer && tldr --update" +fi + # Ensure scripts are executable in the profile chmod +x "$PROFILE_DIR/airootfs/usr/local/bin/"* diff --git a/custom/RESCUE-GUIDE.txt b/custom/RESCUE-GUIDE.txt new file mode 100644 index 0000000..2ffa92e --- /dev/null +++ b/custom/RESCUE-GUIDE.txt @@ -0,0 +1,230 @@ +================================================================================ + ARCHZFS RESCUE GUIDE +================================================================================ + +This guide covers common rescue and recovery scenarios. For quick command +reference, use: tldr <command> + +Table of Contents: + 1. ZFS Recovery + 2. Data Recovery + 3. Boot Repair + 4. Windows Recovery + 5. Hardware Diagnostics + 6. Disk Operations + 7. Network Troubleshooting + +================================================================================ +1. ZFS RECOVERY +================================================================================ + +QUICK REFERENCE +--------------- + tldr zfs # ZFS filesystem commands + tldr zpool # ZFS pool commands + man zfs # Full ZFS manual + man zpool # Full zpool manual + +SCENARIO: Import a pool from another system +------------------------------------------- +List pools available for import: + + zpool import + +Import a specific pool: + + zpool import poolname + +If the pool was not cleanly exported (e.g., system crash): + + zpool import -f poolname + +Import with a different name (to avoid conflicts): + + zpool import oldname newname + + +SCENARIO: Pool won't import - "pool may be in use" +-------------------------------------------------- +Force import (use when you know it's safe): + + zpool import -f poolname + +If that fails, try recovery mode: + + zpool import -F poolname + +Last resort - import read-only to recover data: + + zpool import -o readonly=on poolname + + +SCENARIO: Check pool health and repair +-------------------------------------- +Check pool status: + + zpool status poolname + +Start a scrub (checks all data, can take hours): + + zpool scrub poolname + +Check scrub progress: + + zpool status poolname + +Clear transient errors after fixing hardware: + + zpool clear poolname + + +SCENARIO: Recover from snapshot / Rollback +------------------------------------------ +List all snapshots: + + zfs list -t snapshot + +Rollback to a snapshot (destroys changes since snapshot): + + zfs rollback poolname/dataset@snapshot + +For snapshots with intermediate snapshots, use -r: + + zfs rollback -r poolname/dataset@snapshot + + +SCENARIO: Copy data from ZFS pool +--------------------------------- +Mount datasets if not auto-mounted: + + zfs mount -a + +Or mount specific dataset: + + zfs set mountpoint=/mnt/recovery poolname/dataset + zfs mount poolname/dataset + +Copy with rsync (preserves permissions, shows progress): + + rsync -avP --progress /mnt/recovery/ /destination/ + + +SCENARIO: Send/Receive snapshots (backup/migrate) +------------------------------------------------- +Create a snapshot first: + + zfs snapshot poolname/dataset@backup + +Send to a file (local backup): + + zfs send poolname/dataset@backup > /path/to/backup.zfs + +Send with progress indicator: + + zfs send poolname/dataset@backup | pv > /path/to/backup.zfs + +Send to another pool locally: + + zfs send poolname/dataset@backup | zfs recv newpool/dataset + +Send to remote system over SSH: + + zfs send poolname/dataset@backup | ssh user@remote zfs recv pool/dataset + +With progress and buffering for network transfers: + + zfs send poolname/dataset@backup | pv | mbuffer -s 128k -m 1G | \ + ssh user@remote "mbuffer -s 128k -m 1G | zfs recv pool/dataset" + + +SCENARIO: Encrypted pool - unlock and mount +------------------------------------------- +Load the encryption key (will prompt for passphrase): + + zfs load-key poolname + +Or for all encrypted datasets: + + zfs load-key -a + +Then mount: + + zfs mount -a + + +SCENARIO: Replace failed drive in mirror/raidz +---------------------------------------------- +Check which drive failed: + + zpool status poolname + +Replace the drive (assuming /dev/sdc is new drive): + + zpool replace poolname /dev/old-drive /dev/sdc + +Monitor resilver progress: + + zpool status poolname + + +SCENARIO: See what's using a dataset (before unmount) +----------------------------------------------------- +Check what processes have files open: + + lsof /mountpoint + +Or for all ZFS mounts: + + lsof | grep poolname + + +USEFUL ZFS COMMANDS +------------------- + zpool status # Pool health overview + zpool list # Pool capacity + zpool history poolname # Command history + zfs list # All datasets + zfs list -t snapshot # All snapshots + zfs get all poolname # All properties + zdb -l /dev/sdX # Low-level pool label info + + +================================================================================ +2. DATA RECOVERY +================================================================================ + +[To be added] + +================================================================================ +3. BOOT REPAIR +================================================================================ + +[To be added] + +================================================================================ +4. WINDOWS RECOVERY +================================================================================ + +[To be added] + +================================================================================ +5. HARDWARE DIAGNOSTICS +================================================================================ + +[To be added] + +================================================================================ +6. DISK OPERATIONS +================================================================================ + +[To be added] + +================================================================================ +7. NETWORK TROUBLESHOOTING +================================================================================ + +[To be added] + +================================================================================ + END OF GUIDE +================================================================================ |
