Repair RAID1 broken

naturlight

Member
Jan 2, 2011
65
0
6
Hi everybody,
Tonight i get a problem with my raid

My config :

root@vd0:~# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0009f0a7

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1306 10485760+ fd Linux raid autodetect
/dev/sdb2 1306 121536 965746688 fd Linux raid autodetect
/dev/sdb3 121536 121601 525536 82 Linux swap / Solaris

Disk /dev/md1: 10.7 GB, 10737352704 bytes
2 heads, 4 sectors/track, 2621424 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md2: 988.9 GB, 988924542976 bytes
2 heads, 4 sectors/track, 241436656 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/dm-0: 894.4 GB, 894431133696 bytes
255 heads, 63 sectors/track, 108741 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table
root@vd0:~# lvdisplay
/dev/sda: read failed after 0 of 4096 at 0: Input/output error
/dev/sda1: read failed after 0 of 2048 at 0: Input/output error
/dev/sda2: read failed after 0 of 4096 at 0: Input/output error
/dev/sda3: read failed after 0 of 4096 at 0: Input/output error
--- Logical volume ---
LV Name /dev/pve/data
VG Name pve
LV UUID e8MF3C-pIK1-PVqK-VaaN-ER4c-IFRY-zIltoY
LV Write Access read/write
LV Status available
# open 1
LV Size 833.00 GB
Current LE 213249
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:0

So let's check the raid
root@vd0:~# cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4]
md2 : active raid1 sda2[2](F) sdb2[1]
965746624 blocks [2/1] [_U]

md1 : active raid1 sda1[2](F) sdb1[1]
10485696 blocks [2/1] [_U]

unused devices: <none>
I see [_U] , so let assume the sda2 is faultly and sda1 too
to repair it, i read i have to remove this partition from the raid

mdadm -r /dev/md2 /dev/sda2
mdadm -r /dev/md1 /dev/sda1
then i try to copy the disk but it's not working :(

sfdisk -d /dev/sdb2 | sfdisk /dev/sda2
sfdisk -d /dev/sdb1 | sfdisk /dev/sda1
I get this error :
root@vd0:~# sfdisk -d /dev/sdb1 | sfdisk /dev/sda1
Checking that no-one is using this disk right now ...
Warning: start=4096 - this looks like a partition rather than
the entire disk. Using fdisk on it is probably meaningless.
[Use the --force option if you really want this]
BLKRRPART: Invalid argument
OK
Warning: start=4096 - this looks like a partition rather than
the entire disk. Using fdisk on it is probably meaningless.
[Use the --force option if you really want this]
root@vd0:~# sfdisk --force -d /dev/sdb1 | sfdisk /dev/sda1
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK
Warning: start=4096 - this looks like a partition rather than
the entire disk. Using fdisk on it is probably meaningless.
[Use the --force option if you really want this]
If anybody could help ? :)

Regards,
 
Last edited:
Hi,
softwareraids are not supported - so this is not the right forum to get support for this ;-)

But anyway... your mdstat and fdisk -l shows, that your sda is damage! So you can't copy data back (and you don't need this).
Trow sda away. Put an new disk (same size or bigger) in the slot. Create the same partitiontable on the disk, and then add sda1 and sda2 to the raids.
When syncing is finish you should also install grub again - you missed them on sda.

Udo
 
Hi,
two things:
1.
if your new disk is fine you should add them with:
Code:
[FONT=monospace]
[/FONT]mdadm --add  /dev/md1 /dev/sda1
mdadm --add  /dev/md2 /dev/sda2
2.
your lvdisplay shows errors about sda1-sda3. You use this devices as md-devices, so lvm should not use sda1 and sdb1 (and so on) directly. You must switch the devices off in lvm.conf (with filter) and only md1 +2.
Why lvdisplay gives an error about sda3? this looks not to be part of an raid??

Udo
 
I change my disk and do this (solution for other in my case)

Copy all partition on the new disk (sda)

sfdisk -d /dev/sdb | sfdisk --force /dev/sda

Verify

# fdisk -l /dev/sdb /dev/sda

Put the new partition on the RAID

mdadm --manage /dev/md2 --add /dev/sda2
mdadm --manage /dev/md1 --add /dev/sda1


root@vd0:~# mdadm --manage /dev/md2 --add /dev/sda2
mdadm: added /dev/sda2
root@vd0:~# mdadm --manage /dev/md1 --add /dev/sda1
mdadm: added /dev/sda1

The raid1 is syncing automaticly

root@vd0:~# cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4]
md2 : active raid1 sda2[2] sdb2[1]
965746624 blocks [2/1] [_U]
[>....................] recovery = 0.2% (2642816/965746624) finish=388.0min speed=41364K/sec

md1 : active raid1 sda1[2] sdb1[1]
10485696 blocks [2/1] [_U]
resync=DELAYED
 
I change my disk and do this (solution for other in my case)

Copy all partition on the new disk (sda)

sfdisk -d /dev/sdb | sfdisk --force /dev/sda

Verify

# fdisk -l /dev/sdb /dev/sda

Put the new partition on the RAID

mdadm --manage /dev/md2 --add /dev/sda2
mdadm --manage /dev/md1 --add /dev/sda1


root@vd0:~# mdadm --manage /dev/md2 --add /dev/sda2
mdadm: added /dev/sda2
root@vd0:~# mdadm --manage /dev/md1 --add /dev/sda1
mdadm: added /dev/sda1

The raid1 is syncing automaticly

root@vd0:~# cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4]
md2 : active raid1 sda2[2] sdb2[1]
965746624 blocks [2/1] [_U]
[>....................] recovery = 0.2% (2642816/965746624) finish=388.0min speed=41364K/sec

md1 : active raid1 sda1[2] sdb1[1]
10485696 blocks [2/1] [_U]
resync=DELAYED

What about the GRUB, did you reinstalled to the new disk?
When i had some failure tests with raid1 soft proxmox, i always had to put grub on the new disk also.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!