From df75eaa016d2aaacdf59a9cccad0cf09a869e45c Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 13 Mar 2024 12:37:24 +0100 Subject: [PATCH] chore: add comments and formatting --- .../tailscale.sh | 4 +++ zfs/create-ext4-raspiblitz-disk.md | 2 ++ zfs/create-raspiblitz-zfs-disk.md | 30 ++++++++++++++++++- zfs/restore-raspiblitz-zfs-disk.md | 3 ++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/raspiblitz-custom-install-scripts/tailscale.sh b/raspiblitz-custom-install-scripts/tailscale.sh index e9f9263..1964e55 100644 --- a/raspiblitz-custom-install-scripts/tailscale.sh +++ b/raspiblitz-custom-install-scripts/tailscale.sh @@ -1,5 +1,9 @@ #!/bin/bash +# once tailscale is installed and logged in use this to copy the config to the data disk: +# sudo cp -R /var/lib/tailscale /mnt/hdd/app-data/ + +# these commands can be put in the custom-installs.sh echo "# Install Tailscale" mv /var/lib/tailscale /var/lib/tailscale.backup curl -fsSL https://tailscale.com/install.sh | sh diff --git a/zfs/create-ext4-raspiblitz-disk.md b/zfs/create-ext4-raspiblitz-disk.md index 47c9ce8..db0e21d 100644 --- a/zfs/create-ext4-raspiblitz-disk.md +++ b/zfs/create-ext4-raspiblitz-disk.md @@ -1,6 +1,8 @@ ``` parted -s /dev/${hdd} mkpart primary ext4 1024KiB 100% mkfs.ext4 -F -L BLOCKCHAIN /dev/${hdd} +# for nvme +mkfs.ext4 -F -L BLOCKCHAIN /dev/${hdd}p1 tune2fs -c 1 /dev/${hdd} ``` diff --git a/zfs/create-raspiblitz-zfs-disk.md b/zfs/create-raspiblitz-zfs-disk.md index b27100f..73152ad 100644 --- a/zfs/create-raspiblitz-zfs-disk.md +++ b/zfs/create-raspiblitz-zfs-disk.md @@ -10,6 +10,7 @@ - [Mount to /mnt/hdd](#mount-to-mnthdd) - [manual Raspiblitz config with the zfs pool mounted](#manual-raspiblitz-config-with-the-zfs-pool-mounted) - [Attach a new disk to an existing pool](#attach-a-new-disk-to-an-existing-pool) +- [Replace a missing disk with a new disk](#replace-a-missing-disk-with-a-new-disk) - [ZFS encryption key operations](#zfs-encryption-key-operations) - [Temperature monitoring](#temperature-monitoring) - [Import an existing ZFS pool](#import-an-existing-zfs-pool) @@ -198,7 +199,7 @@ EXISTING_DISK= # choose the new disk id from: - # the tmlist of physical disks + # the list of physical disks lsblk --scsi # get the IDs ls -la /dev/disk/by-id @@ -211,6 +212,33 @@ zpool status ``` +## Replace a missing disk with a new disk + ``` + # choose the existing disk from: + zpool status + POOL_NAME= + EXISTING_DISK= + + # choose the new disk id from: + # the list of physical disks + lsblk --scsi + # get the IDs + ls -la /dev/disk/by-id + NEW_DISK=/dev/disk/by-id/ata- + + # Clear the partition table: + sgdisk --zap-all $NEW_DISK + + # Clean a disk which was previously used with zfs: + wipefs -a $NEW_DISK + + # overwrite with ext4 + mkfs.ext4 -F -L BLOCKCHAIN $NEW_DISK + + # replace + zpool replace -f $POOL_NAME $EXISTING_DISK $NEW_DISK + ``` + ## ZFS encryption key operations * ``` # backup the key diff --git a/zfs/restore-raspiblitz-zfs-disk.md b/zfs/restore-raspiblitz-zfs-disk.md index b83e1f9..75ec94b 100644 --- a/zfs/restore-raspiblitz-zfs-disk.md +++ b/zfs/restore-raspiblitz-zfs-disk.md @@ -21,6 +21,9 @@ ) | crontab -u admin - # list the active crontab for admin crontab -u admin -l + + # disable swapfile service + ``` ## Restore a Raspiblitz ZFS disk