Koozali.org: home of the SME Server

[solved] Issue by sync of the RAID for /swap

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
[solved] Issue by sync of the RAID for /swap
« on: February 01, 2016, 09:22:29 PM »
Good evening,

I have got following problem on my fresh installed SME9.1 after the migration from SME8:

- Situation:

  • SME9.1, RAID1, NoLvm, only 1 disk during the installation and configuration.
  • Now that everything work and I put the disk#2 inside.
  • The disk#2 has (or should have...) the same size than the disk#1. All existing partitions get deleted before and a new partition table (msdos) has been created.
  • Start the sync of the RAID from the console.
  • md2 don't get sync.

Code: [Select]
#cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[2] sda1[0]
      255936 blocks super 1.0 [2/2] [UU]
     
md1 : active raid1 sdb3[2] sda3[0]
      972277760 blocks super 1.1 [2/2] [UU]
      bitmap: 5/8 pages [20KB], 65536KB chunk

md2 : active raid1 sda2[0]
      4093952 blocks super 1.1 [2/1] [U_]
     
unused devices: <none>
Code: [Select]
# mdadm --manage /dev/md2 --add /dev/sdb2
mdadm: /dev/sdb2 not large enough to join array

Code: [Select]
# fdisk -s /dev/sda2
4096000

# fdisk -s /dev/sdb2
4094017

Ideas:
  • with a live CD (systemrescuecd): delete and recreate the md2
    • stop md2: mdadm --stop md2
    • remove md2: mdadm --remove md2
    • remove the superblocks: mdadm --zero-superblock /dev/sda2 /dev/sdb2
    • recreate md2: sudo mdadm --create /dev/md2 --level=1 --assume-clean --raid-devices=2 /dev/sda1 /dev/sdb2
    • create a swap file system on md2: ???command???
  • with a live cd: reduce the size of md2, add sdb2 and re-increase the size
    • reduce the size of the swap file system: ???command???
    • reduce the size of md2: ?????command?????
    • add sdb2 to the raid: mdadm --manage /dev/md2 --add /dev/sdb2
    • increase the size of the raid: mdadm --grow /dev/md2 --size=max
    • increase the size of the file system: resize2fs /dev/md2   ## does this command work for a swap??

Questions:
why not idea 1?
why not idea 2?
which is the proper way to get sdb2 into the md2?

Thanks.
Regards Arnaud
« Last Edit: February 06, 2016, 05:00:21 PM by Arnaud »

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: Issue by sync of the RAID for /swap
« Reply #1 on: February 01, 2016, 11:07:01 PM »
your best bet, to avoid any kind of problem, is to backup your server, reinstall SME on the smaller disk, restore your backup, then add the bigger disk to the array.

I won't play with partitions

my 2c

Offline TerryF

  • grumpy old man
  • *
  • 1,826
  • +6/-0
Re: Issue by sync of the RAID for /swap
« Reply #2 on: February 01, 2016, 11:10:40 PM »
your best bet, to avoid any kind of problem, is to backup your server, reinstall SME on the smaller disk, restore your backup, then add the bigger disk to the array.

Took the words right out of my mouth.

I'll chuck in another 2c :-)
--
qui scribit bis legit

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Issue by sync of the RAID for /swap
« Reply #3 on: February 02, 2016, 12:17:30 AM »
Arnaud

Maybe you did not clear the MBR on the second drive (as you seem to have old partition info).
https://wiki.contribs.org/Raid#Reusing_Hard_Drives
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline ReetP

  • *
  • 3,732
  • +5/-0
Re: Issue by sync of the RAID for /swap
« Reply #4 on: February 02, 2016, 12:31:55 PM »
Good evening,

Code: [Select]
# fdisk -s /dev/sda2
4096000

# fdisk -s /dev/sdb2
4094017

409 6000 >= 409 4017

So that seems like sdb2 is smaller than sda2 or am I blind ?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: Issue by sync of the RAID for /swap
« Reply #5 on: February 02, 2016, 12:35:04 PM »
409 6000 >= 409 4017

So that seems like sdb2 is smaller than sda2 or am I blind ?

yes, and that's the problem.. I had a similar issue many years ago.. apparently same disks (brand, model, capacity) but a slight difference in size..
obviously, following Murphy's law, system was setup on a single disk only, the bigger ;-)

backup, reinstall (on the smaller), restore.. that's the (safe) way

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Issue by sync of the RAID for /swap
« Reply #6 on: February 02, 2016, 09:46:29 PM »
Hello,

and many thanks for your replies !
even if I would have hoped other indications..... something in direction of a few magic commands......

Maybe you did not clear the MBR on the second drive (as you seem to have old partition info).
https://wiki.contribs.org/Raid#Reusing_Hard_Drives
No, I didn't....
But I can try it: there is nothing to loose. But AFAIM this will not change anything because MBR is for grub and not for datas

yes, and that's the problem.. I had a similar issue many years ago.. apparently same disks (brand, model, capacity) but a slight difference in size..
obviously, following Murphy's law, system was setup on a single disk only, the bigger ;-)
It is exactly the situation.

 
Last evening, I quickly installed another sme9 with the same parameters (raid1, nolvm, only 1 disk) as a VM for tests and I gave it the second disk after the install. It gave the same result: no raid sync on md2 because of a smaller disk --> I wonder that it happen again.......
On my real sme9, I already have taken the disk#2 away a second time for re-deleting the partitions and partition-table after the first flop of syncing the raid. The Gparted of my Fedora gave me this kind of warning message by reading this disk (coming out of the sme9): "the partition can be outside of the disk" --> could it be possible that Anaconda makes a different (not very correct??) partitioning than during an afterward sync??

backup, reinstall (on the smaller), restore..
I hope that the second installed disk isn't seen automatically smaller than the first one!!

As it is "only" the swap, I don't feel in a hurry, so I will further use the VM for tests
  • for the commands (I'm curious to see what happen)
  • for the installation on the disk#2 first to see if disk#1 is still bigger.....


Thanks!
Regards Arnaud

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Issue by sync of the RAID for /swap
« Reply #7 on: February 02, 2016, 09:56:46 PM »
Arnaud
 
Quote
No, I didn't....
But I can try it: there is nothing to loose. But AFAIM this will not change anything because MBR is for grub and not for datas

All (both) disks should be erased using the commands referred to.
Another old tool is delpart, I think that will do the job also.

Quoting:
If it was ever installed on a Windows machine (or in some cases an old system) then you will need to clear the MBR first before installing it.
From the linux command prompt, type the following:
dd if=/dev/zero of=/dev/hdx bs=512 count=1
dd if=/dev/zero of=/dev/sdx bs=512 count=1
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Issue by sync of the RAID for /swap
« Reply #8 on: February 06, 2016, 05:00:01 PM »
Hello,

because I wanted to avoid to wait 5h for the restoration of the backup in addition to some supplementary hours to reinstall all the contribs, I tried to get it run without starting from zero.

In fact it is very easy to solve, ..............as soon as the right method is known...... 8-) Further more, the sme can run without swap --> I didn't have to stop the server!
The main steps were given in the first post:
  • stop the swap
  • delete the RAID device
  • recreate it with the partitions of both disks and with the original UUID
  • recreate the swap partition, with the original UUID
  • reboot

The details are given here https://wiki.guedel.eu/doku.php?id=Welcome:SME-server:Rebuild%20RAID

Reusing the original UUID makes the things very simple: all the parameters are still valid and don't need any modification.

Bye
Arnaud

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: [solved] Issue by sync of the RAID for /swap
« Reply #9 on: February 06, 2016, 05:27:30 PM »
glad to hear that you solved you issue..

Arnaud, is that wiki yours? if so, would you mind to add that page in our wiki too?

what about centralizing all the knowledge in a single place? :-)

TIA

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: [solved] Issue by sync of the RAID for /swap
« Reply #10 on: February 06, 2016, 06:37:43 PM »
Arnaud, is that wiki yours? if so, would you mind to add that page in our wiki too?
Yes, no!   :-D

Of course I can (and will) do it if it is wished and recognized as "best practice deserving to be pinned".
I just wanted to avoid top pollute the "official" wiki with every small trick.

Quote
what about centralizing all the knowledge in a single place?
It is .........dangerous.....  :-P

Bye
Arnaud

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: [solved] Issue by sync of the RAID for /swap
« Reply #11 on: February 07, 2016, 12:04:17 AM »
Arnaud

Quote
I just wanted to avoid to pollute the "official" wiki with every small trick.

Adding small tricks (as you call them) to the contribs.org wiki, is a good thing to do. People can then find a wealth of information for various workarounds & fixes etc.
Tips like this one can certainly aid troubleshooting.

Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Issue by sync of the RAID for /swap
« Reply #12 on: February 07, 2016, 04:26:29 AM »
Last evening, I quickly installed another sme9 with the same parameters (raid1, nolvm, only 1 disk) as a VM for tests and I gave it the second disk after the install. It gave the same result: no raid sync on md2 because of a smaller disk --> I wonder that it happen again.......

Please report all the details carefully in the bug tracker. Perhaps someone can come up with a fix so that it all "just works".

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: [solved] Issue by sync of the RAID for /swap
« Reply #13 on: February 08, 2016, 10:17:29 PM »
You are right: avoiding the problem to come is better than solving it!

ASAP: my sme was 3 days offline...... :sad:

Offline Stefano

  • *
  • 10,839
  • +2/-0
Re: [solved] Issue by sync of the RAID for /swap
« Reply #14 on: February 09, 2016, 09:47:42 AM »
Please report all the details carefully in the bug tracker. Perhaps someone can come up with a fix so that it all "just works".

well.. IMO there's nothing that can be fixed.. if you install SME on a single disk (raid1 degraded) and then add a disk which is smaller... :-)

the real fact is that with a reasonable amount of ram you can live without swap, at least temporarily.. and then you can resize swap partition