Koozali.org: home of the SME Server

Raid1 Mirror Spare drive to small

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Raid1 Mirror Spare drive to small
« on: February 05, 2007, 12:00:00 PM »
One of my servers were running SME6.0.1 and i decided to upgrade to SME7.1. Because of all the contribs that is not compatable with sme7 i decided to do a clean install.

I installed sme7.1 only on one of the 2 80gigs so that i have a backup if something goes wrong, but i made one mistake: The 2 80gigs are not identical and differs in size. One is 80gig and the other 83gig. And yes, I installed it on the 83gig. As result I am now unable to add the other one to the raid1 array.

Is there a way i can resize on of the partitions so that i can add the second drive? It took me 2 days to install and set everything up and I really don't have the time to do it all over again.

Offline stephen noble

  • *
  • 607
  • +1/-0
    • Dungog
Raid1 Mirror Spare drive to small
« Reply #1 on: February 05, 2007, 01:28:46 PM »
see http://smeserver.sourceforge.net/sme7/tech/Chapter8#h1137-6
you can grow the disk

man mdadm says you can also shrink it,
give it a go and let us know, the worst that can happen is you start again

      * Grow  
Grow  (or  shrink)  an array, or otherwise reshape it in some way.  Currently  supported growth options including changing the  active  size  of  componenet  devices  in  RAID  level 1/4/5/6 and changing the number of active devices in   RAID1.

Offline ldkeen

  • *
  • 405
  • +0/-0
Raid1 Mirror Spare drive to small
« Reply #2 on: February 05, 2007, 01:31:55 PM »
Are you able to ghost the bigger drive to the small one? You could then boot off the smaller disk and add the larger disk into the array (of course you'd loose 3GB doing this).
Lloyd

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Raid1 Mirror Spare drive to small
« Reply #3 on: February 05, 2007, 02:05:26 PM »
Loosing 3gb is not a problem, I thought about that but wasn't sure that it wil work because of the logical volume, inside the logical volume group, inside the array, created on linux raid autodetect partitions, can ghost even read linux partirions?

Grow or Shrink the array? As far as I know grow and shrink has to do with the number of devices used and not the size of the partition. (please correct me if I am wrong.

Offline ldkeen

  • *
  • 405
  • +0/-0
Raid1 Mirror Spare drive to small
« Reply #4 on: February 05, 2007, 10:18:13 PM »
Quote from: "Gert"
can ghost even read linux partirions?

Yes, of course it can. You can even change the size of the existing partions prior to ghosting. You will have some problems with grub after ghosting but they are easy fixed, I use the following:
Boot off installation CD
Code: [Select]
$ sudo su
# mkdir /mnt/root
# mount -t ext3 /dev/hda1 /mnt/root
# mount -t proc none /mnt/root/proc
# mount -o bind /dev /mnt/root/dev
# chroot /mnt/root
# grub-install /dev/hda
Have you tried hot-adding the drive into the array? I'm not too sure what happens if you add a small drive into an existing large array. I do know that if you add a large drive to a small array - you just lose the extra space. Anyway the command to resize and hot add would be:
Code: [Select]
#mdadm --grow /dev/md2 --size=(current size - 3GB, probably 79GB)
#mdadm --add /dev/md1 /dev/hdc1
#mdadm --add /dev/md2 /dev/hdc2*

*Where hdc is your new 80GB
I haven't tried any of this with different sized drives so you're on you're own whichever way you decide to go.
Regards, Lloyd

Offline ldkeen

  • *
  • 405
  • +0/-0
Raid1 Mirror Spare drive to small
« Reply #5 on: February 05, 2007, 10:38:43 PM »
Quote from: "Gert"
Grow or Shrink the array? As far as I know grow and shrink has to do with the number of devices used and not the size of the partition. (please correct me if I am wrong.

You can grow or shrink the size of raid 1/4/5/6 by size but you can only grow a raid 1 by number of disks. You can't grow a raid 5 by the number of disks with the current setup, although it is possible - see http://forums.contribs.org/index.php?topic=33738.0
Lloyd

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Raid1 Mirror Spare drive to small
« Reply #6 on: February 05, 2007, 11:04:39 PM »
Thanx for the reply, I will setup a test server with vmware and test it. Will keep you posted.  :)

Offline Gert

  • *****
  • 208
  • +0/-0
    • http://www.huge.co.za
Raid1 Mirror Spare drive to small
« Reply #7 on: February 06, 2007, 12:10:36 AM »
Did not work. Just after the mdadm --grow command i started to get all sorts of errors and failures. I had to reset the machine and the it would not start again. it complained about the lvm that does not fit on the device and then a kernel panic.

I guess I will have the same problem with ghost.

To get it done I will first have to resize the lv and then the md.

Anyone know how to change the size of a logical volume?