How to offline a freenas 11.2 boot drive, ie. /dev/ada0 ?

fds09w4jih4r

Dabbler
Joined
Apr 4, 2019
Messages
44
I can't see to find this in the GUI... Is there any way to offline one of our two boot drive since its failing? We have /dev/ada0 and /dev/ada1 and one is failing. Before removal, I'd like to offline it. My other main storage drives are all in the pool and labeled with /dev/da0, etc...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Use the CLI and: zpool offline freenas-boot ada0p2; zpool detach freenas-boot ada0p2
After replacing and making sure the remaining ada1 is still ada1 and the new one ada0: gpart backup ada1 | gpart restore ada0; zpool attach freenas-boot ada1p2 ada0p2

HTH,
Patrick
 

fds09w4jih4r

Dabbler
Joined
Apr 4, 2019
Messages
44
Use the CLI and: zpool offline freenas-boot ada0p2; zpool detach freenas-boot ada0p2
After replacing and making sure the remaining ada1 is still ada1 and the new one ada0: gpart backup ada1 | gpart restore ada0; zpool attach freenas-boot ada1p2 ada0p2

HTH,
Patrick

So after swapping the good drive in, I have this, but I didn't run any commands.. I had to power down the server due to this case being an internal drive:

Code:
root@n32c01nas050:~ # zpool status
  pool: freenas-boot
state: ONLINE
  scan: scrub repaired 316K in 0 days 00:00:08 with 0 errors on Wed Feb  5 03:45:08 2020
config:

    NAME        STATE     READ WRITE CKSUM
    freenas-boot  ONLINE       0     0     0
      ada1p2    ONLINE       0     0     0

errors: No known data errors


Am I good or do I need some action?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You are good but not redundant again, yet.

Use grep ada0 /var/run/dmesg.boot to check if the replacement disk is indeed ada0, then run the second set of commands in my previous post. Given that your replacement disk contains no data/partitions.

If it does, nothing bad will happen, but you will get an error message for the gpart restore.
You can then use gpart restore -F, but make sure not to confuse source and destination since that will wipe the drive unconditionally.

Finally you will need to copy the boot partition: dd if=/dev/ada1p1 of=/dev/ada0p1

Done.
Patrick
 

fds09w4jih4r

Dabbler
Joined
Apr 4, 2019
Messages
44
You are good but not redundant again, yet.

Use grep ada0 /var/run/dmesg.boot to check if the replacement disk is indeed ada0, then run the second set of commands in my previous post. Given that your replacement disk contains no data/partitions.

If it does, nothing bad will happen, but you will get an error message for the gpart restore.
You can then use gpart restore -F, but make sure not to confuse source and destination since that will wipe the drive unconditionally.

Finally you will need to copy the boot partition: dd if=/dev/ada1p1 of=/dev/ada0p1

Done.
Patrick

I got this after your first set of commands:

Code:
root@n32c01nas050:~ # gpart backup ada1 | gpart restore ada0; zpool attach freenas-boot ada1p2 ada0p2
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'freenas-boot', you may need to update
boot code on newly attached disk 'ada0p2'.

Assuming you use GPT partitioning and 'da0' is your new boot disk
you may use the following command:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0


I did run your DD command to sync that over.. I've also run what they suggested.. but maybe thats the same you had me do with DD ?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Depends. If you boot via UEFI the suggested command destroyed the EFI boot partition. So you would need to redo mine. If you legacy boot, then my command and the suggested one do essentially the same.

You can check with gpart show ada0; gpart show ada1
If the first partitions are of type freebsd-boot, it's legacy and the suggested command is ok. If the first partitions are of type efi, then please redo mine.

Patrick
 

fds09w4jih4r

Dabbler
Joined
Apr 4, 2019
Messages
44
Depends. If you boot via UEFI the suggested command destroyed the EFI boot partition. So you would need to redo mine. If you legacy boot, then my command and the suggested one do essentially the same.

You can check with gpart show ada0; gpart show ada1
If the first partitions are of type freebsd-boot, it's legacy and the suggested command is ok. If the first partitions are of type efi, then please redo mine.

Patrick

Cool, thanks for the tip! I'll check over the whole thing to confirm.. We've been doing UEFI booting on the newer units, but this is an older one.. I'll have to check it..
 
Top