Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[O/S] How do I recover Linux RAID1?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
joybhowmik
Posts: 9
Joined: 2011-01-22 15:58

[O/S] How do I recover Linux RAID1?

#1 Post by joybhowmik »

Hello
I am a new user of Debian Linux 11.
My system is an AMD Ryzen 5 5500U with Radeon Graphics, 12 cores - and for purposes of this discussion has the following storages attached.

1. NVME SSD 0 drive 1 : Disk size: 476.72 GiB, Make and model: WD Blue SN570 500GB , Cylinders: 1915241, Partition table format: GPT.
2. SATA device A :Disk size: 476.72 GiB, Make and model: ATA WD Blue SA510 2., Cylinders: 1915241, Partition table format: MSDOS.

I have volume group debian containing these disks
Volume Group Debian
Volume Group Debian

Volume Group Debian has physical volume md0 configured as a RAID1 device
Physical Volume md0
Physical Volume md0
Physical volume md0 is made up of two logical volumes : root and swap
Logical  volume md0 with root and  swap
Logical volume md0 with root and swap
The problem is that one of the RAID1 partitions has failed (/dev/sda1).
1 partition  has failed
1 partition has failed
I looked for a hardware failure on the drive, but could not find anything suggesting a disk failure. Attaching status/diagnostics here:
page 1/3  disk status/diagnostics
page 1/3 disk status/diagnostics
page 2/3  disk status/diagnostics
page 2/3 disk status/diagnostics
page 3/3  disk status/diagnostics
page 3/3 disk status/diagnostics
Next, I tried removing this partition from /dev/md0 and adding it back but that did not help.
What other steps should I take to rebuild the RAID1 array without suffering data loss or having to reinstall Linux?
Please help.

User avatar
Northpoint
Posts: 88
Joined: 2020-12-19 10:51
Location: USA
Has thanked: 48 times
Been thanked: 13 times

Re: [O/S] How do I recover Linux RAID1?

#2 Post by Northpoint »

Here is a quick link to the steps involved.
https://www.thegeekdiary.com/replacing- ... ray-mdadm/

I do not run LVM on my systems so I cannot advise if there is something that must be done there after replacement.

A side note: I have always considered Western Digital Blue drives to be of not very good quality. I have gone with the WD Black drives.
Get your linux on.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1395
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: [O/S] How do I recover Linux RAID1?

#3 Post by steve_v »

--fail then --remove the faulty device, install replacement, partition as/if required (you didn't show any mdadm output, so I don't know you're using partitions or raw devices) then --add it to the array.
Resync should begin automatically, and may be monitored in /proc/mdstat. 'man mdadm' has more details on these operations.

Also please post diagnostic information as plain text inside code tags, not a bunch of images. Aside from being a PITA to read, screenshots of some web UI don't provide anywhere near as much information as the CLI tools.
Like so:

Code: Select all

# mdadm --detail /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Jul  2 13:43:45 2014
        Raid Level : raid1
        Array Size : 2095040 (2045.94 MiB 2145.32 MB)
     Used Dev Size : 2095040 (2045.94 MiB 2145.32 MB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Mon Jan 23 07:12:38 2023
             State : clean 
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

Consistency Policy : resync

              Name : damnation:0  (local to host damnation)
              UUID : 274480ee:700f77bd:fc40fc2a:b55af40f
            Events : 1569

    Number   Major   Minor   RaidDevice State
       3      65       17        0      active sync   /dev/sdr1
       2      65        1        1      active sync   /dev/sdq1
joybhowmik wrote: 2023-01-23 14:02without suffering data loss or having to reinstall
Avoiding data-loss is what backups are for. RAID is not a substitute for good backups, rather its purpose is to preserve system availability in the event of a drive failure.

Northpoint wrote: 2023-01-23 20:41I do not run LVM on my systems so I cannot advise if there is something that must be done there after replacement.
There isn't, at least AFAIK. LVM is a layer above the software RAID, it don't know and it don't care.
Northpoint wrote: 2023-01-23 20:41I have always considered Western Digital Blue drives to be of not very good quality.
These days I consider all cheap "desktop" drives too unreliable to store anything important on. The OP at least has the sense to include redundancy, and that's the only situation in which I would consider them even remotely fit for purpose.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

joybhowmik
Posts: 9
Joined: 2011-01-22 15:58

Re: [O/S] How do I recover Linux RAID1?

#4 Post by joybhowmik »

Output of mdadm --detail /dev/md0 as requested below... I suppose I can go ahead with the restoration instructions in the link ?: https://www.thegeekdiary.com/replacing- ... ray-mdadm/

EDIT: the only trouble with the above set of instructions is that the command
# sfdisk -d /dev/sda | sfdisk /dev/sdb or in my case sudo sfdisk -d /dev/nvme0n1p1 | sfdisk /dev/sda fails with
bash: sfdisk: command not found
Clueless about how to proceed with the CLI.


**********************88************
/dev/md0:
Version : 1.2
Creation Time : Wed Oct 26 20:45:39 2022
Raid Level : raid1
Array Size : 488252416 (465.63 GiB 499.97 GB)
Used Dev Size : 488252416 (465.63 GiB 499.97 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Intent Bitmap : Internal

Update Time : Tue Jan 24 16:19:34 2023
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0

Consistency Policy : bitmap

Name : i1670-debian:0 (local to host i1670-debian)
UUID : c8438fd6:e8d82f85:05a98cf0:9a357868
Events : 1309052

Number Major Minor RaidDevice State
0 259 1 0 active sync /dev/nvme0n1p1
- 0 0 1 removed

1 8 1 - faulty /dev/sda1

User avatar
Northpoint
Posts: 88
Joined: 2020-12-19 10:51
Location: USA
Has thanked: 48 times
Been thanked: 13 times

Re: [O/S] How do I recover Linux RAID1?

#5 Post by Northpoint »

bash: sfdisk: command not found

I see that sfdisk is not available as a separate package by itself. Running "sudo apt install sfdisk" says that it is part of another package. To search for what package it belongs to I had to install apt-file.

Code: Select all

sudo apt install apt-file
Then I had to update it:

Code: Select all

sudo apt-file update
Then I can do a search for sfdisk to install it:

Code: Select all

sudo apt-file search sfdisk
coffee@buster:~$ sudo apt-file search sfdisk
fdisk: /sbin/sfdisk
fdisk: /usr/share/bash-completion/completions/sfdisk
fdisk: /usr/share/man/man8/sfdisk.8.gz
manpages-de: /usr/share/man/de/man8/sfdisk.8.gz
manpages-ja: /usr/share/man/ja/man8/sfdisk.8.gz
It appears to belong to the fdisk package.

Code: Select all

sudo apt install fdisk
Get your linux on.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1395
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: [O/S] How do I recover Linux RAID1?

#6 Post by steve_v »

joybhowmik wrote: 2023-01-24 10:51sfdisk -d /dev/sda | sfdisk /dev/sdb or in my case sudo sfdisk -d /dev/nvme0n1p1 | sfdisk /dev/sda
'tis just a way to copy the partition table from one device to another, such that the partitions for the RAID1 are exactly the same size even on mismatched drives.
There's no reason you couldn't do the same with another tool, sfdisk is just the quickest and easiest way.

Northpoint wrote: 2023-01-24 16:39To search for what package it belongs to I had to install apt-file.
Pro tip: installing the command-not-found package will both pull in apt-file and partially automate its use, e.g.

Code: Select all

# sfdisk
Command 'sfdisk' not found, but can be installed with:
apt install fdisk
If you try it as a regular user it'll even remind you to "Please ask your administrator." :P
The CLI is far more user-friendly than many believe.

Then there's 'thefuck', the use of which I leave as an exercise for the adventurous reader (yes, it's a real package, and that's its name). ;)
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Post Reply