1

I have been using my HDD as part of software RAID 1 array with the second device missing. I configured it this way to be able to add another disk when I have a chance. Now I've bought the second disk and tried running this command:

mdadm --add /dev/md0 /dev/sdb1

But I'm getting this error:

mdadm: /dev/sdb1 not large enough to join array

The output of gparted is:

Disk /dev/sda: 3907029167s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start  End          Size         File system  Name  Flags
 1      2048s  3907029133s  3907027086s  ext4

Disk /dev/sdb: 3907029167s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start  End          Size         Type     File system  Flags
 1      2048s  3907028991s  3907026944s  primary  ext4

Is there a way to add the second disk to the array without losing data on the first one?

Should the first one be resized to match the new disk?

2 Answers 2

0

NOTE: YOU SHOULD BACK UP YOUR DATA FIRST - ANY BLOCK DEVICE ACTIONS CARRY RISK OF DATA LOSS.

It looks to me like the actual disk sizes are identical, but the first is partitioned using gpt and the second one is partitioned with msdos - making it fractionally smaller (obviously at the very edge of what MBR can handle). Try reformatting the disk as gpt in gparted.

ASSUMING ITS A NEW DISK - If you have difficulties, try zeroing out the first bit of the disk so it appears unitialised (and assuming the new disk is /dev/sdb) with dd if=/dev/zero of=/dev/sdb bs=1024 count=1

Once you have done this repartition the disk to its full size and then add it to the array.

The alternative would be to shrink the current RAID array slightly so it would fit. This is more likely to be problematic, but if you really want to do it you can find instructions here.

Another option (which would be non-standard, but might work) would be to use /dev/sdb rather then /dev/sdb1 for the second disk - this could cause issues with booting if you boot from partitions associated with the RAID array, and is not a best practice, but is technically doable.

0

I just had this issue. run: sudo blockdev --report /dev/sdb1

sudo blockdev --report /dev/sdb2

If sdb2 is larger then run: try mdadm --add /dev/md0 /dev/sdb2

Worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .