LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 08-13-2005, 01:51 AM   #1
kevburger
LQ Newbie
 
Registered: Aug 2005
Location: Colorado
Distribution: RedHat
Posts: 1

Rep: Reputation: 0
using mdadm to grow an existing RAID 1 array


Using RedHat 9
kernel 2.4.20-31.9

I've got a software RAID 1 array right now that was originally set up using 2 40 GB disks. I now have 3 80 GB disks in that array (1 spare). Of course, that array is still showing up as a 40 GB array. What's the best way to grow that array to the full 80 GB size?

Thanks for your help, experts. I just don't want to screw up and trash the existing array.
 
Old 08-18-2005, 09:17 AM   #2
olivier2
LQ Newbie
 
Registered: Aug 2005
Location: France
Posts: 1

Rep: Reputation: 0
Hi.

it is quite difficult to suggest appropriate actions on your array without some knowledge of your specific configuration.

Does your raid 1 rely on partitions on two hard disks ? Or does it rely on raw hard disks ?
Loot at your /etc/raidtab file and see what devices are mentioned. The following would use some partitions on sda and sdb for a /dev/md0 configured as raid 1 array

raiddev /dev/md0
raid-level 1
nr-raid-disks 2
persistent-superblock 1
chunk-size 16
device /dev/sda3
raid-disk 0
device /dev/sdb3
raid-disk 1

while the following would use whole hard disks sda and sdb

raiddev /dev/md0
raid-level 1
nr-raid-disks 2
persistent-superblock 1
chunk-size 16
device /dev/sda
raid-disk 0
device /dev/sdb
raid-disk 1


But since you seem to have succeeded in growing raw disk space, i suppose that you growed physical space (for example, with a hardware controler which is able to grow luns by itself or, if you replaced your hard disk one by one, having mdtools rebuild the replaced disk, or something else)

First of all, ensure that your mirror is clean. Use
# cat /proc/mdstat
md0 : active raid1 sda[1] sdb[0]
5120320 blocks [2/2] [UU]

If you can read [UU] it's ok.


Now, if your array relies on partitions, you should grow them. (on the example above, it does not since md0 relies on sda and sdb). You can use some specific tools like qtparted to grow these partitions. This step is necessary if you use a hardware controller to grow a LUN but if you replaced your 40 Gb HDs by 80 Gb ones, then you probably created larger partitions than the previous ones and you can skip this step.

Now, you have a raid 1 array of 40 Gb that relies on 80 Gb devices (disks or partitions). In order to grow the mirror, you should recreate it. This is why it is very important that your array is clean before you grow it.

Use mkraid -R /dev/md0 (if md0). You will see messages telling that it will destroy all your data, but don't panic. This command does initialize the mirror by copying the whole first device to the second one. But since any of the two devices contain your data, you don't lose anything and you don't even need to care what device is considered the first by mdtools (mentioned in /etc/raidtab).

So, now you should have a 80 Gb array. You can monitor raid initialisation by looking at /proc/mdstat, but you don't have to wait to the end of this process. You can try mounting your filesystem to check everything is ok.

The last thing you have to do is to grow your filesystem. If you mounted it, you have probably seen that your filesystem is still 40 Gb large. The followind commands are valid for ext2/ext3 filesystems, but you can find equivalent for xfs, reiserfs or whatever you use.

First, check it. I think the resize command complains if your filesystem has not been checked for a while.
# fsck.ext3 -fvy /dev/md0 # (or fsck.ext2 for ext2)

You can now resize your filesystem with
# resize2fs -p /dev/md0 # it's resize2fs also for ext3

And then check it again
# fsck.ext3 -fvy /dev/md0 # (or fsck.ext2 for ext2)

The check commands will probably report some warnings concerning block sizes or something...

And it's finished.

I have succesfully applied this procedure several times on my servers with no problem. But unless you are a real gambler, I suggest that you do some backups before trying this

Hope that helps... and good luck !

Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't I mount this md0 raid? (mdadm and software raid) cruiserparts Linux - Software 35 01-05-2013 04:35 PM
Linux raid with mdadm eyt Linux - Newbie 6 02-07-2006 06:26 AM
Mdadm Raid question stefaandk Linux - General 12 08-16-2005 03:11 AM
mdadm problems with growing an existing array mjcramer Fedora 2 07-11-2005 09:28 PM
Dual-booting on an existing WinXP Raid 1 array?? bobbryce Fedora - Installation 1 06-28-2005 02:51 PM


All times are GMT -5. The time now is 07:53 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration