关于软分区

软分区是在 Solaris 8 中通过 SVM 产品补丁 108693-06 引入的。

软分区由 md_sp 内核驱动程序管理。

# modinfo | grep md_sp
    228 78328000 4743 - 1 md_sp (Meta disk soft partition module)
Solaris SVM 如何创建软分区

为什么要软分区?

每个人心里都有一个明显的问题,为什么我们需要软分区。
嗯,简单的答案是存在一个限制,因为磁盘只能有 8 个分区,因此将元设备的数量限制为每个磁盘 8 个。
这最初可能是一个可以接受的限制,但随着磁盘大小的增加,限制变得难以管理。
这就是软分区发挥作用的地方。
软分区允许将磁盘细分为许多由 SVM 控制和维护的分区,从而消除每个磁盘 8 个元设备的限制。

软分区配置信息写在两个地方:

状态数据库副本
直接在磁盘上,在范围头中

查看更多教程 https://on  itroad.com

创建软分区

metainit 命令中的 -p 选项是指软分区。

# metainit softpart -p [-e] component size

不要使用软分区,除非我们计划从磁盘驱动器制作 8 个以上的元设备。
它们没有任何作用,并引入了一个新的复杂层。

从单个磁盘创建软分区

# metainit d100 -p -e c1t10d0 2gb
- The -e option requires that the name of the disk supplied be in the form c#t#d#.
- The last parameter (2gb) specifies the initial size of the soft partition.
- The sizes can be specified in blocks, kilobytes, megabytes, gigabytes, and terabytes.
- The -e option causes the disk to be repartitioned. One partition (other than 0) will contain enough space to hold a replica (although no replica is actually created) and slice 0 will be the remainder of the drive. The soft partition that is being created is put into slice 0.
- Further soft partitions can be created on slice 0. See the next example.
#  metainit d200 -p c0t10d0s0 3gb
This will create a soft partition on the specified slice.
No repartitioning of the disk is done.
This soft partition starts where the previous soft partition ended. No overlap will occur.
Soft partitions may be continually created, providing space is available on the drive.

随后的 metastat (-p) 将显示软分区及其在磁盘上的各自位置。

# metastat -p
      d200 -p c0t10d0s0 -o 4194306 -b 6291456
      d100 -p c0t10d0s0 -o 1 -b 4194304
# metastat
        d200: Soft Partition
             Device: c0t10d0s0
             State: Okay
             Size: 6291456 blocks (3.0 GB)
                 Device      Start Block  Dbase Reloc
                 c0t10d0s0          0     No    Yes
                 Extent              Start Block              Block count
                      0                  4194306                  6291456
        d100: Soft Partition
            Device: c0t10d0s0
            State: Okay
            Size: 4194304 blocks (2.0 GB)
                Device      Start Block  Dbase Reloc
                c0t10d0s0          0     No    Yes
                Extent              Start Block              Block count
                     0                        1                  4194304

镜像软分区

镜像软分区的正确方法首先是从切片创建一个大型镜像元设备,然后将其划分为多个软分区。

注意: metainit 命令允许我们制作组件为软分区的镜像元设备。
不推荐这种方法。
不要镜像软分区;相反,从更大的基于切片的镜像元设备创建它们。

首先创建你的镜像:

# metainit d10 1 1 c0t8d0s1
# metainit d11 1 1 c0t9d0s1
# metainit d1 -m d10
# metattach d1 d11

从镜像创建软分区:

# metainit d100 -p d1 1gb
      d100: Soft Partition is setup

使用 metastat 和 metastat -p 查看结果

# metastat -p
      d1 -m d10 d11 1
      d10 1 1 c0t8d0s1
      d11 1 1 c0t9d0s1
      d100 -p d1 -o 32 -b 2097152
 # metastat
       d1: Mirror
           Submirror 0: d10
             State: Okay
           Submirror 1: d11
             State: Okay
           Pass: 1
           Read option: roundrobin (default)
           Write option: parallel (default)
           Size: 17465344 blocks (8.3 GB)
        d10: Submirror of d1
            State: Okay
            Size: 17465344 blocks (8.3 GB)
            Stripe 0:
                Device     Start Block  Dbase        State Reloc Hot Spare
                c0t8d0s1          0     No            Okay   Yes
        d11: Submirror of d1
            State: Okay
            Size: 17465344 blocks (8.3 GB)
            Stripe 0:
                Device     Start Block  Dbase        State Reloc Hot Spare
                c0t9d0s1          0     No            Okay   Yes
        d100: Soft Partition
            Device: d1
            State: Okay
            Size: 2097152 blocks (1.0 GB)
                Extent              Start Block              Block count
                     0                       32                  2097152

从 RAID-5 元设备创建软分区

配置软分区以在 RAID-5 元设备中使用的正确方法首先从片创建大型 RAID-5 元设备,然后将其划分为多个软分区。

注意: metainit 命令允许我们制作组件为软分区的 RAID-5 元设备。
不推荐这种方法。
不要使用软分区配置 RAID-5 元设备;相反,从更大的基于切片的 RAID-5 元设备创建它们。

创建 RAID-5 元设备:

# metainit d5 -r c0t8d0s1 c0t9d0s1 c0t10d0s1

从 RAID-5 元设备创建软分区:

# metainit d200 -p d5 1gb
    d200: Soft Partition is setup
# metainit d201 -p d5 3gb
    d201: Soft Partition is setup

使用 metastat 和 metastat -p 查看结果:

# metastat -p
  d5 -r c0t8d0s1 c0t9d0s1 c0t10d0s1 -k -i 32b
  d200 -p d5 -o 32 -b 2097152
  d201 -p d5 -o 2097216 -b 6291456
# metastat
  d5: RAID
    State: Okay
    Interlace: 32 blocks
    Size: 34930688 blocks (16 GB)
    Oroirnal device:
    Size: 34935360 blocks (16 GB)
          Device      Start Block  Dbase        State Reloc  Hot Spare
          c0t8d0s1         330        No         Okay   Yes
          c0t9d0s1         330        No         Okay   Yes
          c0t10d0s1        330        No         Okay   Yes
   d200: Soft Partition
       Device: d5
       State: Okay
       Size: 2097152 blocks (1.0 GB)
           Extent              Start Block              Block count
                0                       32                  2097152

  d201: Soft Partition
      Device: d5
      State: Okay
      Size: 6291456 blocks (3.0 GB)
          Extent              Start Block              Block count
               0                  2097216                  6291456
日期:2020-09-17 00:15:25 来源:oir作者:oir