Skip to contentSkip to conversation

Online resize

DISCUSSION Wayne Gemmell 4 participants 13 messages Mar 11, 2008 – Apr 29, 2008 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi all

I'd like to do an online resize for my RAID5 drives now that I've upgraded them to 500GB drives. Now I'm a bit stuck. I assume the steps would be the following.

1) Resize partitions
2) Drop EXT3 journal
3) run e2resize
4) Recreate journal.

Are there any raid specific things I have to do to get this to work. Am I on the right track?

Signature · 2 lines
Regards
Wayne 
#1 lore raw
Quoted 6 lines · Wayne Gemmell

Hi all

I'd like to do an online resize for my RAID5 drives now that I've upgraded them to 500GB drives. Now I'm a bit stuck. I assume the steps would be the following.

Quoted 8 lines

1) Resize partitions
2) Drop EXT3 journal
3) run e2resize
4) Recreate journal.

Are there any raid specific things I have to do to get this to work. Am I on the right track?

Sort of. The steps you'll need are:

1) Resize partitions (usually a drop & recreate step - this doesn't affect the data though).
2) Force the OS to be aware of the new partition sizes - either a reboot or using partprobe.
3) Grow the array (mdadm --grow) - check the manual page for details.
4) Resize the filesystem (resize2fs).

There shouldn't be any need to drop & recreate the journal (I've never done anyway - I guess it may be needed if you want to resize it).

HTH,
Robin

Signature · 4 lines
     ___        
    ( ' }     |       Robin Hill        <[email protected]> |
   / / )      | Little Jim says ....                            |
  // !!       |      "He fallen in de water !!"                 |
#2 lore raw

Well that didn't go so well

Quoted 3 lines · On Tuesday 11 March 2008 13:12:19 Robin Hill wrote:

 2) Force the OS to be aware of the new partition sizes - either a reboot or using partprobe.
 3) Grow the array (mdadm --grow) - check the manual page for details.

I ran partprobe and then mdadm --grow --size=max /dev/md4 and nothing happened. Then I decided to reboot thinking that partprobe hadn't picked up that change and now it says that sda6 doesn't have a superblock. Any ideas what went wrong?

Quoted 1 line

 4) Resize the filesystem (resize2fs).

Signature · 6 lines
Regards
Wayne
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 11 lines · Wayne Gemmell

Well that didn't go so well

Quoted 3 lines · On Tuesday 11 March 2008 13:12:19 Robin Hill wrote:

 2) Force the OS to be aware of the new partition sizes - either a reboot or using partprobe.
 3) Grow the array (mdadm --grow) - check the manual page for details.

I ran partprobe and then mdadm --grow --size=max /dev/md4 and nothing happened. Then I decided to reboot thinking that partprobe hadn't picked up that change and now it says that sda6 doesn't have a superblock. Any ideas what went wrong?

What version metadata are you using? I'm not sure how 1.0 will handle partition resizes but any other should certainly be okay. Have you tried running mdadm -E on each of the component partitions? I assume the new partitions are starting from the same position as the old ones?

Cheers,
Robin

Signature · 4 lines
     ___        
    ( ' }     |       Robin Hill        <[email protected]> |
   / / )      | Little Jim says ....                            |
  // !!       |      "He fallen in de water !!"                 |
#4 lore raw
Quoted 2 lines · On Tuesday 11 March 2008 16:58:32 Robin Hill wrote:

What version metadata are you using?  I'm not sure how 1.0 will handle partition resizes but any other should certainly be okay.

I'm not sure, the version in mdadm -E is 00.90.00. Is that what your talking about? They were done at the same time.

Quoted 1 line

Have you tried running mdadm -E on each of the component partitions?

Yes, It just says "no md superblock detected on /dev/sda6". Same with the rest.

Quoted 1 line

I assume the new partitions are starting from the same position as the old

ones?

Yes, I just dropped the partition and made a new one in place.

Signature · 6 lines
Regards
Wayne 
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
Quoted 6 lines · On Wednesday 12 March 2008 09:27:31 Wayne Gemmell wrote:
Quoted 2 lines · On Tuesday 11 March 2008 16:58:32 Robin Hill wrote:

What version metadata are you using?  I'm not sure how 1.0 will handle partition resizes but any other should certainly be okay.

I'm not sure, the version in mdadm -E is 00.90.00. Is that what your talking about? They were done at the same time.

Just to clarify this I ran mdadm -E on a partition in a working array that was done at the same time assuming that they are the same.

Signature · 6 lines
Regards
Wayne 
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
In reply to Robin Hill
Quoted 8 lines · Robin Hill
Quoted 6 lines · Wayne Gemmell

Well that didn't go so well

Quoted 3 lines · On Tuesday 11 March 2008 13:12:19 Robin Hill wrote:

2) Force the OS to be aware of the new partition sizes - either a reboot or using partprobe.
3) Grow the array (mdadm --grow) - check the manual page for details.

Quoted 6 lines
Quoted 2 lines

I ran partprobe and then mdadm --grow --size=max /dev/md4 and nothing happened. Then I decided to reboot thinking that partprobe hadn't picked up that change and now it says that sda6 doesn't have a superblock. Any ideas what went wrong?

What version metadata are you using? I'm not sure how 1.0 will handle partition resizes but any other should certainly be okay. Have you tried running mdadm -E on each of the component partitions? I assume the new partitions are starting from the same position as the old ones?

Robin, you're completely wrong here.

Only metadata at the START of the partition will work here. Which is either 1.1 or 1.2, but NOT 1.0 or 0.90, - which is at the END of the partition. When the end of the partition goes away, the superblock becomes "orphan" somewhere inside the partition, and can't be found anymore.

What should be done currently is:

a) re-create the array with new partitions, with THE SAME DISK ORDER, METADATA VERSION AND CHUNK SIZE as it was before.

b) restore partitions to the EXACT size as they were before, and start from scratch

/mjt

#7 lore raw
Quoted 2 lines · On Wednesday 12 March 2008 10:04:56 you wrote:

a) re-create the array with new partitions, with THE SAME DISK ORDER, METADATA VERSION AND CHUNK SIZE as it was before.

Is this possible without loosing data?

Quoted 3 lines

b) restore partitions to the EXACT size as they were before, and start from scratch

Thats easy enough. I'll do that now.

Signature · 2 lines
Regards
Wayne 
#10 lore raw
In reply to Michael Tokarev
Quoted 6 lines · Michael Tokarev
Quoted 4 lines · Robin Hill

What version metadata are you using? I'm not sure how 1.0 will handle partition resizes but any other should certainly be okay. Have you tried running mdadm -E on each of the component partitions? I assume the new partitions are starting from the same position as the old ones?

Quoted 8 lines

Robin, you're completely wrong here.

Only metadata at the START of the partition will work here. Which is either 1.1 or 1.2, but NOT 1.0 or 0.90, - which is at the END of the partition. When the end of the partition goes away, the superblock becomes "orphan" somewhere inside the partition, and can't be found anymore.

That's why I said I wasn't sure about 1.0 metadata. I've grown 0.90 arrays in exactly this way (though I may not actually have rebooted) so I assumed they'd work okay (and the manual doesn't specify where the metadata is for these).

Cheers,
Robin

Signature · 4 lines
     ___        
    ( ' }     |       Robin Hill        <[email protected]> |
   / / )      | Little Jim says ....                            |
  // !!       |      "He fallen in de water !!"                 |
#8 lore raw
In reply to Wayne Gemmell
Quoted 4 lines · Wayne Gemmell
Quoted 2 lines · On Wednesday 12 March 2008 10:04:56 you wrote:

a) re-create the array with new partitions, with THE SAME DISK ORDER, METADATA VERSION AND CHUNK SIZE as it was before.

Is this possible without loosing data?

Yes. But it's unreliable, sorta. Too easy to screw things up, that is.

Quoted 3 lines
Quoted 2 lines

b) restore partitions to the EXACT size as they were before, and start from scratch

Thats easy enough. I'll do that now.

And now, the original question comes up again: what to do, how to perform the actual resize of the raid array...

To be fair, I don't really know. I always used my own tiny program to assist me in a situation like this - to back up and restore v0.90 linux raid superblocks. It's available at
http://www.corpit.ru/mjt/mdsuper.c . Here's how I use it:

First, save the original superblocks in files:

for f in sd{a,b,c,d,e}1; do
./mdsuper read /dev/$f > $f
done

this instructs mdsuper to read the superblock (v0.90 only!) and write it to standard out. This has to be done while the array (on original partitions) is STOPPED.

Now, resize the partitions, reboot if necessary (for the kernel to recognize the new sizes). You can save a dump of your current partitions using `sfdisk -d' (redirect its output to a file as with mdsuper) - just in case if something goes wrong.

At this point, your array is unaccessible - mdadm will tell you that it can't find the superblocks. But we have the superblocks saved - so we only need to restore them back:

for f in sd{a,b,c,d,e}1; do
./mdsuper write /dev/$f < $f
done

(note the redirection is opposite!, and read was changed to write!).

Now, try to assemble the array - it should be here. We just moved (actually copied) the superblock from the now-middle-of-partitions to the end, where it should be, and mdadm is now able to find it. The array is still of the old size - but now mdadm --grow will work.

That's basically it. Just watch the mdsuper invocation.

/mjt

#9 lore raw
Quoted 8 lines · On Wednesday 12 March 2008 11:38:25 Michael Tokarev wrote:
Quoted 5 lines · Wayne Gemmell
Quoted 2 lines · On Wednesday 12 March 2008 10:04:56 you wrote:

a) re-create the array with new partitions, with THE SAME DISK ORDER, METADATA VERSION AND CHUNK SIZE as it was before.

Is this possible without loosing data?

Yes. But it's unreliable, sorta. Too easy to screw things up, that is.

Thankfully I didn't need to do this. Resizing the partitions fixed that. And now for the dangerous (looking) part.

Quoted 46 lines

And now, the original question comes up again: what to do, how to perform the actual resize of the raid array...

To be fair, I don't really know. I always used my own tiny program to assist me in a situation like this - to back up and restore v0.90 linux raid superblocks. It's available at
http://www.corpit.ru/mjt/mdsuper.c . Here's how I use it:

First, save the original superblocks in files:

for f in sd{a,b,c,d,e}1; do

    ./mdsuper read /dev/$f > $f

done

this instructs mdsuper to read the superblock (v0.90 only!) and write it to standard out. This has to be done while the array (on original partitions) is STOPPED.

Now, resize the partitions, reboot if necessary (for the kernel to recognize the new sizes). You can save a dump of your current partitions using `sfdisk -d' (redirect its output to a file as with mdsuper) - just in case if something goes wrong.

At this point, your array is unaccessible - mdadm will tell you that it can't find the superblocks. But we have the superblocks saved - so we only need to restore them back:

for f in sd{a,b,c,d,e}1; do
./mdsuper write /dev/$f < $f
done

(note the redirection is opposite!, and read was changed to write!).

Now, try to assemble the array - it should be here. We just moved (actually copied) the superblock from the now-middle-of-partitions to the end, where it should be, and mdadm is now able to find it. The array is still of the old size - but now mdadm --grow will work.

That's basically it. Just watch the mdsuper invocation.

/mjt
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Regards
Wayne Gemmell
Flash Media Group
Tel:	27 (0)12 430 7597
Cell:	27 (0)83 666 3342
#11 lore raw
In reply to Wayne Gemmell
Quoted 5 lines · On Tuesday March 11, [email protected] wrote:

Hi all

I'd like to do an online resize for my RAID5 drives now that I've upgraded them to 500GB drives. Now I'm a bit stuck. I assume the steps would be the following.

What exactly do you mean by "now that I've upgraded them to 500GB drives".
Don't tell my you got new 500GB drives, created little partitions on them to match the old drives, and added those to the array. That is the wrong way around.

md is quite happy having using some partitions much larger than others.
So if you have an array with (say) 4 200GB drives and want to replace them all with 500GB drives, you should make 500GB partitions on those drives (assuming that you really want to use partitions) and then one at a time, fail a working drive and add a new drive, and wait for recovery to complete.

Once that is done you still have a working array of the same size as before but all the devices (and all the partitions) are larger. Then just
mdadm --grow /dev/mdX --size=max

and the array will resync the new space and be larger for you. Then you can resize the filesystem.

NeilBrown

#12 lore raw
Quoted 7 lines · On Tuesday 29 April 2008 03:00:13 Neil Brown wrote:
Quoted 5 lines · On Tuesday March 11, [email protected] wrote:

Hi all

I'd like to do an online resize for my RAID5 drives now that I've upgraded them to 500GB drives. Now I'm a bit stuck. I assume the steps would be the following.

Quoted 5 lines

What exactly do you mean by "now that I've upgraded them to 500GB drives".
Don't tell my you got new 500GB drives, created little partitions on them to match the old drives, and added those to the array.  That is the wrong way around.

That sounds about the way I did it. Since the hdd were so much bigger than the original drives I managed tho fit all 6 partitions on 2 hdd. Then created a new raid and copied everything across. Deleted the 6 partitions and grew the raid to fit the next 2 hdd.

Your way sounds easier....

Signature · 6 lines
Regards
Wayne 
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html