OPNsense Forum

English Forums => Hardware and Performance => Topic started by: greghi on October 24, 2021, 09:49:20 pm

Title: how to upgrade drives after install?
Post by: greghi on October 24, 2021, 09:49:20 pm
ok I installed opnsense with dual drive zfs mirror.  If I have a drive failure what is the correct process to replace/upgrade the drive?  I may want to swap out the disks for SSD's but also wanted to know how to handle a drive failure as well.   Also how can i tell if the mirror is in good shape and working correctly?
Thx Greg
Title: Re: how to upgrade drives after install?
Post by: Patrick M. Hausen on October 25, 2021, 12:12:42 am
You need to use the command line. You did not give much information about your hardware, but that can easily be amended. Please enable SSH including logon as root in the UI, use an SSH client of your choice and matching your desktop OS, then post the output of these two commands:
Code: [Select]
zpool status
gpart show

We can proceed with what you will have to do to replace your disk, then.

Kind regards
Patrick
Title: Re: how to upgrade drives after install?
Post by: greghi on October 25, 2021, 03:22:11 pm
ok here is the pic of the output, attached
Title: Re: how to upgrade drives after install?
Post by: Patrick M. Hausen on October 25, 2021, 03:31:25 pm
Please don't post images. Copy and paste the text and include it in a "code" block. Thank you.
Title: Re: how to upgrade drives after install?
Post by: greghi on October 25, 2021, 10:56:11 pm
ok how do i copy ans paste text output? and what is meant by "code block"?
Title: Re: how to upgrade drives after install?
Post by: Patrick M. Hausen on October 25, 2021, 11:17:53 pm
You logon to your OPNsense via SSH, enter the commands, then in your SSH/Terminal client mark and copy the text.
In Mac OS ssh is builtin, in Windows Putty seems to be a frequently used SSH client, Linux/BSD/... again builtin.

If you post a photo, I cannot copy and paste from it. Which is essential to help you making sure I get the correct devices etc. Of course I can read and re-type, but - sorry, you get free support, I refuse to re-type from screen shots. Please post text that can be copied and pasted. Thank you.

Code block means something like this:
Code: [Select]
This
is
a
code
block

It's the '#" symbol in the formatting palette when you write a post.
Title: Re: how to upgrade drives after install?
Post by: cookiemonster on October 27, 2021, 10:03:16 pm
In the meantime it would be useful to see some error detail somewhere, maybe dmesg.
The pool appears healthy.
Title: Re: how to upgrade drives after install?
Post by: greghi on October 28, 2021, 02:20:58 am
#root@OPNsense:~ # zpool status
  pool: zroot
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p3  ONLINE       0     0     0
            ada1p3  ONLINE       0     0     0

errors: No known data errors
root@OPNsense:~ # gpart show
=>       40  976773088  ada0  GPT  (466G)
         40       1024     1  freebsd-boot  (512K)
       1064        984        - free -  (492K)
       2048    4194304     2  freebsd-swap  (2.0G)
    4196352  972576768     3  freebsd-zfs  (464G)
  976773120          8        - free -  (4.0K)

=>       40  976773088  ada1  GPT  (466G)
         40       1024     1  freebsd-boot  (512K)
       1064        984        - free -  (492K)
       2048    4194304     2  freebsd-swap  (2.0G)
    4196352  972576768     3  freebsd-zfs  (464G)
  976773120          8        - free -  (4.0K)

=>    32  524256  da0  MBR  (256M)
      32      31       - free -  (16K)
      63  514017    1  fat32lba  (251M)
  514080   10208       - free -  (5.0M)
Title: Re: how to upgrade drives after install?
Post by: greghi on October 28, 2021, 02:24:20 am
not sure if I did the post right but hopefully this works.  my hardware setup is a HP microserver G8 16 gb ram, 2 500 gb sata drives mirrored. Drives are set in basic sata setup and the internal raid card is turned off. But I want to change these drives out for 500gb SSD drives and was generally wondering how to recover from  drive failure. I am a windows guy so command line is newer to me.  Greg
Title: Re: how to upgrade drives after install?
Post by: Patrick M. Hausen on October 28, 2021, 10:33:21 am
To replace e.g. ada1 with one of your new SSDs you do this:
Code: [Select]
zpool detach zroot ada1p3
# shutdown system
# replace disk ada1 with ssd
# boot system
gpart backup ada0 | gpart restore -F ada1
zpool attach zroot ada0p3 ada1p3
dd if=/dev/ada0p1 of=/dev/ada1p1

To do the same for ada0 you need to make sure that the system is capable of booting from the second disk. If that is not the case, you could watch for the zpool to "resilver" - use
Code: [Select]
zpool status to do that.
Then shutdown again, connect the SSD that is now ada1 to the connector of the HDD ada0 and replace the second HDD with an SSD. Then just repeat the above process, because the new SSD will again be "ada1".

If you don't want to do the connector swapping thing, and the system can boot from ada1, you need to reverse ada1 and ada0 in the commands above, of course.

HTH,
Patrick
Title: Re: how to upgrade drives after install?
Post by: greghi on October 28, 2021, 12:54:28 pm
Thank you! very helpful. Ill give this a try over the weekend
Title: Re: how to upgrade drives after install?
Post by: cookiemonster on August 06, 2022, 03:30:53 am
Careful, not exactly applicable directly to an apple Mac. This procedure is for the user who had already installed the OS on a zfs mirror (think of it as a software raid, two disks with the same contents in sync).