0

I have never messed with Raid before in Linux but while installing Fedora Desktop I tried to setup Raid1. All seemed well at first but alas I look to have failed.

So here is how my disks came out. (sda is a drive not related to this setup,)

Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5c72ed16

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 905715711 905713664 431.9G fd Linux raid autodetect
/dev/sdb2       905715712 958138367  52422656    25G fd Linux raid autodetect
/dev/sdb3  *    958138368 960235519   2097152     1G fd Linux raid autodetect
/dev/sdb4       960235520 976773119  16537600   7.9G  5 Extended
/dev/sdb5       960237568 976773119  16535552   7.9G fd Linux raid autodetect


Disk /dev/sdc: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x4d506287

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdc1            2048 905715711 905713664 431.9G fd Linux raid autodetect
/dev/sdc2       905715712 958140415  52424704    25G fd Linux raid autodetect
/dev/sdc3  *    958140416 960235519   2095104  1023M fd Linux raid autodetect
/dev/sdc4       960235520 976773119  16537600   7.9G  5 Extended
/dev/sdc5       960237568 976773119  16535552   7.9G fd Linux raid autodetect


Disk /dev/md127: 25 GiB, 26823622656 bytes, 52389888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md126: 1022 MiB, 1071644672 bytes, 2093056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md125: 7.9 GiB, 8462008320 bytes, 16527360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/md124: 431.8 GiB, 463591178240 bytes, 905451520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

My goal was to have the second hard disk as an exact mirror, the mount points I created are /, /home/, /boot, swap and I chose RAID-1 for the type on them all. From the above image it can be determined that the installer did create identical partitions on both disks but sync is broken between them. Here is cat /proc/mdstat:

Personalities : [raid1] 
md124 : active raid1 sdc1[1]
      452725760 blocks super 1.2 [2/1] [_U]
      bitmap: 4/4 pages [16KB], 65536KB chunk

md125 : active raid1 sdc5[1] sdb5[0]
      8263680 blocks super 1.2 [2/2] [UU]

md126 : active raid1 sdb3[0]
      1046528 blocks super 1.2 [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

md127 : active raid1 sdb2[0]
      26194944 blocks super 1.2 [2/1] [U_]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>

So it looks like only swap came out the way I desired. My question is, what is the best way to go about getting the other partitions to follow suit with swap without losing data.

Would running something like this for example mdadm --assemble --run --force --update=resync /dev/md124 /dev/sdb1 /dev/sdc1 get those two partitions to be setup like swap?

  • Just do mdadm -a /dev/md127 /dev/sdc2 for example to add /dev/sdc2 to the /dev/md127 device to complement the /dev/sdb2 already in use there. Unfortunately your /dev/sdc3 is smaller than /dev/sdb3 which is one half of the raid1 mirror, so you won't be able to add /dev/sdc3 to /dev/md126... – wurtel Oct 16 '18 at 13:49
  • ok thanks very much I will give it a go, one quick question, will [0] always be the 'master' partition so to speak? For example if for md124 sdc1 is [1] so if I run the given command mdadm -a /dev/md124 /dev/sdb1 I assume sdb will auto to [0] and sdc1 will mirror sdb1? I just am nervous that sdb1 will mirror sdc1 and bye bye data... – DocSpiegel Oct 16 '18 at 14:09
0

Comment by user wurtel did the trick. Just do:

mdadm -a /dev/md127 /dev/sdc2

for example to add /dev/sdc2 to the /dev/md127 device to complement the /dev/sdb2 already in use there.

As far as the question of sdb(x) being set to [0] in all the partitions, they were and my Raid1 is running in full sync.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.