Skip to contentSkip to conversation

Adding a device to an active RAID1 array

DISCUSSION Bill Cizek 2 participants 2 messages Jan 18, 2006 MD RAID

lore
Share & tools
lore

Bill Cizek

author
#0 lore raw

Hi,

Are there any known issues with changing the number of active devices in a RAID1 array?

I'm trying to add a third mirror to an existing RAID1 array of two disks.

I have /dev/md5 as a mirrored pair of two 40 GB disks. Directly on top of it is a 40 GB XFS filesystem.

When I do "mdadm --grow /dev/md5 -n 3" the count of devices changes from 2 to 3, as expected. If the XFS filesystem is mounted, the array size changes to 3.0 GB.
If it is not mounted everything works fine.

Is this supposed to work, is it required that the array be inactive to add a disk, or am I just doing something stupid?

If there is a better forum for this question, please direct me there. In any case TIA for any help.

-Bill

#1 lore raw
Quoted 5 lines · On Wednesday January 18, [email protected] wrote:

Hi,

Are there any known issues with changing the number of active devices in a RAID1 array?

There is now, thanks.

Quoted 6 lines

I'm trying to add a third mirror to an existing RAID1 array of two disks.

I have /dev/md5 as a mirrored pair of two 40 GB disks. Directly on top of it is a 40 GB XFS filesystem.

Quoted 8 lines

When I do "mdadm --grow /dev/md5 -n 3" the count of devices changes from 2 to 3, as expected.
If the XFS filesystem is mounted, the array size changes to 3.0 GB. If it is not mounted everything works fine.

Is this supposed to work, is it required that the array be inactive to add a disk, or am I just doing
something stupid?

It is supposed to work, it doesn't, but it is the code doing something stupid, not you.
Try the patch below.

Quoted 3 lines

If there is a better forum for this question, please direct me there. In any case TIA for any help.

This is exactly the correct forum.

NeilBrown

### Diffstat output

 ./drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c renamed from drivers/md/md.c~current~ +1 -1
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
@@ -3488,7 +3488,7 @@ static int update_raid_disks(mddev_t *md
 		bdev = bdget_disk(mddev->gendisk, 0);
 		if (bdev) {
 			mutex_lock(&bdev->bd_inode->i_mutex);
-			i_size_write(bdev->bd_inode, mddev->array_size << 10);
+			i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10);
 			mutex_unlock(&bdev->bd_inode->i_mutex);
 			bdput(bdev);
 		}