OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: Luc3k on February 01, 2021, 12:01:35 pm

Title: Instalation with raid 1
Post by: Luc3k on February 01, 2021, 12:01:35 pm
I've installed OPNsense with two disks which are working with raid 1 (GEOM Mirror). One of disks is almost new (hs 5000 hours of work), but second has 49000 hours of work. I'm planing to replace the second drive with a new one.
Can I ask for little help/instructions/tutorial how replace old disk and rebuild disk array (raid 1)?
Title: Re: Instalation with raid 1
Post by: Patrick M. Hausen on February 01, 2021, 12:54:36 pm
Please post the output of
Code: [Select]
gmirror status
Title: Re: Instalation with raid 1
Post by: Luc3k on February 01, 2021, 09:09:00 pm
Code: [Select]
root@Lan14:~ # gmirror status
           Name    Status  Components
mirror/OPNsense  COMPLETE  ada0 (ACTIVE)
                           ada1 (ACTIVE)

Code: [Select]
root@Lan14:~ # gmirror list
Geom name: OPNsense
State: COMPLETE
Components: 2
Balance: split
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 584546050
Type: AUTOMATIC
Providers:
1. Name: mirror/OPNsense
   Mediasize: 1000204885504 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r2w2e6
Consumers:
1. Name: ada0
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: DIRTY
   GenID: 0
   SyncID: 1
   ID: 2830495722
2. Name: ada1
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   State: ACTIVE
   Priority: 1
   Flags: DIRTY
   GenID: 0
   SyncID: 1
   ID: 4007642130
Title: Re: Instalation with raid 1
Post by: Patrick M. Hausen on February 01, 2021, 10:02:24 pm
So they are mirroring the whole disk. That makes replacement pretty easy.
Assuming the disk to be replaced is ada1 ...

gmirror remove OPNsense ada1

shutdown system, replace disk, boot again, assuming the new disk is ada1 again

gmirror insert OPNsense ada1


Depending on your system it might be necessary to enforce the new disk is ada1 by switching the cabling if necessary. Possibly the system won't boot if ada0 does not present a proper MBR or UEFI boot environment. So if the disk to be replaced is ada0 you might have to adapt a bit.
Title: Re: Instalation with raid 1
Post by: Luc3k on February 01, 2021, 10:47:00 pm
The disk I want to replace is ada1.
Should I install the boot manager on the ada1 disk after rebuilding?
Title: Re: Instalation with raid 1
Post by: Patrick M. Hausen on February 01, 2021, 11:24:42 pm
The procedure will re-mirror the entire content of ada0 onto ada1. Including the boot manager etc. That's why I said it's good OPNsense mirrors the entire disk.

There are other possible setups since GEOMs are stackable. So you could theoretically mirror individual partitions. But that's not the case here. Just go ahead.  ;)
Title: Re: Instalation with raid 1
Post by: Luc3k on February 02, 2021, 09:59:53 pm
Thank you for your help. Everything rebuilt well. Now I should disconnect one of the disks and check if everything starts up properly :-)