depenguin-me / depenguin-run

Installer script for mfsBSD image to install FreeBSD 14.0 with zfs-on-root using qemu
MIT License
16 stars 7 forks source link

Improved solution for supporting 4 disks #71

Closed bretton closed 7 months ago

bretton commented 8 months ago

The disk check logic has been tested on a few systems and works to identify nvme or sata disks.

I don't have a 4 disk instance yet, however the file is available for testing at https://depenguin.me/qa.sh

testing required before merge.

https://github.com/depenguin-me/depenguin-run/issues/60 applies

bretton commented 8 months ago

Not sure what I'm doing wrong here, qemu not liking it, perhaps the cdrom needs to be virtual device or something?

Searching sd[abcd] and nvme
Detected drives: sda
sdb
sdc
sdd
Adding SATA drives...
Adding SATA drive: sda
Adding SATA drive: sdb
Adding SATA drive: sdc
Adding SATA drive: sdd
Configured 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 
INFO: /dev/kvm exists
KVM acceleration can be used
Starting qemu...
qemu-system-x86_64: -cdrom /tmp/depenguinme/9d3d69bd6e2e6411bcc36089499601718eba180b2e36e90c07f325b48a0e6c58.iso: drive with bus=1, unit=0 (index=2) exists
Terminated
bretton commented 8 months ago

it works to get mfsbsd up, and appeared to install FBSD14, but server hasn't booted. getting remote hands attached.

update: install worked fine, I had the incorrect interface name in ansible script so no network came up

bretton commented 8 months ago

Install success with correct NIC and using depenguinme-ansible script with 4 disks configured in inventory and qa.sh as source

root@server1:~ # zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot   880G  1.37G   879G        -         -     0%     0%  1.00x    ONLINE  -

root@server1:~ # zpool status
  pool: zroot
 state: ONLINE
config:

    NAME        STATE     READ WRITE CKSUM
    zroot       ONLINE       0     0     0
      mirror-0  ONLINE       0     0     0
        ada0p4  ONLINE       0     0     0
        ada1p4  ONLINE       0     0     0
        ada2p4  ONLINE       0     0     0
        ada3p4  ONLINE       0     0     0

errors: No known data errors

I wanted a different setup with the disks, two mirrored and two mirrored, raid10 type setup. But this is fine, will try with raidz too.

grembo commented 8 months ago

it works to get mfsbsd up, and appeared to install FBSD14, but server hasn't booted. getting remote hands attached.

update: install worked fine, I had the incorrect interface name in ansible script so no network came up

Wanted to tell you this morning (you already figured it out it seems), that is is most likely fstab or em0 vs igb0 or similar issue. Great work!

bretton commented 8 months ago

Wanted to tell you this morning (you already figured it out it seems), that is is most likely fstab or em0 vs igb0 or similar issue. Great work!

Thanks. Can confirm passing in raid10 works for unattended bsdinstall process, else raidz1.

root@server1:~ # zpool status
  pool: zroot
 state: ONLINE
config:

    NAME        STATE     READ WRITE CKSUM
    zroot       ONLINE       0     0     0
      mirror-0  ONLINE       0     0     0
        ada0p4  ONLINE       0     0     0
        ada1p4  ONLINE       0     0     0
      mirror-1  ONLINE       0     0     0
        ada2p4  ONLINE       0     0     0
        ada3p4  ONLINE       0     0     0

errors: No known data errors

Updated docs and in ansible repo to be clearer about interface names or zpool parameters. Will do a final test and then can see about merge.

Using script for recovery purposes is more practical for wider number of servers now, can reassemble existing pool, send it somewhere or other recovery options.

bretton commented 8 months ago

All looks good with latest test, ansible script too.

if someone else wants to test:

wget https://depenguin.me/qa.sh
chmod +x qa.sh
./qa.sh <url-to-pubkey>

otherwise code review

utrenkner commented 7 months ago

Just wanted to say: It worked for me on a Hetzner server rented through their server auction.

System:

I wanted to install FreeBSD on the two SSDs as mirrors (v0.0.13 only offered me the first two, sda and sdb as ada0 and ada1). With v0.0.14 this was easily achieved with

conf_disks="ada1 ada2"

Many thanks for your work on this excellent script!

bretton commented 7 months ago

I'll take this live for now, can improve code in updates

grembo commented 7 months ago

@bretton Sorry, I didn't have the cycles to test or review.

Question: Any specific reason, why disks isn't created as a bash array but instead concatenated and converted?

bretton commented 7 months ago

Question: Any specific reason, why disks isn't created as a bash array but instead concatenated and converted?

I couldn't get add_drive_to_disks() to work, qemu gave errors and didn't see the extra items, but it worked if I made a string first then turned that into array

the if/else after calling add_drive_to_disks can also be simplified into single statement I think