有一个ZFS镜像卷,里面有两块磁盘现在需要添加两块磁盘到pool中,新的磁盘为ada2和ada3
root@cloudbox:/usr/home/jilili # dmesg | grep ATA ahci0: <Marvell 88SE9215 AHCI SATA controller> port 0xe050-0xe057,0xe040-0xe043,0xe030-0xe037,0xe020-0xe023,0xe000-0xe01f mem 0xdfe40000-0xdfe407ff irq 16 at device 0.0 on pci1 ahci1: <Intel ICH7 AHCI SATA controller> port 0xf0f0-0xf0f7,0xf0e0-0xf0e3,0xf0d0-0xf0d7,0xf0c0-0xf0c3,0xf020-0xf02f mem 0xdff04000-0xdff043ff irq 19 at device 31.2 on pci0 ada0: <WDC WD10EZEX-08M2NA0 01.01A01> ACS-2 ATA SATA 3.x device ada0: 600.000MB/s transfers (SATA 3.x, UDMA5, PIO 8192bytes) ada1: <WDC WD10EZEX-22BN5A0 01.01A01> ACS-2 ATA SATA 3.x device ada1: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada2: <HGST HTS541010A9E680 JA0OA560> ATA8-ACS SATA 3.x device ada2: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes) ada3: <SAMSUNG HM500JI 2AC101C4> ATA8-ACS SATA 2.x device ada3: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
原有pool中的磁盘为GPT分区,初始化新的磁盘并建立GPT分区
# gpart destroy -F ada2 # gpart create -s gpt ada2 # gpart add -a 4k -t freebsd-zfs /dev/ada2 # gpart destroy -F ada3 # gpart create -s gpt ada3 # gpart add -a 4k -t freebsd-zfs /dev/ada3
查看磁盘设备标识符
root@cloudbox:/usr/home/jilili # ls /dev/ada* /dev/ada0 /dev/ada0p1 /dev/ada0p2 /dev/ada1 /dev/ada2 /dev/ada2p1 /dev/ada3 /dev/ada3p1
把刚才的分区加入pool
root@cloudbox:/usr/home/jilili # zpool add zroot mirror ada2p1 ada3p1 invalid vdev specification use '-f' to override the following errors: mirror contains devices of different sizes root@cloudbox:/usr/home/jilili # zpool add -f zroot mirror ada2p1 ada3p1
就此完成添加看看你的磁盘容量增加了没?