| « HOWTO: Create a new RAID 1 (mirror) | HOWTO:Get my USB Logitech Rumblepad working. » |
You can increase the size of your RAID 5 disk array by swapping out each disk in turn with a larger disk. This takes time, a lot of time if you have many disks in your array.
It is also very important to note that during the process your data is at risk until the resync process has finished. You did complete a full backup didn't you!The following will need to be repeated for each drive you have in your disk array. The steps can all be done on a running and mounted system if you use reiserfs.
Select the drive you are going to replace and run the following commands. These will firstly mark the drive as faulty so it is no longer used. The second will remove it from the array. You have to do this as you cannot simply remove a good disk from a RAID array.
I like to run the following in a separate window. The command displays and re-displays the contents of /proc/mdstat every 7 seconds and shows you the status.
You can now turn off your machine and swap out the old hard drive, adding the new larger one in its place. This drive needs to be partitioned before being added to the array. You must make the partition the full size of the disk or the size you want to use in the new RAID array. For example if the old drive was 250Mb and you are swapping in 1Gb drives you make the partition 1Gb not 250Mb.
You also need to set the partition type or ID to 0xDA - Non-fs data or 0xFD, Linux raid autodetect. I use 0xFD as that is what Ubuntu Linux uses if you install from scratch using RAID.
To get a list of commands that fdisk accepts type 'm', just like the prompt says ![]()
First check it is the right disk with 'p' print the partition table. There should be nothing displayed under the headings , if this was a brand new disk.
n add a new partition to add create the new partition I use a primary partition and set it to number 1. Then accept the defaults for the beginning and ending cylinder, to use the whole disk.
t change a partition's system id to set the id to '0xFD' you type just fd
and finally one last check all is well I print out what will be written with 'p' again.
Now we can add the new disk to the array with the following:
You will see that after a few seconds your hard disks burst into life and stay active. The RAID array is being resynced and can take a few minutes to many hours. Time for a coffee
Running the cat /proc/mdstat with watch at this point you will see the process run through until it is finished. Do not interrupt the process or it will start all over again. You can use your system while this is happening.
Repeat the above steps for all drives in your array before going on to the steps below.
So you have now replaced all your disks with larger drives. You can now grow the RAID array
The array now represents one disk using all of the new available space. If you check the disk usage with the 'df' command nothings has changed! What's up with this?
One last step you must resize the file system on the partition. I use reiserfs so this can be done on the fly while the system is still mounted.
Now when you check the disk usage you will see the correct size of the RAID array.
All done!
Pages: 1· 2