创建新的 raid1 mdadm luks 设备会创建两个不需要的分区

创建新的 raid1 mdadm luks 设备会创建两个不需要的分区

我正在尝试使用 创建 raid1 (带有mdadm) 设备luks。但是,它会创建两个分区,而不是一个,如下所示:

sde              8:64   0   3,6T  0 disk  
`-sde1           8:65   0   3,6T  0 part  
  `-md0          9:0    0   3,6T  0 raid1 
    |-storage2 253:2    0   3,6T  0 crypt 
    |-md0p1    259:0    0 750,7G  0 part  
    `-md0p2    259:1    0   1,4T  0 part  
sdf              8:80   0   3,6T  0 disk  
`-sdf1           8:81   0   3,6T  0 part  
  `-md0          9:0    0   3,6T  0 raid1 
    |-storage2 253:2    0   3,6T  0 crypt 
    |-md0p1    259:0    0 750,7G  0 part  
    `-md0p2    259:1    0   1,4T  0 part  

这是我使用的程序:

cfdisk /dev/sde
cfdisk /dev/sdf
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sde1 /dev/sdf1
cryptsetup -y -v luksFormat /dev/md0
cryptsetup luksOpen /dev/md0 storage2
mkfs.ext4 /dev/mapper/storage2
mkdir -p /media/storage2
mount /dev/mapper/storage2 /media/storage2

为什么使用我看到和lsblk都有两个分区?我怎样才能避免它?sdesdf

编辑:当使用 创建数组时mdadm,我得到以下信息,也许这可能是问题的原因,但如何摆脱它?

$ mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sde1 /dev/sdf1
mdadm: /dev/sde1 appears to be part of a raid array:
       level=raid1 devices=2 ctime=Mon Jan 23 20:01:19 2023
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
mdadm: /dev/sdf1 appears to be part of a raid array:
       level=raid1 devices=2 ctime=Mon Jan 23 20:01:19 2023
mdadm: size set to 3906885440K
mdadm: automatically enabling write-intent bitmap on large array
Continue creating array? 

答案1

问题解决了。像以前一样做一切,但然后:

fdisk /dev/md0
d
w
q
cryptsetup -y -v luksFormat /dev/md0
mkfs.ext4 /dev/mapper/storage2
mkdir -p /media/storage2
mount /dev/mapper/storage2 /media/storage2

相关内容