Growing

From Linux Raid Wiki
(Difference between revisions)
Jump to: navigation, search
(create page about growing. (I've just grown my raid, so I thought this page will be useful for others))
 
(Expanding existing partitions)
Line 12: Line 12:
 
It is possible to move whole RAID array to bigger disc drives by replacing one by one. In the end the number of devices will be the same, but the underlying partitions on which RAID resides will be bigger. It is possible to <code>--grow</code> RAID arrays so they will expand to utilize whole available space.
 
It is possible to move whole RAID array to bigger disc drives by replacing one by one. In the end the number of devices will be the same, but the underlying partitions on which RAID resides will be bigger. It is possible to <code>--grow</code> RAID arrays so they will expand to utilize whole available space.
  
''This section, about how to do it, needs to be written by someone who did this.''
+
In order to increase the usable size of the array, you must increase the size of all disks in that array. Depending on the size of your disks, this may take days to complete. It is also important to note that while the array undergoes the resync process, it is vulnerable to irrecoverable failure if another drive were to fail. It would (of course) be a wise idea to completely back up your data before continuing.
 +
 
 +
First, choose a drive and completely remove it from the array
 +
 
 +
<code>mdadm -f /dev/md0 /dev/sdd1<br>
 +
mdadm -r /dev/md0 /dev/sdd1</code>
 +
 
 +
Next, partition the new drive so that you are using the amount of space you will eventually use on all new disks. For example, if you are going from 100 GB drives to 250 GB drives, you will want to partition the new 250 GB drive to use 250 GB, not 100 GB. Also, remember to set the partition type to <code>fd</code>, Linux raid autodetect.
 +
 
 +
<code>fdisk /dev/sde</code>
 +
 
 +
Now add the new disk to the array.
 +
 
 +
<code>mdadm --add /dev/md0 /dev/sde1</code>
 +
 
 +
Allow the resync to fully complete before continuing. You will now have to repeat the above steps for *each* disk in your array. Once all of the drives in your array have been replaced with larger drives, we can grow the space on the array by issuing:
 +
 
 +
<code>mdadm --grow /dev/md0 --size=max</code>
 +
 
 +
The array now represents one disk using all of the new available space. You must now resize your filesystem to take advantage of it:
 +
 
 +
<code>resize2fs /dev/md0</code>
 +
 
 +
..Someone who has done this with LVM2 should add how to resize your physical volumes and such..

Revision as of 02:25, 7 June 2008

Adding partitions

When new disc is added, existing raid partitions can be grown to use the new disc. After the new disc was partitioned, the RAID level 1/4/5/6 array can be grown for example using this command (assuming that before growing it contains three drives):

mdadm --add /dev/md1 /dev/sdb3
mdadm --grow --raid-devices=4 /dev/md1

The process can take even 10 hours. There is a critical section at start, which cannot be backed up. To allow recovery after unexpected power failure, an additional option --backup-file= can be specified.

Expanding existing partitions

It is possible to move whole RAID array to bigger disc drives by replacing one by one. In the end the number of devices will be the same, but the underlying partitions on which RAID resides will be bigger. It is possible to --grow RAID arrays so they will expand to utilize whole available space.

In order to increase the usable size of the array, you must increase the size of all disks in that array. Depending on the size of your disks, this may take days to complete. It is also important to note that while the array undergoes the resync process, it is vulnerable to irrecoverable failure if another drive were to fail. It would (of course) be a wise idea to completely back up your data before continuing.

First, choose a drive and completely remove it from the array

mdadm -f /dev/md0 /dev/sdd1
mdadm -r /dev/md0 /dev/sdd1

Next, partition the new drive so that you are using the amount of space you will eventually use on all new disks. For example, if you are going from 100 GB drives to 250 GB drives, you will want to partition the new 250 GB drive to use 250 GB, not 100 GB. Also, remember to set the partition type to fd, Linux raid autodetect.

fdisk /dev/sde

Now add the new disk to the array.

mdadm --add /dev/md0 /dev/sde1

Allow the resync to fully complete before continuing. You will now have to repeat the above steps for *each* disk in your array. Once all of the drives in your array have been replaced with larger drives, we can grow the space on the array by issuing:

mdadm --grow /dev/md0 --size=max

The array now represents one disk using all of the new available space. You must now resize your filesystem to take advantage of it:

resize2fs /dev/md0

..Someone who has done this with LVM2 should add how to resize your physical volumes and such..

Personal tools