在 zfsonlinux 中增长 zpool

div*_*ivB 5 linux zfs filesystems zfsonlinux

我有 2x3TB 的 GPT 磁盘和 zpool,在第一个磁盘 (sda4) 上使用 2.7TB 分区,在第二个磁盘 (sdb4) 上使用 1TB。

\n\n

原因是最初两个磁盘都只有 1TB,我随后将它们都替换为 3TB。但在我拥有 1x1TB 和 1x3TB 期间,我将剩余的 3TB 用于另一个分区,现在我想删除该分区。

\n\n

我在 Linux 上使用最新的 ZFS (0.6.5.7-8-wheezy)。将池大小调整为完整 2.7TB 的正确方法是什么?

\n\n

autoresize目前已关闭。lsblk这是和的当前输出zpool status

\n\n
# lsblk\nNAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT\nsda       8:0    0   2,7T  0 disk\n\xe2\x94\x9c\xe2\x94\x80sda1    8:1    0     1M  0 part\n\xe2\x94\x9c\xe2\x94\x80sda2    8:2    0  14,5G  0 part\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80md0   9:0    0  14,5G  0 raid1 /\n\xe2\x94\x9c\xe2\x94\x80sda3    8:3    0   4,2G  0 part\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80md2   9:2    0   4,2G  0 raid1 [SWAP]\n\xe2\x94\x94\xe2\x94\x80sda4    8:4    0   2,7T  0 part\nsdb       8:16   0   2,7T  0 disk\n\xe2\x94\x9c\xe2\x94\x80sdb1    8:17   0     1M  0 part\n\xe2\x94\x9c\xe2\x94\x80sdb2    8:18   0  14,5G  0 part\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80md0   9:0    0  14,5G  0 raid1 /\n\xe2\x94\x9c\xe2\x94\x80sdb3    8:19   0   4,2G  0 part\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80md2   9:2    0   4,2G  0 raid1 [SWAP]\n\xe2\x94\x9c\xe2\x94\x80sdb4    8:20   0 912,9G  0 part\n\xe2\x94\x94\xe2\x94\x80sdb5    8:21   0   1,8T  0 part\n\n# zpool status\n  pool: zpradix1imain\n state: ONLINE\nstatus: Some supported features are not enabled on the pool. The pool can\n        still be used, but some features are unavailable.\naction: Enable all features using 'zpool upgrade'. Once this is done,\n        the pool may no longer be accessible by software that does not support\n        the features. See zpool-features(5) for details.\n  scan: resilvered 687G in 6h2m with 0 errors on Fri Dec 26 18:39:27 2014\nconfig:\n\n        NAME                                                STATE     READ WRITE CKSUM\n        zpradix1imain                                       ONLINE       0     0     0\n          mirror-0                                          ONLINE       0     0     0\n            ata-WDC_WD30EZRZ-00WN9B0_WD-WCC4E7CL5U9D-part4  ONLINE       0     0     0\n            ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N0E6K1AW-part4  ONLINE       0     0     0\n
Run Code Online (Sandbox Code Playgroud)\n\n

第一步,我将删除 sdb5 并将 sdb4 大小(通过 gdisk)调整为 2.7TB,然后重新扫描分区表(两个磁盘将具有相同的分区布局)。

\n\n

但是之后?

\n

eww*_*ite 2

这看起来有点乱。

但简而言之:

  • 设置autoexpand=on在您的 zpool 上。
  • 将分区大小调整为合适的大小。
  • 运行partprobe或重新启动。
  • 完成后,使用zpool online -e zpradix1imain ata-WDC_WD30EZRZ-00WN9B0_WD-WCC4E7CL5U9D-part4zpool online -e zpradix1imain ata-WDC_WD30EZRX-00D8PB0_WD-WMC4N0E6K1AW-part4
  • 重新加载 ZFS 模块或重新启动。

   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.
Run Code Online (Sandbox Code Playgroud)

  • ```autoexpand=on``` 意味着当底层块设备大小增长时,池将自动增长 - 不需要 ```zpool online -e``` 。实际上,我更喜欢将其保留为默认值,这样我就可以自己使用命令来扩展它们...... (2认同)