Ubuntu 22.04下mdadm raid 重置

在Ubuntu 22.04下重置raid里的磁盘

使用mdadm做了raid的磁盘, 再不用raid了以后, 在取下之前,最好重置成普通磁盘,否则在使用时会有各种问题

重置过程

  1. 检查状态
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
NAME      SIZE FSTYPE            TYPE  MOUNTPOINT
loop0       4K squashfs          loop  /snap/bare/5
loop1      62M squashfs          loop  /snap/core20/1587
loop2    63.3M squashfs          loop  /snap/core20/1828
loop4   239.8M squashfs          loop  /snap/firefox/2391
loop5   400.8M squashfs          loop  /snap/gnome-3-38-2004/112
loop6   346.3M squashfs          loop  /snap/gnome-3-38-2004/119
loop7    91.7M squashfs          loop  /snap/gtk-common-themes/1535
loop8    45.9M squashfs          loop  /snap/snap-store/582
loop9    45.9M squashfs          loop  /snap/snap-store/638
loop10   49.8M squashfs          loop  /snap/snapd/18357
loop11    284K squashfs          loop  /snap/snapd-desktop-integration/14
loop12    304K squashfs          loop  /snap/snapd-desktop-integration/49
loop13  241.6M                   loop  /snap/firefox/2432
sda      59.6G                   disk  
├─sda1    512M vfat              part  /boot/efi
└─sda2   59.1G ext4              part  /
nvme0n1 476.9G linux_raid_member disk  
└─md0   953.6G ext4              raid0 /mnt/md0
nvme1n1 476.9G linux_raid_member disk  
└─md0   953.6G ext4              raid0 /mnt/md0
  1. 查看 linux_raid_member 的磁盘是否有挂载点 如果有使用命令
1
umount /mnt/md0

卸载

  1. 停止raid
1
sudo mdadm --stop /dev/md0
  1. 清除 superblock, raid中每块磁盘都要清除
1
2
sudo mdadm --zero-superblock /dev/nvme0n1
sudo mdadm --zero-superblock /dev/nvme1n1
  1. 检查配置文件,是否需要保留 /etc/mdadm/mdadm.conf /etc/fstab
记录并分享
Built with Hugo
主题 StackJimmy 设计