没有记录,就没有发生。

0%

FreeBSD更换ZFS根池磁盘

原硬盘情况

[email protected]_FreeBSD:~ # gpart show ada0
=>       40  117231328  ada0  GPT  (56G)
         40     409600     1  efi  (200M)
     409640       1024     2  freebsd-boot  (512K)
     410664        984        - free -  (492K)
     411648   33554432     3  freebsd-swap  (16G)
   33966080   83263488     4  freebsd-zfs  (40G)
  117229568       1800        - free -  (900K)

[email protected]_FreeBSD:~ # zpool status zroot
  pool: zroot
 state: ONLINE
  scan: none requested
config:

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

errors: No known data errors

给新硬盘分区

1
2
3
4
5
6
7
8
9
10
11
# Create a fresh partition table
gpart destroy da0
gpart create -s gpt da0

# Create the bootcode partition for UEFI Boot
gpart add -a 4k -s 200M -t efi da0
gpart bootcode -p /boot/boot1.efifat -i 1 da0

# Create Partitions
gpart add -a 1m -s 16G -t freebsd-swap -l swap da0
gpart add -a 1m -t freebsd-zfs -l disk0 da0
[email protected]_FreeBSD:~ # gpart show da0
=>       40  250085296  da0  GPT  (119G)
         40     409600    1  efi  (200M)
     409640       2008       - free -  (1.0M)
     411648   33554432    2  freebsd-swap  (16G)
   33966080  216117248    3  freebsd-zfs  (103G)
  250083328       2008       - free -  (1.0M)

参考资料:GPTZFSBoot

迁移原zroot

1
2
3
4
5
6
7
8
9
10
[email protected]_FreeBSD:~ # zpool attach zroot ada0p4 da0p3
Make sure to wait until resilver is done before rebooting.

If you boot from pool 'zroot', you may need to update
boot code on newly attached disk 'da0p3'.

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

参考资料:freebsd-and-uefi-boot, 管理 ZFS 根池

移除旧硬盘,刷新储存池容量

1
2
zpool detach zroot xxxxxxxxxxxxxx
zpool online -e zroot da0p3
------------- END OF FILE meow~-------------