为什么我的ZFS池在Linux上使用ZFS不能扩展?

前端之家收集整理的这篇文章主要介绍了为什么我的ZFS池在Linux上使用ZFS不能扩展?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 Linux上有一个ZFS zpool,内核为2.6.32-431.11.2.el6.x86_64,它有一个vdev. vdev是SAN设备.我扩展了SAN的大小,尽管zpool将autoexpand设置为on,但即使重新启动计算机,导出/导入池,并使用zpool online -e,我也无法让池扩展.我确信vdev更大,因为fdisk显示它已从215GiB增加到250 GiB.以下是我所做的一个示例:
  1. [root@timestandstill ~]# zpool list
  2. NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
  3. dfbackup 214G 207G 7.49G 96% 1.00x ONLINE -
  4. [root@timestandstill ~]# zpool import -d /dev/disk/by-id/
  5. pool: dfbackup
  6. id: 12129781223864362535
  7. state: ONLINE
  8. action: The pool can be imported using its name or numeric identifier.
  9. config:
  10.  
  11. dfbackup ONLINE
  12. virtio-sbs-XLPH83 ONLINE
  13. [root@timestandstill ~]# zpool import -d /dev/disk/by-id/ dfbackup
  14. [root@timestandstill ~]# zpool list
  15. NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
  16. dfbackup 214G 207G 7.49G 96% 1.00x ONLINE -
  17. venuebackup 248G 244G 3.87G 98% 1.00x ONLINE -
  18. [root@timestandstill ~]# zpool get autoexpand dfbackup
  19. NAME PROPERTY VALUE SOURCE
  20. dfbackup autoexpand on local
  21. [root@timestandstill ~]# zpool set autoexpand=off dfbackup
  22. [root@timestandstill ~]# zpool set autoexpand=on dfbackup
  23. [root@timestandstill ~]# zpool list
  24. NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
  25. dfbackup 214G 207G 7.49G 96% 1.00x ONLINE -
  26. venuebackup 248G 244G 3.87G 98% 1.00x ONLINE -
  27. [root@timestandstill ~]# zpool status -v dfbackup
  28. pool: dfbackup
  29. state: ONLINE
  30. scan: none requested
  31. config:
  32.  
  33. NAME STATE READ WRITE CKSUM
  34. dfbackup ONLINE 0 0 0
  35. virtio-sbs-XLPH83 ONLINE 0 0 0
  36.  
  37. errors: No known data errors
  38. [root@timestandstill ~]# fdisk /dev/disk/by-id/virtio-sbs-XLPH83
  39.  
  40. WARNING: GPT (GUID Partition Table) detected on '/dev/disk/by-id/virtio-sbs-XLPH83'! The util fdisk doesn't support GPT. Use GNU Parted.
  41.  
  42.  
  43. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
  44. switch off the mode (command 'c') and change display units to
  45. sectors (command 'u').
  46.  
  47. Command (m for help): p
  48.  
  49. Disk /dev/disk/by-id/virtio-sbs-XLPH83: 268.4 GB,268435456000 bytes
  50. 256 heads,63 sectors/track,32507 cylinders
  51. Units = cylinders of 16128 * 512 = 8257536 bytes
  52. Sector size (logical/physical): 512 bytes / 512 bytes
  53. I/O size (minimum/optimal): 512 bytes / 512 bytes
  54. Disk identifier: 0x00000000
  55.  
  56. Device Boot Start End Blocks Id System
  57. /dev/disk/by-id/virtio-sbs-XLPH83-part1 1 27957 225443839+ ee GPT
  58.  
  59. Command (m for help): q
  60. [root@timestandstill ~]# zpool online -e dfbackup /dev/disk/by-id/virtio-sbs-XLPH83
  61. [root@timestandstill ~]# zpool list
  62. NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
  63. dfbackup 214G 207G 7.49G 96% 1.00x ONLINE -
  64. venuebackup 248G 244G 3.87G 98% 1.00x ONLINE -
  65. [root@timestandstill ~]# zpool status -v dfbackup
  66. pool: dfbackup
  67. state: ONLINE
  68. scan: none requested
  69. config:
  70.  
  71. NAME STATE READ WRITE CKSUM
  72. dfbackup ONLINE 0 0 0
  73. virtio-sbs-XLPH83 ONLINE 0 0 0
  74.  
  75. errors: No known data errors

我该如何扩展这个zpool?

解决方法

我在Ubuntu 16.04上运行ZFS,经过多次试验和错误后,这就是扩展磁盘和池大小而无需重启的方法.我的系统托管在Profitbricks的云端,并使用libvirt(而不是SCSI)驱动器.

获取池和设备详细信息:

  1. # zpool status -v
  2. ...
  3. NAME STATE READ WRITE CKSUM
  4. pool ONLINE 0 0 0
  5. vdb ONLINE 0 0 0
  6.  
  7. # zpool list
  8. NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
  9. pool 39.8G 27.1G 12.7G - 49% 68% 1.00x ONLINE -

激活autoexpand:

  1. # zpool set autoexpand=on pool

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

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

  1. # partprobe
  2. 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
  3. continue with the current setting?
  4.  
  5. # zpool online -e pool vdb
  6.  
  7. # partprobe
  8.  
  9. # zpool list
  10. NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
  11. pool 49.8G 27.1G 21.7G - 40% 55% 1.00x ONLINE -

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

猜你在找的Linux相关文章