LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   CentOS7, software RAID1 and encryption. How to recover some data (https://www.linuxquestions.org/questions/linux-software-2/centos7-software-raid1-and-encryption-how-to-recover-some-data-4175710190/)

Basher52 03-30-2022 11:45 AM

CentOS7, software RAID1 and encryption. How to recover some data
 
I have to ask for help because I do not dare destroy it.
I will not do anything with these disk anymore 'cos I'm too scared of destroying the data i need.


I got 2 disks that was in a CentOS 7Linux software RAID1(mirror) system with my boot system and other partitions.
On one of those extra partitions I got drivers that I need bad.
Although it's CentOS the RAID1 and encryption should be equal with eg. Arch as this is not dependent of the architecture itself (right?)
All the drives except boot and those needed for that are encrypted with a password that I know.
I just replaced these drives with others and installed a fresh Rocky Linux system but I need drivers from these.
As I've understood it a RAID1 system can be broken without damaging the data so it should be(?) possible to fix the data from one of these drives.

As long I can get those drivers from one of these 2 disks, everything is mostly not important.
Although it could be really great to look into some configs that are places in /etc as that also will help out a lot as those are system specific.

As you see one partition got mounted(only from this disk) and asked for the encryption password and that worked, too bad it's not on this one.

If I remember correctly it's on the md127 partition that has the drivers.

If I try to mount the partitions that didn't automount(udiskie) I get this:
Code:

    ┌─[basher52@ArchGamer]~
    └──❯ sudo mount /dev/sdb1 /mnt/1/
    mount: /mnt/1: unknown filesystem type 'linux_raid_member'.
    ┌─[basher52@ArchGamer]~
    └──❯ sudo mount /dev/md127 /mnt/1/
    mount: /mnt/1: can't read superblock on /dev/md127.

but i guess since it's a RAID and and also encrypted I can't just mount these devices, right?

A long time ago when I had disk problems with windows someone told me to clone the partition in question and than work on that, if any error was done I can always use a copy of it.
Is this a plausible here, just to be extra careful so to speak.


Some info:...

FDISK:
Code:

   
    Disk /dev/sdb: 465,76 GiB, 500107862016 bytes, 976773168 sectors
    Disk model: WDC WD5000AAKS-6
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x0005fb04

    Device    Boot    Start      End  Sectors  Size Id Type
    /dev/sdb1            2048 314836991 314834944 150,1G fd Linux raid autodetect
    /dev/sdb2      314836992 440731647 125894656    60G fd Linux raid autodetect
    /dev/sdb3      440731648 545654783 104923136    50G fd Linux raid autodetect
    /dev/sdb4      545654784 976773119 431118336 205,6G  5 Extended
    /dev/sdb5      545656832 650579967 104923136    50G fd Linux raid autodetect
    /dev/sdb6      650582016 755505151 104923136    50G fd Linux raid autodetect
    /dev/sdb7      755507200 860430335 104923136    50G fd Linux raid autodetect
    /dev/sdb8      860432384 876955647  16523264  7,9G fd Linux raid autodetect
    /dev/sdb9  *    876957696 881156095  4198400    2G fd Linux raid autodetect
    /dev/sdb10      881158144 976773119  95614976  45,6G fd Linux raid autodetect

LSBLK:
Code:

    NAME                                  MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
    sda                                    8:0    0 111,8G  0 disk
    ├─sda1                                  8:1    0  500M  0 part
    ├─sda2                                  8:2    0    80G  0 part  /
    └─sda3                                  8:3    0  31,3G  0 part  /home
    sdb                                    8:16  0 465,8G  0 disk
    ├─sdb1                                  8:17  0 150,1G  0 part
    │ └─md127                              9:127  0    0B  0 md
    ├─sdb2                                  8:18  0    60G  0 part
    │ └─md125                              9:125  0    0B  0 md
    ├─sdb3                                  8:19  0    50G  0 part
    │ └─md126                              9:126  0    0B  0 md
    ├─sdb4                                  8:20  0    1K  0 part
    ├─sdb5                                  8:21  0    50G  0 part
    │ └─md123                              9:123  0    0B  0 md
    ├─sdb6                                  8:22  0    50G  0 part
    │ └─md122                              9:122  0    0B  0 md
    ├─sdb7                                  8:23  0    50G  0 part
    │ └─md120                              9:120  0    50G  0 raid1
    │  └─luks-60d002aa-c13d-4161-933e-603b132d4bf0
    │                                    254:0    0    50G  0 crypt /run/media/basher52/aa84fd3c-5568-4aab-a081-1c36723246d7
    ├─sdb8                                  8:24  0  7,9G  0 part
    │ └─md121                              9:121  0    0B  0 md
    ├─sdb9                                  8:25  0    2G  0 part
    │ └─md119                              9:119  0    0B  0 md
    └─sdb10                                8:26  0  45,6G  0 part
      └─md124                              9:124  0    0B  0 md
    sdc                                    8:32  1    0B  0 disk
    sdd                                    8:48  1    0B  0 disk
    sde                                    8:6


computersavvy 03-30-2022 12:50 PM

You said
Code:

All the drives except boot and those needed for that are encrypted with a password that I know.
With that said, it seems you already have everything needed.
Raid 1 is mirroring, so it is simple to connect just one of each mirrored drive pair and activate the array. You did not say, but with raid 1 I would assume only 2 drives involved. If using raid 10 or raid 1 with 4 or more drives you would have a much different scenario.

Once the array is activated then by knowing the password you should be able to open and mount the device and read the data needed.

If I am correct that there are only 2 drives in the raid 1 array then connect the one drive and activate it.
A quick search for "linux activate a raid 1 array with 1 drive" gave this as the first link. The instructions seem pretty clear.

Basher52 03-31-2022 03:14 PM

@computersavvy
Well something like that page and that, did the work, but i was scared ass * to trash it.
Took me some hours, just to be sure to not to do anything wrong, as I've done before. Too bad you're not doing this daily so you know it when it's needed :P

Thanks for the answer though.
Had one little problem with this though and that was that the device's partition already was 'connected' to an md-device but it couldn't as I did this on anoither machine, but "mdadm stop" finally released it and made it all work.


All times are GMT -5. The time now is 12:27 PM.