feat: add script to prepare ZFS datasets and create a ZFS pool
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
Some checks failed
Nix Format Check / check-format (push) Failing after 37s
This commit is contained in:
parent
9f8cca411a
commit
2872993628
43
prepare-zfs-datasets.sh
Executable file
43
prepare-zfs-datasets.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Prompt user for device
|
||||||
|
echo "Enter the device to use for the ZFS pool (e.g., /dev/sdb):"
|
||||||
|
read device
|
||||||
|
|
||||||
|
# Ask for confirmation, since this script will destroy all data on the device
|
||||||
|
echo "This script will destroy all data on $device. Are you sure you want to continue? (y/n)"
|
||||||
|
read confirm
|
||||||
|
|
||||||
|
if [ "$confirm" != "y" ]; then
|
||||||
|
echo "Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create ZFS pool
|
||||||
|
sudo zpool create -f datapool "$device"
|
||||||
|
|
||||||
|
# Create datasets with mountpoint=legacy
|
||||||
|
datasets=(
|
||||||
|
isos
|
||||||
|
vms
|
||||||
|
ai
|
||||||
|
downloads
|
||||||
|
services
|
||||||
|
audiobooks
|
||||||
|
music
|
||||||
|
photos
|
||||||
|
movies
|
||||||
|
tv_shows
|
||||||
|
# old_backups
|
||||||
|
)
|
||||||
|
|
||||||
|
for dataset in "${datasets[@]}"; do
|
||||||
|
sudo zfs create -o mountpoint=legacy datapool/"$dataset"
|
||||||
|
done
|
||||||
|
|
||||||
|
df -h
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "ZFS datasets created successfully."
|
||||||
|
echo "You can now run \`dotf update\` and it should start mounting the datasets."
|
||||||
|
echo ""
|
Loading…
x
Reference in New Issue
Block a user