Freebsd – Trying to “zfs attach” a new disk, how to get correct specification for the disk I’m adding

freebsdtruenaszfs

I'm migrating data from my old server to zfs on FreeBSD 10.x (I'm actually on FreeNAS 9.10.2-u1 but doing this activity in console so it's pure FreeBSD). My problem is that zpool attach needs a new_device in the correct format or slice/partition information, which I don't know how to provide.

Because of costs, I'm migrating the data in two stages – copying the data from my old mirror to a new zfs pool (without redundancy), then breaking the mirrors on the old server to move the mirror drives over and resilver on the new server, at all stages having 2 copies of the data. SMART stats are all good, ands all disks are "enterprise" type. Although not ideal, so far it's gone well. I've copied over the data, and connected the disks from the old server to the new server – where I'm now stuck on getting the correct args for zpool attach.

Current storage is as follows:

camcontrol devlist identifies the disk devices and model numbers, giving:

ada0 = 6TB disk
ada1 = 4TB disk
ada2 = 6TB disk
ada3 = BOOT MIRROR
ada4 = BOOT MIRROR
ada5 = 4TB disk
ada6 = 6TB disk

glabel status identifies the gptid's for the 5 disks already in use:

gptid/c610a927-01da-11e7-b762-000743144400     ada0p2 - 6TB
gptid/c68f80ae-01da-11e7-b762-000743144400     ada2p2 - 6TB
gptid/3b2b904b-02b3-11e7-b762-000743144400     ada3p1 - BOOT MIRROR
gptid/fb71e387-016b-11e7-9ddd-000743144400     ada4p1 - BOOT MIRROR
gptid/c566154f-01da-11e7-b762-000743144400     ada5p2 - 4TB

zpool status identifies the 3 disks in the data pool so far, by gptid

gptid/c610a927-01da-11e7-b762-000743144400 (from above this is ada0p2, 6TB)
gptid/c68f80ae-01da-11e7-b762-000743144400 (from above this is ada2p2, 6TB)
gptid/c566154f-01da-11e7-b762-000743144400 (from above this is ada5p2, 4TB)

so the new disks to attach are:

ada1 (4TB) - attach to gptid/c566154f-01da-11e7-b762-000743144400 (ada5p2)
ada6 (6TB) - attach to gptid/c610a927-01da-11e7-b762-000743144400 (ada0p2)

disk arriving shortly (6TB): attach on arrival to gptid/c68f80ae-01da-11e7-b762-000743144400 (ada2p2)

Problem:

What I'm stuck on is the actual command to use for attach. zpool attach gives an error whatever I try:

zpool attach ada0p2 ada6
missing <new_device> specification

zpool attach gptid/c610a927-01da-11e7-b762-000743144400 ada6
missing <new_device> specification

I'm guessing it's objecting to the "ada6" and I should be providing some other identifier, or a slice/partition ID instead. But I don't have these; zfs creates them itself when it attaches the disk.

What is the correct command to use here, or what am I missing?

Best Answer

You have to specify also zpool to which you want to add disk.

# zpool list -v
NAME                         SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot                       2.72T   204G  2.52T         -     7%     7%  1.00x  ONLINE  -
  mirror                    2.72T   204G  2.52T         -     7%     7%
    gpt/zfs0                    -      -      -         -      -      -
    gpt/zfs1                    -      -      -         -      -      -

# zpool attach zroot gpt/zfs1 ada6

http://docs.oracle.com/cd/E19253-01/819-5461/6n7ht6qvl/index.html