Koozali.org: home of the SME Server

Question to RAID 1 replacing disks to bigger disks

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Question to RAID 1 replacing disks to bigger disks
« on: March 19, 2013, 02:52:19 PM »
SME 8.0, up-to-date. I replaced two 500 GB S-ATA-Disks following this HOW-TO http://wiki.contribs.org/Raid#Replacing_and_Upgrading_Hard_Drive_after_HD_fail. The new disks have a capapcity of 1 TB each. Disks are identical. Server is up and running. No errors. Raid is clean.

I issued the following commands to resize the RAID to the bigger disks:
mdadm --grow /dev/md2 --size=max
pvresize /dev/md2
lvresize -l +100%FREE main/root
resize2fs /dev/mapper/main-root &


A cat /proc/mdstat shows

Personalities: [raid1]
md1: active raid1 sdb1[0] sda1[1]
104320 blocks [2/2] [UU]

md1: active raid1 sdb2[0] sda2[1]
976655552 blocks [2/2] [UU]

unused devices: <none>


fdisk -l shows:

Platte /dev/sda: 1000.2 GByte, 1000204886016 Byte
255 heads, 63 sectors/track, 121601 cylinders
Einheiten = Zylinder von 16065 � 512 = 8225280 Bytes

    Ger�t  boot.     Anfang        Ende     Bl�cke   Id  System
/dev/sda1   *           1          13      104384+  fd  Linux raid autodetect
Partition 1 endet nicht an einer Zylindergrenze.
/dev/sda2              13      121601   976655647   fd  Linux raid autodetect

Platte /dev/sdb: 1000.2 GByte, 1000204886016 Byte
255 heads, 63 sectors/track, 121601 cylinders
Einheiten = Zylinder von 16065 � 512 = 8225280 Bytes

    Ger�t  boot.     Anfang        Ende     Bl�cke   Id  System
/dev/sdb1   *           1          13      104384+  fd  Linux raid autodetect
Partition 1 endet nicht an einer Zylindergrenze.
/dev/sdb2              13      121601   976655647   fd  Linux raid autodetect

Platte /dev/md2: 1000.0 GByte, 1000095285248 Byte
2 heads, 4 sectors/track, 244163888 cylinders
Einheiten = Zylinder von 8 � 512 = 4096 Bytes

Festplatte /dev/md2 enth�lt keine g�ltige Partitionstabelle

Platte /dev/md1: 106 MByte, 106823680 Byte
2 heads, 4 sectors/track, 26080 cylinders
Einheiten = Zylinder von 8 � 512 = 4096 Bytes

Festplatte /dev/md1 enth�lt keine g�ltige Partitionstabelle


df -h shows:

Dateisystem          Gr��e Benut  Verf Ben% Eingeh�ngt auf
/dev/mapper/main-root
                      457G  129G  306G  30% /
/dev/md1               99M   46M   48M  50% /boot
none                  2,0G     0  2,0G   0% /dev/shm

Seems to me, there are missing 500 GB. Did I miss something?

Thanks for any hint.
stefan
« Last Edit: March 19, 2013, 03:13:14 PM by SchulzStefan »
And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #1 on: March 19, 2013, 03:28:43 PM »
I'm confused now.

mdadm --detail /dev/md2 | more
/dev/md2:
        Version : 0.90
  Creation Time : Fri Aug  8 17:01:14 2008
     Raid Level : raid1
     Array Size : 976655552 (931.41 GiB 1000.10 GB)
  Used Dev Size : 976655552 (931.41 GiB 1000.10 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Tue Mar 19 15:25:40 2013
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 7be080c3:58e3a9c4:55bdf7e0:ca9607bf
         Events : 0.46776802

    Number   Major   Minor   RaidDevice State
       0       8       18        0      active sync   /dev/sdb2
       1       8        2        1      active sync   /dev/sda2

Does that mean, the df command does not work on RAIDs?
And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #2 on: March 19, 2013, 08:05:46 PM »
Googling around brings me to the following taken from ubuntuforums.org:

http://ubuntuforums.org/showthread.php?t=980541

Quote
mkfs -t ext3 /dev/md2

Does that mean, before adding a new drive to the RAID, one have to build a filesystem on the new disk? It is not enough to dd if=/dev/sda1 of=/dev/sdb1 the bootsector? Again - did I miss something in the HOW-TO?

Both disks are in sync and both are able to boot the server.

I'm concerned whether the disks are setup correct. Could anybody give advice please?

And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline johnp

  • *****
  • 312
  • +0/-0

Offline TerryF

  • grumpy old man
  • *
  • 1,859
  • +6/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #4 on: March 19, 2013, 11:01:10 PM »
Does that mean, before adding a new drive to the RAID, one have to build a filesystem on the new disk? It is not enough to dd if=/dev/sda1 of=/dev/sdb1 the bootsector? Again - did I miss something in the HOW-TO?

Were the new HDs new and unused prior to adding to this sytem ie had they ever been used in  another system prior to this.

Where in  that How To does it say to dd if=/dev/sda1 of=/dev/sdb1 the bootsector, that is only used on a single drive raid 1 system in the section http://wiki.contribs.org/Raid#Adding_another_Hard_Drive_Later_.28Raid1_array_only.29 it is NOT part of http://wiki.contribs.org/Raid#Upgrading_the_Hard_Drive_Size
--
qui scribit bis legit

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #5 on: March 20, 2013, 11:43:24 AM »
I'm still confused. It's very clear to me that in a system with only one disk, the disk has to be partitioned and formatted before it can be used. Now, in a RAID1 system, if one disk has to be replaced, all I read is to place a *new* disk in, add it to the RAID and you're done. *New* disk means to me *untouched*.

Do I have to build the RAID again? Meaning to remove first sdb, create a partition table following http://wiki.contribs.org/Hard_Disk_Partitioning, add it again to the RAID, and after full syncing change the disks to the same with the other one? Would it be safe to do it on a life system? (Of course, I do have a backup.)

And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline TerryF

  • grumpy old man
  • *
  • 1,859
  • +6/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #6 on: March 20, 2013, 12:03:30 PM »
Now, in a RAID1 system, if one disk has to be replaced, all I read is to place a *new* disk in, add it to the RAID and you're done. *New* disk means to me *untouched*.

Yes, just as described here: http://wiki.contribs.org/Raid#Upgrading_the_Hard_Drive_Size

Thats it, just follow the steps.
--
qui scribit bis legit

Offline purvis

  • *****
  • 567
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #7 on: March 20, 2013, 05:09:16 PM »
This is how I grow my disk space from a raid 1 system.
Usually, I will have two brand new equal hard drives I want to put in my system.


Remove the internet and/or intranet cable connections to the computer system.
From a raid 1 working system.
shutdown the system
Pull the smaller of the two working rad1 drives out or if drives are same size in size, I pull 1 drive out.
The pulled drive is then stored for backup purposes and never used again unless i need to restore something from it.
Place a newer bigger drive in the system.
Boot up the system
Do not allow any users on the system or internet activity to the computer.
Rebuild the new drive to raid 1 operating status
Shutdown the system
Pull the older drive out
Boot up the system
Do not allow users to
Expand the volume of the drive to the fullest size
Shutdown the system after the expansion on the newer larger drive.
Put the second new larger hard drive
Hook backup internet and intranet to the computer system
Boot the computer.
Rebuild the raid 1 on to the new second drive.
You are done now while the rebuilding process is working.
Do not boot the computer until the raid 1 process is complete.

Offline slords

  • *****
  • 235
  • +3/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #8 on: March 20, 2013, 06:47:04 PM »
Lets go over this in order.  The order you showed things isn't quite right.

fdisk -l shows:

Platte /dev/sda: 1000.2 GByte, 1000204886016 Byte
/dev/sda2              13      121601   976655647   fd  Linux raid autodetect

Platte /dev/sdb: 1000.2 GByte, 1000204886016 Byte
/dev/sdb2              13      121601   976655647   fd  Linux raid autodetect

This looks right.  The two partitions that will be used in raid are just under 1T in size.

A cat /proc/mdstat shows

md1: active raid1 sdb2[0] sda2[1]
976655552 blocks [2/2] [UU]

This also looks right.  Just under 1T.

We are missing a few steps here.  There is nothing showing the pv, vg, or lv sizes.

Can you show the output of the following commands:

Code: [Select]
pvs
vgs
lvs

df -h shows:

Dateisystem          Gr��e Benut  Verf Ben% Eingeh�ngt auf
/dev/mapper/main-root
                      457G  129G  306G  30% /

This shows that at least the root lv hasn't been resized.  Please post the output of the above commands to see where the expansion stopped (or broke).  You are almost there, we just need to take care of the lvm stuff and then you can grow the filesystem.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." -- Rich Cook

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #9 on: March 21, 2013, 11:20:04 AM »
@slords

Here's the output of:

pvs:
PV             VG   Fmt  Attr PSize   PFree
/dev/md2   main lvm2 a--  931,41G    0

vgs:
VG   #PV #LV #SN Attr   VSize   VFree
main   1   2   0 wz--n- 931,41G    0

lvs:
LV   VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
root main -wi-ao 929,47G
swap main -wi-ao   1,94G


@TerryF

I followed the How-To http://wiki.contribs.org/Raid#Upgrading_the_Hard_Drive_Size. This is the result after syncing:

fdisk -l:
Platte /dev/sda: 1000.2 GByte, 1000204886016 Byte
255 heads, 63 sectors/track, 121601 cylinders
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes

    Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *           1          13      104384+  fd  Linux raid autodetect
***Partition 1 endet nicht an einer Zylindergrenze.***
***This error is reported, since I synced the new (unpartitioned and unformatted 1TB disk) with the old 500GB disk.***
/dev/sda2              13      121601   976655647   fd  Linux raid autodetect

Platte /dev/sdb: 1000.2 GByte, 1000204886016 Byte
255 heads, 63 sectors/track, 121601 cylinders
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes

    Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdb1   *           1          13      104384+  fd  Linux raid autodetect
***Partition 1 endet nicht an einer Zylindergrenze.***
***This error was not reported before adding the disk to the RAID.***

/dev/sdb2              13      121601   976655647   fd  Linux raid autodetect

Platte /dev/md2: 1000.0 GByte, 1000095285248 Byte
2 heads, 4 sectors/track, 244163888 cylinders
Einheiten = Zylinder von 8 × 512 = 4096 Bytes

Festplatte /dev/md2 enthält keine gültige Partitionstabelle

Platte /dev/md1: 106 MByte, 106823680 Byte
2 heads, 4 sectors/track, 26080 cylinders
Einheiten = Zylinder von 8 × 512 = 4096 Bytes

Festplatte /dev/md1 enthält keine gültige Partitionstabelle

df -h still shows
Dateisystem          Größe Benut  Verf Ben% Eingehängt auf
/dev/mapper/main-root
                          457G  138G  297G  32% /
/dev/md1               99M   46M   48M  50% /boot
none                     2,0G     0    2,0G   0% /dev/shm


@purvis

Could you show the output of df -h?
« Last Edit: March 21, 2013, 11:34:51 AM by SchulzStefan »
And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #10 on: March 21, 2013, 01:49:47 PM »
...
Expand the volume of the drive to the fullest size
...

I wonder whether that step could be automated (it's the trickiest step). If SME server starts to boot up, and has only one drive with partitions which don't fill the drive - put up a "please wait" banner and resize the volume...

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #11 on: March 21, 2013, 03:55:28 PM »
What does that mean to me?
And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #12 on: March 21, 2013, 04:37:23 PM »
What does that mean to me?

Nothing. Just a suggestion for possible (but probably difficult) improvement to the software.

Offline SchulzStefan

  • *
  • 620
  • +0/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #13 on: March 21, 2013, 04:59:52 PM »
Quote
Nothing. Just a suggestion for possible (but probably difficult) improvement to the software.

I'd like to know did I miss something? If not, is the RAID setup correct? In this case, why is df reporting the wrong size. And what does it mean for any software running on the server. And if not, how do I setup the RAID correct.
And then one day you find ten years have got behind you.

Time, 1973
(Mason, Waters, Wright, Gilmour)

Offline TerryF

  • grumpy old man
  • *
  • 1,859
  • +6/-0
Re: Question to RAID 1 replacing disks to bigger disks
« Reply #14 on: March 21, 2013, 09:36:00 PM »
You said earlier "It is not enough to dd if=/dev/sda1 of=/dev/sdb1 the bootsector? "

Did you do that?
--
qui scribit bis legit