Score:0

setup Raid1 on running system

be flag

I have 2 disk sda and sdb with several partition. I have to make a raid1 of the running system. I managed to setup raid1 with md0 on root but there are 2 more partition which are mounted on /home and /var which i cannot add to raid. Below are the configuration....can someone guide what is wrong and how i can bring these md127 and md2

NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT

sda         8:0    0 931.5G  0 disk
├─sda1      8:1    0   9.3G  0 part
│ └─md0     9:0    0   9.3G  0 raid1 /
├─sda2      8:2    0   7.5G  0 part  [SWAP]
├─sda3      8:3    0     1K  0 part
├─sda5      8:5    0  20.5G  0 part  /home
├─sda6      8:6    0  55.9G  0 part  /var
└─sda7      8:7    0 838.4G  0 part

sdb         8:16   0 931.5G  0 disk
├─sdb1      8:17   0   9.3G  0 part
│ └─md0     9:0    0   9.3G  0 raid1 /
├─sdb2      8:18   0   7.5G  0 part
├─sdb3      8:19   0     1K  0 part
├─sdb5      8:21   0  20.5G  0 part
│ └─md127   9:127  0  20.5G  0 raid1
└─sdb6      8:22   0  55.9G  0 part
  └─md2     9:2    0  55.9G  0 raid1

sr0        11:0    1  1024M  0 rom

---------------------------------------------
md0 : active raid1 sdb1[1] sda1[2]
      9735168 blocks super 1.2 [2/2] [UU]
md127 : active (auto-read-only) raid1 sdb5[1]
    21466112 blocks super 1.2 [2/1] [_U]
md2 : active (auto-read-only) raid1 sdb6[1]
    58559488 blocks super 1.2 [2/1] [_U]
unused devices: <none>

---------------------------------------------
/dev/md127:
  
         Version : 1.2
  
   Creation Time : Mon Jun 26 18:21:00 2023
      Raid Level : raid1
      Array Size : 21466112 (20.47 GiB 21.98 GB)
   Used Dev Size : 21466112 (20.47 GiB 21.98 GB)
    Raid Devices : 2
   Total Devices : 1
     Persistence : Superblock is persistent
       Update Time : Mon Jun 26 18:21:00 2023
           State : clean, degraded
  
  Active Devices : 1
 Working Devices : 1
  Failed Devices : 0
   Spare Devices : 0


Consistency Policy : resync

              Name : dns003:1  (local to host dns003)
  
            UUID : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  
          Events : 0

    Number   Major   Minor   RaidDevice State
  
     -       0        0        0      removed
  
     1       8       21        1      active sync   /dev/sdb5

sudo mdadm /dev/md127 -a /dev/sda5

mdadm: Cannot open /dev/sda5: Device or resource busy


Nikita Kipriyanov avatar
za flag
There is no way to do it safely on the running system. Boot from rescue media and do it like that. To be able to do such things online you had to already have some more flexible schemes, like LVM.
codelearner1029 avatar
be flag
I can reboot one or 2 times if needed ....sofar to bring md0 up i had done a reboot...Could you please provide some information on this
Nikita Kipriyanov avatar
za flag
I don't understand what information to provide. You need a partitioning scheme? An outline of a process of migrating the installed system to the RAID-backed one? The question as it exists presently basically asks "how to avoid security warning and destroy the existing filesystem and the data", are you sure you need *that*? If not, explain what you want *properly*, what state it has now, what state you want it to be, and what exactly is the problem going from one to another.
codelearner1029 avatar
be flag
currently we have only sda with 3 partition and a raid1 has to be created with sdb with same partition scheme as sda which is newly added so that if there is a faulty disk then it will not be a problem.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.