[Error Report] RockyLinux went crazy and created a Raid1 mirror partition. The Raid partition disappeared after restarting! In addition, after using the Raid mode on the ASUS motherboard, the hard disk cannot be found in the system.

Preface

In order to get rid of the dependence on professional NAS, I decided to use a Linux server to install the NAS program to implement the NAS function. Here I need to use the Raid function. Since I currently only have 3 SSDs (256G+500G+500G), in ChatGPT According to the recommendation, we still use a 256G system disk + two 500G hard disks to form an array in Raid 1. The result is deceptive!

The raid array created using mdadm disappeared after restarting! ! Then all my data was lost! ! Moreover, the md0 raid disk array cannot even be found in /dev. How can it be used? Will it stop shutting down after forming a mirror? This definitely won't work, and then I embarked on a long road of pitfalls.

The source of the pit

Since the information of ChatGPT may be relatively backward, it does not know that my hard disk is a GPT partition. Forming a Raid will cause problems with the partition table, so the answer it gave me is:

I said that the partition could not be found after restarting. ChatGPT responded to me by adding a message to /etc/fstab:

/dev/md0    /mnt/raid    ext4    defaults    0    0

I thought this would solve the problem, but it turned out that it couldn't be solved at all. Because of the partition table problem, even the md0 Raid disk array was missing. Then the boot was stuck for a long time because /dev/md0 could not be loaded successfully. I also found out after waiting for a long time to enter the system.

Then I suspected that I was impatient and didn't wait.

cat /proc/mdstat

After the execution reached 100%, the server was restarted, and then I waited for a full hour during the meal break! ! Wait until all the disk images are synchronized, then restart, but the result is still the same, the disk partition is lost! ! This makes me so angry! !

Solution

To save everyone’s time, I will explain the solution first, and then I will discuss the ASUS motherboard Raid problem later.

ChatGPT made a serious mistake - it cannot directly operate the two disks /dev/sdb and /dev/sda, but needs to operate the partitions created by them respectively! !

In other words, the two disks /dev/sdb and /dev/sda must be partitioned before the Raid operation can be performed. This is something that ChatGPT itself does not know.

The execution process is as follows:

View partition status

First, you need to lsblk to check the disk partition status of your server. Here is what I see:

/dev/sda: 256GB, RockyLinux system installation disk, including mounted root directory and user directory

/dev/sdb: 500GB data disk

/dev/sdc: 500GB data disk

Perform partition operations

fdisk /dev/sdb

It is recommended to press m and then press Enter to check the function of fdisk

I personally recommend pressing d first, then w

Notice! ! ! ! ! This step will clear all data on the disk, please operate with caution! !

The purpose of this step is to delete the partitions in the disk (especially if there is only one partition, all contents will be deleted)

and then execute

fdisk /dev/sdb

Execute after entering the fdisk function

g, then n, and finally w

When pressing n, you need to specify the partition size. I just press Enter here and the created partition size is equal to the size of my disk. Then you can get another partition like /dev/sdb1 under /dev/sdb.

Perform the same operation on /dev/sdc, and finally get the partition information as shown in the figure:

Create Raid Array

 The remaining steps are the same as ChatGPT, but the command needs to be changed.

What is executed is:

mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1

What is used here is /dev/sdb1 and /dev/sdc1! ! Instead of the entire disk, this is the crux of the problem. I was fooled by ChatGPT for 4 hours! !

Follow-up operations

The subsequent operations are:

# 查看Raid磁盘同步进度
cat /proc/mdstat

# 将Raid阵列格式化为ext4分区
mkfs.ext4 /dev/md0

# 由于我不想将这个分区藏太深,直接在根目录创建了一个/data目录
mkdir /data

# 将Raid阵列分区挂载到/data路径下
mount /dev/md0 /data

# 将Raid信息写入/etc/mdadm.conf中
mdadm --detail --scan | sudo tee -a /etc/mdadm.conf

Finally, you need to fill in the partition information in /etc/fstab

vi /etc/fstab

Enter on the last line:

/dev/md0    /data    ext4    defaults    0    0

Then press:wq to save

In fact, you can restart the server without waiting for /proc/mdstat to be executed. An empty disk will not affect it at all.

Check the effect after restarting

Since the loading order of each disk is random after restarting, what I display here is as follows:

The problem of array loss after restarting is finally solved! In this case, blogging is necessary to avoid stepping into the same trap in the future.

ASUS Dakeng RAID missing driver

At that time, because the soft Raid in the system hit a wall, I wanted to use the Raid function that comes with the ASUS motherboard, that is, in the motherboard BIOS, change the SATA type from AHCI to RAID, and directly do the hard Raid. For hard Raid, you can refer to the blogs written by other colleagues. I will skip it here. The general steps are

1. Change the SATA mode from AHCI to RAID in BIOS Advance and restart

2. After restarting, enter the BIOS again. There will be an additional RAID related setting at the end of Advance.

3. Select the required disk after creating the array, and then save it. The final result is as follows:

Then I entered the system and found that everything was fried! Enter the dracut environment directly and report

/dev/mapper/rl-root does not exist
/dev/rl/root does not exist
/dev/rl/swap does not exist

That is to say, all my partitions are lost. I can also see through ls /dev that all partitions are missing! I thought there was a problem with my partition or the Raid. In anger, I deleted all the partition contents in the ASUS BIOS and reorganized the Raid from 0. As a result, when I went to install RockyLinux, I found that I had entered the installation environment. Finally, the disk was empty. I didn’t believe it at the time, so I tried another Windows 11 installation package and found that I still couldn’t find a disk.

 At that time, I suspected that it was a Raid driver problem, that is, the installation packages of Windows and RockyLinux did not include ASUS Raid drivers. I directly went to ASUS customer service and asked why. ASUS customer service was very professional and directly said that the Raid driver was missing. , asked me to go to ASUS official website to download the driver. I searched for the driver for a long time but couldn't find it, so I had to be a helper and ask customer service to send it to me directly.

It is also very simple to use.

 Unzip it and put it into a Windows installation USB flash drive (mine is an AMD motherboard, this driver cannot be used on Intel motherboards)

Click "Load Driver" and select the directory

 

rcraid is the directory. After loading the driver, my Raid partition appeared. I tried it and was able to install Windows 11 normally and reboot into the system normally.

The disk inside is called AMD-Raid Array N SCSI Disk Device

Originally, I thought I would just use hard Raid. Then I asked ASUS customer service if there is a CentOS version of this driver. The customer service said that this driver does not have a Linux version. I sighed deeply at that time and had to compete with soft Raid. Fortunately, in the end I It really worked out.

Guess you like

Origin blog.csdn.net/DCTANT/article/details/132528510