[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: Growing md0 by larger disk - which is best method.

On 21/04/13 01:11 PM, R. Ramesh wrote:
I have a mdadm implemented raid5 with 3 disks (2x 3TiB and 1x 2TiB). Each disk has one partition only for the full size of that disk and the partitions are then combined in to md0. I like to swap out the 2TiB with a new 3TiB. While I do not expect issue with this, a lot of reading about unrecoverable errors spooked me a little on the rebuild/resync. Further, I think it is silly that we need to read all the disks in the original array as part of resync (in a fail+remove+add method of changing disks) Is there a way to avoid resync by doing a dd from 2TB on to the *new* 3TB and then reassembling the array? I mean this
  1. shutdown
  2. add 3tb to the PC
  3. boot using rescue disk and do not assemble the md0.
  4. Copy partition table from one of  old 3TiB on to the *new* 3TiB
  5. dd 2TiB-part1 to *new* 3TiB-part1
  6. shutdown
  7. disconnect 2TiB disk
  8. restart to original OS on the disk to find the 3TiB as part of the
  9. Grow the array to full size

Since the above is not suggested anywhere I could find, I like to know what I am missing as this seems too easy to me.

The problem is the location of the superblocks. If you're prepared to have your system shut down for a while to copy the data, I suggest that you simply remove the 2T disk and add the 3T disk. You will still have your 2T disk so if something fails, you should be able to recover using it. This of course means that you cannot be using your system. The md array cannot be written to or the 2T drive will no longer be usable. So boot from a rescue disk and rebuild the array without mounting it or any partition on it until the rebuild has completed.

Thanks. I was thinking copy will be faster than rebuild. Further, it will avoid reading 4TB disk (of course, it will read 2TB when copying) I guess you are saying that the simple copying will not work.

I was going to try experimenting with files and loop devices (I tried 2x 3G + 1x 2G files plus a new 3G file representing the new 3TB drive). However, after copying the files, loop thinks that the file representing new 3TB disk (or the new 3GB file) is really a 2TB disk. So, mdadm does not grow the array when using the new loop device. However, the file system was intact after copying and I could mount it etc. I just could not grow
it to full 6TB.


Reply to: