Custom raid partitions

Hello,

In terms of hard disk failure when using raid 1 setup,
how important is to use one of the following (example) partition setups not to run in “GRUB hard disk error” if one of the disks fails.

Which method is prefered? To make “boot” partition or not?

1st:

  • /boot 100 MB
  • /swap 1GB
  • / 10 GB
  • /home (the rest of the hard disk)

or

2nd:

  • /swap 1GB
  • / 10 GB
  • /home (the rest of the hard disk)

Hi
I normally use swap, boot and then / (use another disk for data rather
than a /home).

sda1 - swap (pri=2)
sda2 - /boot
sda3 - / (md0)

sdb1 - swap (pri=1)
sdb2 - /spare_boot (don’t mount)
sdb3 - / (md0)

I use dd to keep a backup on the spare boot.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 4 days 9:32, 3 users, load average: 0.10, 0.06, 0.01
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

@malcolmlewis

I’m trying to build raid 1 with 2(two) disks of same size.
I made raid 1 with:

sda /swap
sda /
sda /srv

and

sdb /swap
sdb /
sdb /srv

When trying to boot from “sda” it works fine, but when trying to boot from “sdb” it fails (“GRUB hard disk error”).
How to create partition, that I’ll be able also to boot from “sdb” in case of “sda” disk failure?

Hi
On the dvd there is a perl script called mkbootdisk (/boot/{arch}/.

This is the reason I make the separate /boot so you can then modify
the grub entries if required.

Have a look at the install howto’s for more details
http://en.opensuse.org/Howto


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 4 days 10:32, 3 users, load average: 0.16, 0.11, 0.07
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

@malcolmlewis

I’m using yast to make partitions, I was following this tutorial How to install openSUSE on software RAID - openSUSE, however I’m having problems to do next part:

" Boot Loader

Naturally, the boot loader must be placed outside of any raid partition, preferably into MBR of a disk. Even Raid 1 setups require this. Raid 0 setups might also require the /boot partition to be outside of any raid partition, or modify initrd to include raid modules on boot."

Hi
You can go through a normal install and configure to your requirements.
I would also ensure using the fstab button to configure the drives to
use ‘device name’ rather than device id. Along with instlling the
bootloader to mbr.

The additional steps to configure the other disk as bootable can be done
post install.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 4 days 11:50, 3 users, load average: 0.05, 0.17, 0.16
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

@malcolmlewis

Hello,

Can you please describe how to install bootloader to MBR, on both disks (sda,sdb). So I’ll be ble to boot from second “sdb” disk if primary fails.

Thank you.

Hi
After the install is finished, install syslinux and use dd


zypper in syslinux
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb
dd if=/dev/sda2 of=/dev/sdb2

The first dd command writes the mbr on the
disk, the second will copy the boot partition. You will probably need
to modify the grub mapping for sdb in /boot/grub/menu.lst.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 4 days 13:09, 3 users, load average: 0.24, 0.13, 0.09
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

Hi
It may be easier to use grub and build the boot.


grub
root (hd1,1)
setup (hd1)
quit

Also if the disk has failed you would need to change the fstab entry
for /boot from sda to sdb.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 0:17, 3 users, load average: 0.69, 0.47, 0.32
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

@malcolmlewis

Hello,

I have used … command to see what disk to use:

grub

grub> find /grub/stage1

and

grub

grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)

Now it works perfect, and second disk (sdb) also boots if used as a primary/single without demaged one.
However when trying to replace just broken disk it fails.
If can, please point me in the right direction how to approach broken disk replacement with yast, after “messing” with disks back and forth I noticed that “sdb2”(/) partition gets “unused”, after switching couple of times “sda”, “sdb” as primary boot.

Hi
Did you set the boot flag on as active on sdb2? Can you post the
output from fdisk -l

You need to look at madm commands, the system should keep running if a
disk breaks, it’s just degraded. At this point there would be some
steps for you to take in preparation for replacing a broken disk so
that it will boot with only one disk. Then you would shutdown, replace
the disk, reboot and prepare the new disk so it can be added back and
would rebuild.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 4:31, 3 users, load average: 0.34, 0.37, 0.19
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

@malcolmlewis

Hello,

I have just used following commands

grub

grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)

to make second disk (sdb) bootable…

When tested by disconnecting one of 2 (two) disks I can no longer open Firefox, Thunderbird …

So my question is how to build a solid raid 1 system, and how to prevent second disk to hung if one of disks fails?

Lets step back and think this through from beginning to get an overview.

When I have made a solid RAID1 setup, I used identical partition tables.

First off I make system work with

/boot - sda1
/ - sda5

Now we know that GRUB is installed to (hd0). Then build the md devices, run system with degraded RAID set & make sure the initrd includes the right RAID modules.

Then add the mirror partitions sdb1 & sdb5.

Now we know that sda1 & sdb1 are bit copies.

That means we cannot boot off sdb, unless it thinks it is first BIOS disk (0x80). So swap boot disk in BIOS (which should remap the BIOS disk numbers), or remove power from sda and boot from sdb, now known by md devices. That then works because sdb has become (hd0) when it’s the only disk.

We can have non mirrored /boot partition as an alternative, in that case you need to install GRUB, but you are likely to have things confused trying to do that with 2 disks present, so you get 2nd disk working either with both disks running, or with 1 but not covering both cases at same time.

There’s an update to Perl Bootloader in update/11.2-test repo, which fixes a problem of calculating the wrong md partition, so if you try to “get it working” using a different method to mine you may need to apply that first.

When trying to make cutom partitions like:

/boot
swap
/
/srv
/home

it stops when it gets to 5th, first four partitions are created fine, but when I push add buttun to create 5th partition I get “ERROR, it is not possible to create a partition on /dev/sda”, same thing happens with /dev/sdb???

Hi
That’s right, you can only make four, so you need to make an extended
partition.

I recommend moving swap and home to the end of the drive, since it
shouldn’t get used much. So do it like this;

sda1 - /boot
sda2 - /
sda3 - /srv
sda4 - extended (equal to the sum of swap and home)
sda5 - /home
sda6 - swap


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 22:13, 3 users, load average: 0.15, 0.12, 0.14
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

Funny, I tend to make 1 or 2 primaries, then the rest of the disk extended so / is “stably” in sda5. I just picked sda5 for / as a typical example, the first “logical” partition; not for any voodoo properties!

But I guess it’s a good thing to find out :slight_smile:

I recommend moving swap and home to the end of the drive, since it
shouldn’t get used much. So do it like this;

On a desktop though, the Desktop environment is often hammering dot files under /home. I’d likely swap /srv and / in Malcolm’s example and have some other data following /home, keeping all the frequently used stuff together near /. Most page faults are on /usr, and tend to occur when /home is accessed on login for example. So I like to reduce seeking.

But let’s keep out partitioning schemes out of this thread, it’s missing the point.

We just need to care about the 2 partitions, /boot and / that are in identical places and sizes on the disks. So have primary & extended partition tables matching up to /, which can indeed be first logical partition.

Then by logic, you know that the bit copy is a correct configuration! Taking methodical step after step to get to the result.

@malcolmlewis

I apologize for asking, but how can I make

sda1 - /boot
sda2 - /
sda3 - /srv
sda4 - extended (equal to the sum of swap and home)
sda5 - /home
sda6 - swap

if I can only make four of them?

Hi
Maybe user erik100 can clarify, but my impression was this is a web
server install?

But yes, if user erik100 can just do a test as described to get over
the first hurdle, then can work out a suitable scheme for the system :slight_smile:


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.39-0.3-default
up 1 day 0:22, 3 users, load average: 0.03, 0.07, 0.08
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.18

Hello,

I’ll try to explain simple way, since I’m lost but half way there …

I have 2 physical hdd in my computer. (hda, hdb)
I connect them to sata connectors on motherboard.
I insert opensuse 11.2.iso image, I reboot computer, when installation runs and comes to partitioning part, I choose to make custom partitions like:

first I make partitions for /dev/hda disk

  • 100.00 MB
  • 4.00 GB
  • 40.00 GB
  • rest of the hard disk

second I make partitions for /dev/hdb disk

  • 100.00 MB
  • 4.00 GB
  • 40.00 GB
  • rest of the hard disk

For all above *8 partitions *4 on each disk (sda, sdb) I choose “New partition type = primary partition”, “do not format partition = 0xFD linux raid”, “do not mount partition”. Under “menu/raid” I geather all same size partitions from /dev/sda and /dev/sdb.

Example:

raid 1 (mirroring)
/dev/sda1 + /dev/sdb1 (format partition = Ext4, mount partition = /boot)

raid 1 (mirroring)
/dev/sda2 + /dev/sdb2 (format partition = Swap, mount partition = swap)

raid 1 (mirroring)
/dev/sda3 + /dev/sdb3 (format partition = Ext4, mount partition = /)

raid 1 (mirroring)
/dev/sda4 + /dev/sdb4 (format partition = Ext4, mount partition = /home)

Now the output is:

/dev/sda1 + /dev/sdb1 = /dev/md0 (Type = MD raid Ext4, Mount Point = /boot)
/dev/sda2 + /dev/sdb2 = /dev/md1 (Type = MD raid Swap, Mount Point = swap)
/dev/sda3 + /dev/sdb3 = /dev/md2 (Type = MD raid Ext4, Mount Point = /)
/dev/sda4 + /dev/sdb4 = /dev/md3 (Type = MD raid Ext4, Mount Point = /home)

After above I make installation of opensuse 11.2.
Since I’m using this setup on one of test servers, after OS is running I just unplug one of disks (/dev/sda, or dev/sdb), however second disk also fails to continue functioning normal.

Hope that above explains the situation. **The question is how to force “healthy” disk (sda, or sdb) to stay in place and do it’s job if second disk (sda, or sdb) fails?

**