ZFS 基本概念

好风 发表于 2016-11-18T09:26:31.321135Z
引用地址:https://plus.ooclab.com/note/article/1303

参考

VDEV

VDEV(虚拟设备) 是 ZFS 一个基本概念。目前 ZFS 有 7 种类型 VDEVs :

  • disk (default)- The physical hard drives in your system.
  • file- The absolute path of pre-allocated files/images.
  • mirror- Standard software RAID-1 mirror.
  • raidz1/2/3- Non-standard distributed parity-based software RAID levels.
  • spare- Hard drives marked as a "hot spare" for ZFS software RAID.
  • cache- Device used for a level 2 adaptive read cache (L2ARC).
  • log- A separate log (SLOG) called the "ZFS Intent Log" or ZIL.

非常重要的一点:VDEVs 一直是 dynamically striped 。理解这一点,对于 zpool/zfs 命令操作,才能更好地理解!

示例:

[root@localhost ~]# zpool create -f stor1 raidz vdb vdc vdd
[root@localhost ~]# zpool add -f stor1 vde vdf
[root@localhost ~]# zpool add -f stor1 log mirror vdg vdh
[root@localhost ~]# zpool add -f stor1 cache vdi
[root@localhost ~]# zpool add -f stor1 spare vdj vdk
[root@localhost ~]# zpool status
  pool: stor1
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        stor1       ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            vdb     ONLINE       0     0     0
            vdc     ONLINE       0     0     0
            vdd     ONLINE       0     0     0
          vde       ONLINE       0     0     0
          vdf       ONLINE       0     0     0
        logs
          mirror-3  ONLINE       0     0     0
            vdg     ONLINE       0     0     0
            vdh     ONLINE       0     0     0
        cache
          vdi       ONLINE       0     0     0
        spares
          vdj       AVAIL   
          vdk       AVAIL   

errors: No known data errors

上例中: raidz1-0 , vde, vdf 都是 VDEV , 它们是 dynamically striped 组成的 stor1