5

I have 2x3TB disks with GPT and a zpool with uses a 2.7TB partition on the first disk (sda4) and 1TB on the second disk (sdb4).

Reason is that initially both disks were just 1TB and I sequentially replaced both of them with 3TB. But during the time I had 1x1TB and 1x3TB I used the remainder of the 3TB for a different partition which I want to delete now.

I use the latest ZFS on Linux (0.6.5.7-8-wheezy). What is the correct way to resize the pool to the full 2.7TB?

autoresize is currently off. This is the current output of lsblk and zpool status:

# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda       8:0    0   2,7T  0 disk
├─sda1    8:1    0     1M  0 part
├─sda2    8:2    0  14,5G  0 part
│ └─md0   9:0    0  14,5G  0 raid1 /
├─sda3    8:3    0   4,2G  0 part
│ └─md2   9:2    0   4,2G  0 raid1 [SWAP]
└─sda4    8:4    0   2,7T  0 part
sdb       8:16   0   2,7T  0 disk
├─sdb1    8:17   0     1M  0 part
├─sdb2    8:18   0  14,5G  0 part
│ └─md0   9:0    0  14,5G  0 raid1 /
├─sdb3    8:19   0   4,2G  0 part
│ └─md2   9:2    0   4,2G  0 raid1 [SWAP]
├─sdb4    8:20   0 912,9G  0 part
└─sdb5    8:21   0   1,8T  0 part

# zpool status
  pool: zpradix1imain
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(5) for details.
  scan: resilvered 687G in 6h2m with 0 errors on Fri Dec 26 18:39:27 2014
config:

        NAME                                                STATE     READ WRITE CKSUM
        zpradix1imain                                       ONLINE       0     0     0
          mirror-0                                          ONLINE       0     0     0
            ata-WDC_WD30EZRZ-00WN9B0_WD-WCC4E7CL5U9D-part4  ONLINE       0     0     0
            ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N0E6K1AW-part4  ONLINE       0     0     0

As a first step, I would delete sdb5 and resize sdb4 (via gdisk) to 2.7TB and rescanning the partition table (both disks would have identical partition layout then).

But then?

divB
  • 568
  • 1
  • 7
  • 23
  • 1
    The output of `zfs status`, and `lsblk` might be useful here. Also, if you are woried about doing things correctly, I suggest you setup a test environment in a VM, and try the commands out there first. You don't need to make full 3TB virtual disks. Just make a couple virtual drives that are a few gigs and then expand them. – Zoredache Aug 24 '16 at 19:16
  • Yeah, this is going to depend on your pool setup. One of the main recommendations in ZFS is to use equal-sized disks. This isn't a Drobo or something where there are other data protection schemes in play. – ewwhite Aug 24 '16 at 19:44
  • @Zoredache: I guess you mean `zpool status`? I added the output of both commands. The disks are equal size (the first part is RAID1 for the Linux host system) but as I said I replaced 1TB->3TB. My main question is if my first step (deleting sdb5, resizing sda4) is correct and what to do afterwards. Is `autoresize` necessary and if yes, when to set it? – divB Aug 24 '16 at 20:18
  • Yes, `zpool status` that was the command we needed. – Zoredache Aug 24 '16 at 20:25

1 Answers1

2

That looks like a bit of a mess.

But in short:

  • Set autoexpand=on on your zpool.
  • Resize your partitions to the right size.
  • Run partprobe or reboot.
  • Once done, use zpool online -e zpradix1imain ata-WDC_WD30EZRZ-00WN9B0_WD-WCC4E7CL5U9D-part4 and zpool online -e zpradix1imain ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N0E6K1AW-part4
  • Reload the ZFS module or just reboot.

   zpool online [-e] pool device...

       Brings the specified physical device online.

       This command is not applicable to spares or cache devices.

       -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.
ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • 1
    ```autoexpand=on``` means the pool will grow automatically when the underlying block device grow in size - with it no ```zpool online -e``` required. I actually prefer leaving it at the default so I can grow them with the command myself... – Lester Cheung Oct 30 '20 at 06:32