3

I have a ZFS pool with 6 disks in a RAID 10 configuration.

I would like to upgrade the drives in one of the mirrors, from 1TB to 3TB drives. I have all the drives installed in the system.

I would prefer not to do it by replacing one drive, resilver, repeat. Is there a way to perform all of my reads from existing mirror, keeping all the wear on the drives I am removing?

root@e7-4860:~# zpool status
  pool: stuffpoll
 state: ONLINE
  scan: scrub repaired 0 in 6h50m with 0 errors on Sun Dec 10 07:14:34 2017
config:

    NAME                                               STATE     READ WRITE CKSUM
    stuffpoll                                          ONLINE       0     0     0
      mirror-0                                         ONLINE       0     0     0
        ata-HGST_HTS721010A9E630_JR10004M0LGN6E-part1  ONLINE       0     0     0
        ata-HGST_HTS721010A9E630_JR10004M0M17TE-part1  ONLINE       0     0     0
      mirror-1                                         ONLINE       0     0     0
        ata-HGST_HTS541010A9E680_JA1000102MG9UR-part1  ONLINE       0     0     0
        ata-HGST_HTS541010A9E680_JA1009C03158BP-part1  ONLINE       0     0     0
      mirror-2                                         ONLINE       0     0     0
        ata-HGST_HTS721010A9E630_JR100X6P2TJKVE        ONLINE       0     0     0
        ata-HGST_HTS721010A9E630_JR100Y4M01200M        ONLINE       0     0     0

errors: No known data errors


root@e7-4860:~# zpool list
NAME        SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
stuffpoll  2.72T  2.47T   254G         -    48%    90%  1.00x  ONLINE  -


root@e7-4860:~# ls /dev/disk/by-id/ -1
ata-CT240BX200SSD1_1613F0194817
ata-CT240BX200SSD1_1613F0194817-part1
ata-HGST_HTS541010A9E680_JA1000102MG9UR
ata-HGST_HTS541010A9E680_JA1000102MG9UR-part1
ata-HGST_HTS541010A9E680_JA1000102MG9UR-part9
ata-HGST_HTS541010A9E680_JA1009C03158BP
ata-HGST_HTS541010A9E680_JA1009C03158BP-part1
ata-HGST_HTS541010A9E680_JA1009C03158BP-part9
ata-HGST_HTS721010A9E630_JR10004M0LGN6E
ata-HGST_HTS721010A9E630_JR10004M0LGN6E-part1
ata-HGST_HTS721010A9E630_JR10004M0LGN6E-part9
ata-HGST_HTS721010A9E630_JR10004M0M17TE
ata-HGST_HTS721010A9E630_JR10004M0M17TE-part1
ata-HGST_HTS721010A9E630_JR10004M0M17TE-part9
ata-HGST_HTS721010A9E630_JR100X6P2TJKVE
ata-HGST_HTS721010A9E630_JR100X6P2TJKVE-part1
ata-HGST_HTS721010A9E630_JR100X6P2TJKVE-part9
ata-HGST_HTS721010A9E630_JR100Y4M01200M
ata-HGST_HTS721010A9E630_JR100Y4M01200M-part1
ata-HGST_HTS721010A9E630_JR100Y4M01200M-part9
scsi-35000c50055fb009b
scsi-35000c50055fb395f

I would like to ultimately replace the drives in mirror-1 with scsi-35000c50055fb009b and scsi-35000c50055fb395f

4
  • 1
    What exactly are you asking? And what are the sizes of the disks involved? – ewwhite Dec 11 '17 at 16:18
  • You can have more then 2 drives in a mirror vdev. You could add all your new drive(s) to the existing mirror vdev, then wait for the sync to complete, and remove the old drives. – Zoredache Dec 11 '17 at 21:23
  • @ewwhite The question is written right there: Is there a way to perform all of my reads from existing mirror, keeping all the wear on the drives I am removing? – user121391 Dec 13 '17 at 9:20
  • @Zoredache When the smaller drives are removed, would the new space be usable by the mirror? Also, please answer the question with this, I believe you are correct. – wmantly Dec 13 '17 at 11:38
2

If you want to manually expand the volume all you have to do is bring it online with the -e option.

zpool online -e stuffpoll

You can also toggle the autoexpand option to have it happen automatically.

zpool set autoexpand=on stuffpoll

So lets say you are adding new drives to mirror-2 so you can expand that. You need to attach the new drives, using the one of the existing device names as the target. You can add both new devices to a mirror before removing the old devices.

# zpool attach pool existing_vdev_member new_device
zpool attach stuffpoll ata-HGST_HTS721010A9E630_JR100X6P2TJKVE new_dev1
zpool attach stuffpoll ata-HGST_HTS721010A9E630_JR100X6P2TJKVE new_dev2

After the sync of the new devices are complete you can remove the old devices.

zpool attach stuffpoll ata-HGST_HTS721010A9E630_JR100X6P2TJKVE
zpool attach stuffpoll ata-HGST_HTS721010A9E630_JR100Y4M01200M

Man zpool

zpool attach [-f] pool device new_device

Attaches new_device to an existing zpool device. The existing device
cannot be part of a raidz configuration. If device is not currently
part of a mirrored configuration, device automatically transforms
into a two-way mirror of device and new_device.  If device is part of
a two-way mirror, attaching new_device creates a three-way mirror,
and so on. In either case, new_device begins to resilver immediately.
...

zpool online [-e] pool device ...

Brings the specified physical device online.
-e  Expand the device to use all available space. If the device
    is part of a mirror or raidz then all devices must be
    expanded before the new space will become available to the
    pool.

Links

Also, I like to remind people. Verify your backups/restores first. There is always a chance something bad will happen. Also consider building a zfs pool on a test machine/VM and practice your commands ahead of time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.