Solved How to attach new device to existed booting zroot?

Hello.

I have this:
Code:
# zpool status -v
  pool: zroot
 state: ONLINE
config:

NAME        STATE     READ WRITE CKSUM
zroot       ONLINE       0     0     0
  ada1p4    ONLINE       0     0     0

errors: No known data errors
#
Code:
# ls /dev/ada*
/dev/ada0       /dev/ada1       /dev/ada1p1     /dev/ada1p2     /dev/ada1p3     /dev/ada1p4
#
I want to attach a new device to existing and create a mirroring pool. How can I right do it?
I understand that I can attch /dev/ada0 to /dev/ada1p4, but how can I make the entire disk mirrored?

https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror
This way for new devices. I have FreeBSD on /dev/ada1. Probably, the right way is to install a new system on fresh devices and move data to it. Thank you.
 
I understand that I can attch /dev/ada0 to /dev/ada1p4, but how can I make the entire disk mirrored?
No, you mirror the ZFS partition, not the entire disk. If you're going to mirror two disks, you also want to add the boot partitions, if your ada1 drive dies, how is the system supposed to boot if ada0 doesn't have a boot partition (efi and/or freebsd-boot)?

ZFS mirroring only works for ZFS, that should be obvious.
 
No, you mirror the ZFS partition, not the entire disk. If you're going to mirror two disks, you also want to add the boot partitions, if your ada1 drive dies, how is the system supposed to boot if ada0 doesn't have a boot partition (efi and/or freebsd-boot)?

ZFS mirroring only works for ZFS, that should be obvious.
Yes, the system is booting with ada0 and doesn't without it.
 
Code:
root@cpkio:/home/sailorsamoor # zpool status -v
  pool: zroot
 state: ONLINE
  scan: resilvered 816K in 00:00:00 with 0 errors on Thu Aug  7 14:50:27 2025
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

errors: No known data errors
root@cpkio:/home/sailorsamoor # gpart show
=>       40  500118112  ada0  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528    4194304     3  freebsd-swap  (2.0G)
    4728832  495388672     4  freebsd-zfs  (236G)
  500117504        648        - free -  (324K)

=>       40  500118112  ada1  GPT  (238G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528    4194304     3  freebsd-swap  (2.0G)
    4728832  495388672     4  freebsd-zfs  (236G)
  500117504        648        - free -  (324K)

root@cpkio:/home/sailorsamoor #

I think I need to write the bootloader to the ada1 boot sector... Ho can I do it? I'll do a new post (one question - one post, thanks).
 
Maybe you could check the efi partition of ada1 first:
Code:
mkdir /mnt/newefi
mount -t msdos /dev/ada1p1 /mnt/newefi
ls /mnt/newefi

Are there any directories in it? The ideal layout should be like:
/mnt/newefi/
efi/
freebsd/loader.efi
boot/bootx64.efi
 
Back
Top