多个磁盘做软件raid并解决分区aligned对齐问题


centos 服务器验证创建软件raid10数据盘,该机器缺少raid硬件。只能做软件raid。

/dev/sdd至/dev/sdm共10块8T磁盘,做raid10;

步骤如下:

(第一步)创建raid10
事先不需要对单个磁盘做分区
10个相同数据盘创建raid10命令:mdadm -C -v  /dev/md10 -a yes -l 10 -n 10  /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm

2个相同数据盘创建raid1命令:mdadm -C -v  /dev/md0 -a yes -l 1 -n 2  /dev/sdb /dev/sdc

创建命令参数说明:

选项:-C
专用选项:
-l 级别
-n 设备个数
-a {yes|no} 自动为其创建设备文件
-c 指定数据块大小(chunk)
-x 指定空闲盘(热备磁盘)个数,空闲盘(热备磁盘)能在工作盘损坏后自动顶替
-v, --verbose:显示细节

参考文档:

Linux中mdadm命令管理RAID磁盘阵列的实例总结_PHP教程_IDC笔记

linux软raid mdadm命令详讲_mdadm查看raid信息-CSDN博客

mdadm  -D   /dev/md10  查看状态

【第二步】解决分区格式化的对齐问题:"The resulting partition is not properly aligned for best performance."

[[email protected]~]# cat /sys/block/md10/queue/optimal_io_size 
2621440
[[email protected]~]# cat /sys/block/md10/queue/minimum_io_size 
524288
[[email protected]~]# cat /sys/block/md10/alignment_offset 
0
[[email protected]~]# cat /sys/block/md10/queue/physical_block_size 
4096


获取正确的偏移扇区数是将 optimal_io_size 和 alignment_offset 相加然后除以 physical_block_size,这里算出来是640=(optimal_io_size +alignment_offset )/physical_block_size ;

parted  /dev/md10 

(parted) h
(parted) mklabel gpt
(parted) mkpart primary xfs 640 100%    【这是关键步骤】

【第三步】正常的分区格式化大容量磁盘, 添加开机自启动

mkfs.xfs /dev/md10p1   【格式化成默认的xfs文件系统】

blkid /dev/md10p1

cat /etc/fstab && vi /etc/fstab

以下是详细命令

【第一步】创建raid10
不需要对单个磁盘做分区
[[email protected]~]# mdadm -C -v  /dev/md10 -a yes -l 10 -n 10  /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm
mdadm: layout defaults to n2
mdadm: layout defaults to n2
mdadm: chunk size defaults to 512K
mdadm: partition table exists on /dev/sdd
mdadm: partition table exists on /dev/sdd but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sde
mdadm: partition table exists on /dev/sde but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdf
mdadm: partition table exists on /dev/sdf but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdg
mdadm: partition table exists on /dev/sdg but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdh
mdadm: partition table exists on /dev/sdh but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdi
mdadm: partition table exists on /dev/sdi but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdj
mdadm: partition table exists on /dev/sdj but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdk
mdadm: partition table exists on /dev/sdk but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdl
mdadm: partition table exists on /dev/sdl but will be lost or
       meaningless after creating array
mdadm: partition table exists on /dev/sdm
mdadm: partition table exists on /dev/sdm but will be lost or
       meaningless after creating array
mdadm: size set to 7813894144K
mdadm: automatically enabling write-intent bitmap on large array
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md10 started.
[[email protected]~]# mdadm  -D /dev/md10
/dev/md10:
           Version : 1.2
     Creation Time : Wed Dec 20 11:38:54 2023
        Raid Level : raid10
        Array Size : 39069470720 (37259.55 GiB 40007.14 GB)
     Used Dev Size : 7813894144 (7451.91 GiB 8001.43 GB)
      Raid Devices : 10
     Total Devices : 10
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Wed Dec 20 11:39:09 2023
             State : clean, resyncing 
    Active Devices : 10
   Working Devices : 10
    Failed Devices : 0
     Spare Devices : 0

            Layout : near=2
        Chunk Size : 512K

Consistency Policy : bitmap

     Resync Status : 0% complete

              Name : 10
              UUID : e6b3fd6d:b15db153:afa11b20:7f6a2231
            Events : 3

    Number   Major   Minor   RaidDevice State
       0       8       48        0      active sync set-A   /dev/sdd
       1       8       64        1      active sync set-B   /dev/sde
       2       8       80        2      active sync set-A   /dev/sdf
       3       8       96        3      active sync set-B   /dev/sdg
       4       8      112        4      active sync set-A   /dev/sdh
       5       8      128        5      active sync set-B   /dev/sdi
       6       8      144        6      active sync set-A   /dev/sdj
       7       8      160        7      active sync set-B   /dev/sdk
       8       8      176        8      active sync set-A   /dev/sdl
       9       8      192        9      active sync set-B   /dev/sdm
[[email protected]~]# 

【第二步】解决分区格式化的对齐问题:"The resulting partition is not properly aligned for best performance."

(parted) mkpart primary xfs 640 100%    【这是关键步骤】

(parted) mkpart primary xfs 2048 100% 【不涉及align对齐问题,大容量磁盘做分区默认都这样】

关键一步需要解决align对齐问题,参考链接:
https://www.cnblogs.com/oradba/p/16145117.html
https://blog.51cto.com/u_15076212/4373955
https://blog.csdn.net/zfw_666666/article/details/126744930

[[email protected]~]# parted /dev/md10
GNU Parted 3.1
Using /dev/md10
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Error: /dev/md10: unrecognised disk label
Model: Linux Software RAID Array (md)                                     
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags: 
(parted) mklabel gpt                                                      
(parted) mkpart primary xfs 2048                                          
End? 40.0TB                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Cancel
(parted) mkpart primary xfs 1024
End? 40.0TB                                                               
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ^C
(parted) q                                                                
Information: You may need to update /etc/fstab.

[[email protected]~]# cat /sys/block/md10/queue/optimal_io_size 
2621440
[[email protected]~]# cat /sys/block/md10/queue/minimum_io_size 
524288
[[email protected]~]# cat /sys/block/md10/alignment_offset 
0
[[email protected]~]# cat /sys/block/md10/queue/physical_block_size 
4096


获取正确的偏移扇区数是将 optimal_io_size 和 alignment_offset 相加然后除以 physical_block_size.
【算出来是640】
[[email protected]~]# parted /dev/md10
GNU Parted 3.1
Using /dev/md10
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: Linux Software RAID Array (md)
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 3      640MB   640MB   512B                 primary
 1      1024MB  40.0TB  40.0TB               primary

(parted) rm 3                                                             
(parted) rm 1
(parted) mkpart primary 1MiB 100%                                         
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? ^C                                                         
(parted) mkpart primary 640MiB 100%                                         
Error: Unable to satisfy all constraints on the partition.
(parted) mkpart primary 640 100%                                       
Error: Unable to satisfy all constraints on the partition.
(parted) p                                                                
Model: Linux Software RAID Array (md)
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  40.0TB  40.0TB               primary

(parted) rm 1
(parted) p
Model: Linux Software RAID Array (md)
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 640 100% 
(parted) p                                                                
Model: Linux Software RAID Array (md)
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End     Size    File system  Name     Flags
 1      640MB  40.0TB  40.0TB               primary

(parted) rm 1
(parted) mkpart primary xfs 640 100%    【这是关键步骤,上面的尝试mkpart primary 都是错的,rm 删掉】
(parted)                                                                  
(parted) p
Model: Linux Software RAID Array (md)
Disk /dev/md10: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End     Size    File system  Name     Flags
 1      640MB  40.0TB  40.0TB               primary

(parted) q                                                                
Information: You may need to update /etc/fstab.

[[email protected]~]# mkfs.xfs /dev/md10
md10    md10p1  
[[email protected]~]# mkfs.xfs /dev/md10
md10    md10p1  
[[email protected]~]# mkfs.xfs /dev/md10
md10    md10p1  
[[email protected]~]# mkfs.xfs /dev/md10p1   【格式化成默认的xfs文件系统】
meta-data=/dev/md10p1            isize=512    agcount=37, agsize=268435328 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=9767210880, imaxpct=5
         =                       sunit=128    swidth=640 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=521728, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[[email protected]~]# 

[[email protected]~]# mkdir /data1
[[email protected]~]# ls /data/
acl-tools  backup  disk-manager
[[email protected]~]# mount /dev/md0 /data/
mount: /dev/md0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/md0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[[email protected]~]# mount /dev/md10 /data1/    【mount挂载】
md10    md10p1  
[[email protected]~]# mount /dev/md10 /data1/
md10    md10p1  
[[email protected]~]# mount /dev/md10 /data1/
md10    md10p1  
[[email protected]~]# mount /dev/md10p1 /data1/
[[email protected]~]# umount /dev/md10
umount: /dev/md10: not mounted
[[email protected]~]# umount /dev/md0
umount: /dev/md0: not mounted
[[email protected]~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  2.7G   27G  10% /
devtmpfs        126G     0  126G   0% /dev
tmpfs           126G  4.0K  126G   1% /dev/shm
tmpfs           126G  2.0G  124G   2% /run
tmpfs           126G     0  126G   0% /sys/fs/cgroup
/dev/sda6       384G   33M  384G   1% /data
/dev/sda3        30G  1.1G   29G   4% /var
/dev/sda1       497M  139M  359M  28% /boot
tmpfs            26G     0   26G   0% /run/user/0
/dev/md10p1      37T   35M   37T   1% /data1
[[email protected]~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Mon Dec  4 15:59:26 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=0e31da41-c199-403e-9052-8752e2ca4e12 /                       xfs     defaults        0 0
UUID=073e19e0-aefb-4ea1-8bb2-e270de8ef7d9 /boot                   xfs     defaults        0 0
UUID=3e0074fe-35ec-4b32-a2b3-5af51b969737 /data                   xfs     defaults        0 0
UUID=08cb2edf-c846-4b47-85ec-39a4e9f82bdb /var                    xfs     defaults        0 0
UUID=fec0ba09-83b2-4d39-9afb-46a06061fbef swap                    swap    defaults        0 0
[[email protected]~]# umount /dev/sda6
umount: /data: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[[email protected]~]# blkid /dev/sd
/dev/sda1  /dev/sda2  /dev/sda3  /dev/sda4  /dev/sda5  /dev/sda6  /dev/sdb1  /dev/sdc1  
[[email protected]~]# umount /dev/md
md0     md0p1   md10    md10p1  
[[email protected]~]# umount /dev/md
md0     md0p1   md10    md10p1  
[[email protected]~]# umount /dev/md0p1
umount: /dev/md0p1: not mounted
[[email protected]~]# blkid /dev/md0p1
/dev/md0p1: UUID="7626c7d9-85d9-4582-a1a3-cde94aa3aa11" TYPE="xfs" PARTLABEL="primary" PARTUUID="393befd5-ce5e-452b-8ea3-69bdc5124b24" 
[[email protected]~]# blkid /dev/md10p1
/dev/md10p1: UUID="544cd698-3a5b-420c-b2c1-22030e763664" TYPE="xfs" PARTLABEL="primary" PARTUUID="1eb5c2a0-22b9-4efd-ab4e-d88419096075" 
[[email protected]~]# vi /etc/fstab   【添加开机自动挂载】

[[email protected]~]# 
[[email protected]~]# 
[[email protected]~]# ping www.baidu.com
connect: Network is unreachable
[[email protected]~]# 
[[email protected]~]# 
[[email protected]~]# 

【重启机器raid1和raid10的两个磁盘名字都变了,验证开机自动挂载是正确的】

/dev/md10  变成了  /dev/md127  

 /dev/md10p1 变成了  /dev/md127p1

[wangzhong@Bastion-3~]# ssh [email protected]
Last login: Wed Dec 20 12:06:42 2023 from 10.10.130.172
[[email protected]~]# 
[[email protected]~]# 
[[email protected]~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  2.7G   27G  10% /
devtmpfs        126G     0  126G   0% /dev
tmpfs           126G  4.0K  126G   1% /dev/shm
tmpfs           126G   25M  126G   1% /run
tmpfs           126G     0  126G   0% /sys/fs/cgroup
/dev/sda3        30G  1.1G   29G   4% /var
/dev/sda1       497M  139M  359M  28% /boot
/dev/md126p1    892G   33M  892G   1% /data
/dev/md127p1     37T   35M   37T   1% /data1
tmpfs            26G     0   26G   0% /run/user/0
[[email protected]~]# cd /data1/
[[email protected]]# 
[[email protected]]# ls
[[email protected]]# fdisk -l

Disk /dev/sda: 480.1 GB, 480103981056 bytes, 937703088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0005448a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62466047    30720000   83  Linux
/dev/sda3        62466048   123906047    30720000   83  Linux
/dev/sda4       123906048   937701375   406897664    5  Extended
/dev/sda5       123908096   132296703     4194304   82  Linux swap / Solaris
/dev/sda6       132298752   937701375   402701312   83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 960.2 GB, 960197124096 bytes, 1875385008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 6469EB04-15C4-446B-BE63-718E7D6FB533


#         Start          End    Size  Type            Name
 1         2048   1875384974  894.3G  Linux filesyste 
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdc: 960.2 GB, 960197124096 bytes, 1875385008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 2DE63C12-C150-4D73-B5F5-156BE7FB408C


#         Start          End    Size  Type            Name
 1         2048   1875384974  894.3G  Linux filesyste 

Disk /dev/sdd: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sde: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdf: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdg: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdh: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdi: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdj: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdj1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdk: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdk1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdl: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdl1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdm: 8001.6 GB, 8001563222016 bytes, 15628053168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdm1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/md127: 40007.1 GB, 40007138017280 bytes, 78138941440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 524288 bytes / 2621440 bytes
Disk label type: gpt
Disk identifier: 80080657-2EE6-41EC-A62A-FD3EF006FB37


#         Start          End    Size  Type            Name
 1      1249280  78138936319   36.4T  Microsoft basic primary
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/md126: 960.1 GB, 960060784640 bytes, 1875118720 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 1FF3CEA7-609B-4204-8B0F-1FF7976F70EF


#         Start          End    Size  Type            Name
 1      3999744   1875118079  892.2G  Microsoft basic primary
[[email protected]]# 

[[email protected]]# mdadm  -D /dev/md
md/      md126    md126p1  md127    md127p1  
[[email protected]]# mdadm  -D /dev/md126
/dev/md126:
           Version : 1.2
     Creation Time : Thu Dec 14 12:21:59 2023
        Raid Level : raid1
        Array Size : 937559360 (894.13 GiB 960.06 GB)
     Used Dev Size : 937559360 (894.13 GiB 960.06 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Wed Dec 20 12:44:30 2023
             State : clean 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : bitmap

              Name : 0
              UUID : 2b7b2fc9:40aa1c39:d577443b:6a0907e4
            Events : 953

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
[[email protected]]# mdadm  -D /dev/md127
/dev/md127:
           Version : 1.2
     Creation Time : Wed Dec 20 11:38:54 2023
        Raid Level : raid10
        Array Size : 39069470720 (37259.55 GiB 40007.14 GB)
     Used Dev Size : 7813894144 (7451.91 GiB 8001.43 GB)
      Raid Devices : 10
     Total Devices : 10
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Wed Dec 20 12:44:37 2023
             State : clean, resyncing 
    Active Devices : 10
   Working Devices : 10
    Failed Devices : 0
     Spare Devices : 0

            Layout : near=2
        Chunk Size : 512K

Consistency Policy : bitmap

     Resync Status : 1% complete

              Name : 10
              UUID : e6b3fd6d:b15db153:afa11b20:7f6a2231
            Events : 940

    Number   Major   Minor   RaidDevice State
       0       8       48        0      active sync set-A   /dev/sdd
       1       8       64        1      active sync set-B   /dev/sde
       2       8       80        2      active sync set-A   /dev/sdf
       3       8       96        3      active sync set-B   /dev/sdg
       4       8      112        4      active sync set-A   /dev/sdh
       5       8      128        5      active sync set-B   /dev/sdi
       6       8      144        6      active sync set-A   /dev/sdj
       7       8      160        7      active sync set-B   /dev/sdk
       8       8      176        8      active sync set-A   /dev/sdl
       9       8      192        9      active sync set-B   /dev/sdm
[[email protected]]# 

[[email protected]~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        30G  2.7G   27G  10% /
devtmpfs        126G     0  126G   0% /dev
tmpfs           126G  4.0K  126G   1% /dev/shm
tmpfs           126G   41M  126G   1% /run
tmpfs           126G     0  126G   0% /sys/fs/cgroup
/dev/sda3        30G  1.1G   29G   4% /var
/dev/sda1       497M  139M  359M  28% /boot
/dev/md126p1    892G   33M  892G   1% /data
/dev/md127p1     37T   35M   37T   1% /data1
tmpfs            26G     0   26G   0% /run/user/0
[[email protected]~]#

这是另外一台重启做完软件raid10 重启系统:

多个磁盘做软件raid并解决分区aligned对齐问题_第1张图片

你可能感兴趣的:(Linux,运维,linux,raid,软件raid,parted大容量磁盘分区)