2017年4月28日 星期五

用mdadm做/boot要注意metadata

系統開機區/boot若是用mdadm做RAID-1,要注意選擇RAID metadata存放的方式。最保險的方式是在mdadm後面的參數下--metadata=0.90。若是直接用mdadm預設做RAID-1,會出現下面的提醒訊息
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
這是因為RAID metadata (superblock)放置的位置不一樣,舊款的boot loader可能無法辨識造成系統無法開機。所以說最安全的方式就是把/boot磁區的RAID-1設定成0.90這種方式。

用man mdadm找到metadata section,可以看到有主要有四種metadata方式可以選,預設是1.2:
       -e, --metadata=
              Declare the style of RAID metadata (superblock) to be used.  The
              default is 1.2 for --create, and to guess for other  operations.
              The  default can be overridden by setting the metadata value for
              the CREATE keyword in mdadm.conf.

              Options are:


              0, 0.90

                     Use the original 0.90  format  superblock.   This  format
                     limits  arrays  to 28 component devices and limits compo‐
                     nent devices of levels 1 and greater to 2 terabytes.   It
                     is  also possible for there to be confusion about whether
                     the superblock applies to a whole device or just the last
                     partition, if that partition starts on a 64K boundary.

              1, 1.0, 1.1, 1.2 default

                     Use  the new version-1 format superblock.  This has fewer
                     restrictions.  It can easily be moved between hosts  with
                     different  endian-ness,  and  a recovery operation can be
                     checkpointed and restarted.  The  different  sub-versions
                     store  the  superblock  at  different  locations  on  the
                     device, either at the end (for 1.0), at  the  start  (for
                     1.1)  or  4K from the start (for 1.2).  "1" is equivalent
                     to "1.2" (the commonly preferred 1.x format).   "default"
                     is equivalent to "1.2".

              ddf    Use the "Industry Standard" DDF (Disk Data Format) format

                     defined by SNIA.  When creating a DDF array  a  CONTAINER
                     will be created, and normal arrays can be created in that
                     container.

              imsm   Use the Intel(R) Matrix Storage Manager metadata  format.

                     This  creates  a  CONTAINER which is managed in a similar
                     manner to DDF, and is supported by an option-rom on  some
                     platforms:

                     http://www.intel.com/design/chipsets/matrixstorage_sb.htm


上面ddf與imsm是mdadm version 3.0之後才出現的superblock format
更多關於mdadm的metadata請參考《RAID superblock formats》

2021-Nov-3補充

在Ubuntu 20.04 LTS上面,開機/boot已經可以用metadata=1.2這個選項了。不確定是因為mdadm更新還是grub更新。

_EOF_

沒有留言:

張貼留言