Closed nkfilis closed 1 month ago
Hi @nkfilis - you can edit the custom bsdinstall script, see issue 49
(see also https://depenguin.me/bsdinstall.html )
edit: looks like that was from a test version, which might have been lost with follow-up commits. There may be some work involved still, sorry!
We need to solve:
if=virtio
? qemu-system-x86_64 binary: 4 drives
disks=(
-drive "file=/dev/sda,format=raw" \
-drive "file=/dev/sdb,format=raw" \
-drive "file=/dev/sdc,format=raw" \
-drive "file=/dev/sdd,format=raw" \
)
qemu-system-x86_64 binary: 6 drives
disks=(
-drive "file=/dev/sda,format=raw" \
-drive "file=/dev/sdb,format=raw" \
-drive "file=/dev/sdc,format=raw" \
-drive "file=/dev/sdd,format=raw" \
-drive "file=/dev/sde,if=virtio,format=raw" \
-drive "file=/dev/sdf,if=virtio,format=raw" \
)
I don't have capacity currently, leaving as note for now.
I have a test script for 4 drives from https://github.com/bretton/mfsbsd-13.1-script/blob/main/depenguinme.sh
wget https://depenguin.me/specialtest.sh
chmod +x specialtest.sh
./specialtest.sh [ -d ] [ -r ram ] [ -m (url of own mfsbsd image) ] authorized_keys ...
untested, no machine to test it on yet
to factor in somehow
# get list of sd devices
ls -l /dev /dev/mapper |grep '^b' |grep sd |sed 's/[0-9]//g' |awk -F ": " '{print $2}' |sort |uniq
# get list nvme
ls -l /dev /dev/mapper |grep '^b' |grep nvme |sed 's/[0-9]//g' |awk -F ": " '{print $2}' |sort |uniq
I revived the 4 disk solution and put in a branch here
It's available for testing as follows:
wget https://depenguin.me/fourdisktest.sh \
&& chmod +x fourdisktest.sh \
&& ./fourdisktest.sh https://example.org/mypubkey
I don't have a 4 disk host yet to experiment with.
The only 4 drive server at Hetzner currently is the SX64 with 4 x 16TB SATA disks at €150 cost for one month to test.
The other SX servers have 2 x SSD that can be installed to, and 10x16TB or 14x16TB drives configured post-install.
There are servers in server auction with 4 drives, and other providers might have 4 drive systems?
Keen to test this, however the bare metal landscape seems to be 2 disk servers?
Low priority for now.
# get list of sd devices ls -l /dev /dev/mapper |grep '^b' |grep sd |sed 's/[0-9]//g' |awk -F ": " '{print $2}' |sort |uniq # get list nvme ls -l /dev /dev/mapper |grep '^b' |grep nvme |sed 's/[0-9]//g' |awk -F ": " '{print $2}' |sort |uniq
There is also this to get all type 8 devices (misses nvme?)
lsblk -o NAME -n --scsi -I 8
The function find_suitable_disks at https://github.com/terem42/zfs-hetzner-vm/blob/master/hetzner-ubuntu22-zfs-setup.sh might be another way to get a list of suitable disks in linux for mounting in to mfsbsd
function find_suitable_disks {
# shellcheck disable=SC2119
print_step_info_header
udevadm trigger
# shellcheck disable=SC2012
ls -l /dev/disk/by-id | tail -n +2 | perl -lane 'print "@F[8..10]"' > "$c_disks_log"
local candidate_disk_ids
local mounted_devices
candidate_disk_ids=$(find /dev/disk/by-id -regextype awk -regex '.+/(ata|nvme|scsi)-.+' -not -regex '.+-part[0-9]+$' | sort)
mounted_devices="$(df | awk 'BEGIN {getline} {print $1}' | xargs -n 1 lsblk -no pkname 2> /dev/null | sort -u || true)"
while read -r disk_id || [[ -n "$disk_id" ]]; do
local device_info
device_info="$(udevadm info --query=property "$(readlink -f "$disk_id")")"
block_device_basename="$(basename "$(readlink -f "$disk_id")")"
if ! grep -q '^ID_TYPE=cd$' <<< "$device_info"; then
if ! grep -q "^$block_device_basename\$" <<< "$mounted_devices"; then
v_suitable_disks+=("$disk_id")
fi
fi
cat >> "$c_disks_log" << LOG
## DEVICE: $disk_id ################################
$(udevadm info --query=property "$(readlink -f "$disk_id")")
LOG
done < <(echo -n "$candidate_disk_ids")
if [[ ${#v_suitable_disks[@]} -eq 0 ]]; then
local dialog_message='No suitable disks have been found!
If you think this is a bug, please open an issue on https://github.com/terem42/zfs-hetzner-vm/issues, and attach the file `'"$c_disks_log"'`.
'
dialog --msgbox "$dialog_message" 30 100
exit 1
fi
print_variables v_suitable_disks
}
function select_disks {
# shellcheck disable=SC2119
print_step_info_header
while true; do
local menu_entries_option=()
if [[ ${#v_suitable_disks[@]} -eq 1 ]]; then
local disk_selection_status=ON
else
local disk_selection_status=OFF
fi
for disk_id in "${v_suitable_disks[@]}"; do
menu_entries_option+=("$disk_id" "($block_device_basename)" "$disk_selection_status")
done
local dialog_message="Select the ZFS devices (multiple selections will be in mirror).
Devices with mounted partitions, cdroms, and removable devices are not displayed!
"
mapfile -t v_selected_disks < <(dialog --separate-output --checklist "$dialog_message" 30 100 $((${#menu_entries_option[@]} / 3)) "${menu_entries_option[@]}" 3>&1 1>&2 2>&3)
if [[ ${#v_selected_disks[@]} -gt 0 ]]; then
break
fi
done
print_variables v_selected_disks
}
This is solved for 4 drive systems
There are some machines that come with 4 or 6 drives and it would be nice to use them as a raidz(2) pool, but the script currently only supports <=2 drive machines, right?