1

I have a mirror pool with two devices (sda, sdb) on my Debian.

And now I inserted two additional devices (sdc, sdd), so I could double the available space in the /mnt/data/ directory.

Is it done by just sudo zpool add backup-pool mirror sdc sdd?

I'm a bit scared so I want to make sure. Sorry for the rookie question.

Here are the details of my pool:

sudo zfs list

NAME               USED  AVAIL     REFER  MOUNTPOINT
backup-pool       1.47T  1.17T       96K  /backup-pool
backup-pool/data  1.47T  1.17T     1.47T  /mnt/data

sudo zpool list

NAME          SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
backup-pool  2.72T  1.47T  1.25T        -         -    11%    53%  1.00x    ONLINE  -

sudo fdisk -l

Disk /dev/sdc: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: WDC WD30EFAX-68J
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdd: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: WDC WD30EFAX-68J
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: WDC WD30EFAX-68J
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ABB57994-974B-734A-A2A9-2BA616368A52

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048 5860515839 5860513792  2.7T Solaris /usr & Apple ZFS
/dev/sdb9  5860515840 5860532223      16384    8M Solaris reserved 1


Disk /dev/sda: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Disk model: WDC WD30EFAX-68J
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: DCDDA5ED-CB54-C042-9AF6-076F07F44E96

Device          Start        End    Sectors  Size Type
/dev/sda1        2048 5860515839 5860513792  2.7T Solaris /usr & Apple ZFS
/dev/sda9  5860515840 5860532223      16384    8M Solaris reserved 1

Thanks!

1 Answer 1

3

Short answer:

Is it done by just sudo zpool add backup-pool mirror sdc sdd?

Yes.

Long answer:

I'm a bit scared so I want to make sure.

It's often simpler than one might think to test using non-critical devices, such as small virtual memory disks or in this case, file-backed virtual disks.

This is on FreeBSD, but Linux has tools to do the same thing.

I'll create four files of 1G each and use each file as a file-backed virtual disk:

# for i in $(jot 4 0)
> do
>         truncate -s1G md$i
>         mdconfig -f md$i
> done

I now have drives /dev/md0 through /dev/md3 to play with. I'll create the original single-VDEV pool you have by mirroring /dev/md0 and /dev/md1:

# zpool create tank mirror md0 md1
# zpool status tank
  pool: tank
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            md0     ONLINE       0     0     0
            md1     ONLINE       0     0     0

errors: No known data errors

The Wrong Way:

If you try to add the next disk md2 to the pool, zpool warns that you're down-grading the redundancy of the pool:

# zpool add tank md2
invalid vdev specification
use '-f' to override the following errors:
mismatched replication level: pool uses mirror and new vdev is disk

And indeed if you do force this operation, and likewise force the addition of md3 you get:

# zpool add -f tank md2
# zpool status tank
  pool: tank
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            md0     ONLINE       0     0     0
            md1     ONLINE       0     0     0
          md2       ONLINE       0     0     0

errors: No known data errors

# zpool add -f tank md3
# zpool status tank
  pool: tank
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            md0     ONLINE       0     0     0
            md1     ONLINE       0     0     0
          md2       ONLINE       0     0     0
          md3       ONLINE       0     0     0

errors: No known data errors

Notice that devices md2 and md3 have no redundancy. Your pool is vulnerable to any of three failures: 1) if BOTH halves of the mirror fail; 2) if disk md2 fails; or 3) if disk md3 fails. Any one of those three events will make your pool unusable.

The Better Way:

My example above is simply to show what happens when you do it the wrong way. The better method, indeed the one which I believe you are seeking, is to add the two new drives as a second mirror, concatenated with the first mirror.

For improved redundancy, tell zpool that you want to add a mirror to the existing pool:

# zpool status tank
  pool: tank
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            md0     ONLINE       0     0     0
            md1     ONLINE       0     0     0

errors: No known data errors

# zpool add tank mirror md2 md3
# zpool status tank
  pool: tank
 state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            md0     ONLINE       0     0     0
            md1     ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            md2     ONLINE       0     0     0
            md3     ONLINE       0     0     0

errors: No known data errors

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .