为什么我的ZFS池没有在Linux上使用ZFS扩展?


10

我在Linux 2.6.32-431.11.2.el6.x86_64内核下有一个ZFS zpool,它具有单个vdev。vdev是一个SAN设备。我扩展了SAN的大小,尽管zpool autoexpand设置为on,即使在重新引导计算机,导出/导入池并使用之后zpool online -e,我也无法扩展该池。我确信vdev更大,因为fdisk它表明它已从215GiB增加到250 GiB。这是我所做的示例:

[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      214G   207G  7.49G    96%  1.00x  ONLINE  -
[root@timestandstill ~]# zpool import -d /dev/disk/by-id/
   pool: dfbackup
     id: 12129781223864362535
  state: ONLINE
 action: The pool can be imported using its name or numeric identifier.
 config:

    dfbackup             ONLINE
      virtio-sbs-XLPH83  ONLINE
[root@timestandstill ~]# zpool import -d /dev/disk/by-id/ dfbackup
[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      214G   207G  7.49G    96%  1.00x  ONLINE  -
venuebackup   248G   244G  3.87G    98%  1.00x  ONLINE  -
[root@timestandstill ~]# zpool get autoexpand dfbackup
NAME      PROPERTY    VALUE   SOURCE
dfbackup  autoexpand  on      local
[root@timestandstill ~]# zpool set autoexpand=off dfbackup
[root@timestandstill ~]# zpool set autoexpand=on dfbackup
[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      214G   207G  7.49G    96%  1.00x  ONLINE  -
venuebackup   248G   244G  3.87G    98%  1.00x  ONLINE  -
[root@timestandstill ~]# zpool status -v dfbackup
  pool: dfbackup
 state: ONLINE
  scan: none requested
config:

    NAME                 STATE     READ WRITE CKSUM
    dfbackup             ONLINE       0     0     0
      virtio-sbs-XLPH83  ONLINE       0     0     0

errors: No known data errors
[root@timestandstill ~]# fdisk /dev/disk/by-id/virtio-sbs-XLPH83

WARNING: GPT (GUID Partition Table) detected on '/dev/disk/by-id/virtio-sbs-XLPH83'! The util fdisk doesn't support GPT. Use GNU Parted.


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/disk/by-id/virtio-sbs-XLPH83: 268.4 GB, 268435456000 bytes
256 heads, 63 sectors/track, 32507 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

                             Device Boot      Start         End      Blocks   Id  System
/dev/disk/by-id/virtio-sbs-XLPH83-part1               1       27957   225443839+  ee  GPT

Command (m for help): q
[root@timestandstill ~]# zpool online -e dfbackup /dev/disk/by-id/virtio-sbs-XLPH83
[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      214G   207G  7.49G    96%  1.00x  ONLINE  -
venuebackup   248G   244G  3.87G    98%  1.00x  ONLINE  -
[root@timestandstill ~]# zpool status -v dfbackup
  pool: dfbackup
 state: ONLINE
  scan: none requested
config:

    NAME                 STATE     READ WRITE CKSUM
    dfbackup             ONLINE       0     0     0
      virtio-sbs-XLPH83  ONLINE       0     0     0

errors: No known data errors

我如何扩展这个zpool?

Answers:


10

我在Ubuntu 16.04上运行ZFS,经过反复试验,这是在不重新引导的情况下扩展磁盘和池大小的方法。我的系统托管在Profitbricks的云中,并使用libvirt(而非SCSI)驱动器。

获取池和设备详细信息:

# zpool status -v
   ...
    NAME        STATE     READ WRITE CKSUM
    pool        ONLINE       0     0     0
      vdb       ONLINE       0     0     0

# zpool list
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
pool  39.8G  27.1G  12.7G         -    49%    68%  1.00x  ONLINE  -

激活自动展开:

# zpool set autoexpand=on pool

现在登录到Profitbricks控制面板,并将磁盘大小从40GB增加到50GB。

通知系统磁盘大小更改并扩展池:

# partprobe
Warning: Not all of the space available to /dev/vdb appears to be used,
you can fix the GPT to use all of the space (an extra 10485760 blocks) or 
continue with the current setting?

# zpool online -e pool vdb

# partprobe

# zpool list
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
pool  49.8G  27.1G  21.7G         -    40%    55%  1.00x  ONLINE  -

我不确定为什么,但是有时必须运行两次partprobe和/或zpool online -e pool vdb两次才能使更改生效。


1
似乎您的解决方案与我的解决方案相同?即zpool online -e pool vdb是执行技巧的命令。我现在在许多libvirt服务器上使用Linux上的ZFS-on-Linux,并且对我有用(没有partprobe)
Josh

我还必须重新启动才能使更改生效,然后我发现partprobe(在之前和之后运行zpool online)消除了重新启动的需要。
lfjeff

7

我在freebsd论坛上阅读了建议使用的帖子zpool online -e <pool> <vdev>(无需先使vdev脱机)

最终这是解决方案,但它要求首先禁用ZFS自动扩展

[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      214G   207G  7.49G    96%  1.00x  ONLINE  -
[root@timestandstill ~]# zpool get autoexpand
NAME         PROPERTY    VALUE   SOURCE
dfbackup     autoexpand  on      local
[root@timestandstill ~]# zpool set autoexpand=off dfbackup
[root@timestandstill ~]# zpool online -e dfbackup /dev/disk/by-id/virtio-sbs-XLPH83
[root@timestandstill ~]# zpool list
NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
dfbackup      249G   207G  42.5G    82%  1.00x  ONLINE  -

使用zpool set autoexpand=off之后zpool online -e被要求获得的zpool扩大对我来说,在Linux上使用ZFS(在内核,不使用FUSE)


那没有意义。ZFS邮件列表指出需要先重新加载内核模块,然后才能运行池扩展。
ewwhite

好吧,这是三个重新启动,多个导出和导入zpool online -e以及zpool set autoexpand=off为我完成了@ewwhite ...我在终端中拥有完整的历史记录。不知道那是什么问题。
2015年


谢谢@ewwhite。我没有使用较新的版本,该版本至少已存在15个月。我不确定如何特别找到该版本。
2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.