#1369 PR merged: Support for Grub2 + RAID1 on POWER

Labels: enhancement, bug, cleanup, fixed / solved / done

schabrolles opened issue at 2017-05-19 10:40:

Patch to support grub2 installation with software RAID1 on Linux on POWER (ppc64/ppc64le)

  • Need to loop over multiple PReP partition and install grub2 on it.
  • Need to use chroot with set a proper PATH in order for grub2-install
    to call additional tool when /boot is set on md devices.

Tested with CentOS 7 LE pp64le

RESCUE centos7-145:~ # rear -v recover
Relax-and-Recover 2.00-git201705171620 / 2017-05-17
Using log file: /var/log/rear/rear-centos7-145.log
Running workflow recover within the ReaR rescue/recovery system
Starting required daemons for NFS: RPC portmapper (portmap or rpcbind) and rpc.statd if available.
Started RPC portmapper 'rpcbind'.
RPC portmapper 'rpcbind' available.
Started rpc.statd.
RPC status rpc.statd available.
Started rpc.idmapd.
Using backup archive '/tmp/rear.ioiBj1IRYgh5lr2/outputfs/centos7-145/backup.tar.gz'
Calculating backup archive size
Backup archive size is 546M     /tmp/rear.ioiBj1IRYgh5lr2/outputfs/centos7-145/backup.tar.gz (compressed)
Comparing disks.
Disk configuration is identical, proceeding with restore.
Start system layout restoration.
Creating partitions for disk /dev/vda (msdos)
Creating partitions for disk /dev/vdb (msdos)
Creating software RAID /dev/md127
Creating software RAID /dev/md126
Creating LVM PV /dev/md126
  0 logical volume(s) in volume group "rootvg" now active
Restoring LVM VG rootvg
Sleeping 3 seconds to let udev or systemd-udevd create their devices...
Creating filesystem of type xfs with mount point / on /dev/mapper/rootvg-root.
/dev/mapper/rootvg-root: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
Mounting filesystem /
Creating filesystem of type xfs with mount point /boot on /dev/md127.
/dev/md127: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
Mounting filesystem /boot
Creating swap on /dev/mapper/rootvg-swap
Disk layout created.
Restoring from '/tmp/rear.ioiBj1IRYgh5lr2/outputfs/centos7-145/backup.tar.gz'...
Restored 1463 MiB [avg. 74932 KiB/sec] OK
Restored 1463 MiB in 21 seconds [avg. 71364 KiB/sec]
Restoring finished.
Restore the Mountpoints (with permissions) from /var/lib/rear/recovery/mountpoint_permissions
Running mkinitrd...
Updated initrd with new drivers for kernel 3.10.0-514.el7.ppc64le.
Installing GRUB2 boot loader
Boot partition found: /dev/vda1
grub installed on /dev/vda1
Boot partition found: /dev/vdb1
grub installed on /dev/vdb1
Finished recovering your system. You can explore it under '/mnt/local'.

schlomo commented at 2017-05-19 10:57:

@schabrolles great stuff! ReaR users really have to thank you a lot for your contributions.

I just was wondering about the following question: What is - from a ReaR perspective - the difference between ppc64 and ppc64le? Maybe we can treat them as one similar to how we treat i386 and amd64 as one?

jsmeix commented at 2017-05-19 12:54:

Only FYI as a side note regarding
I used

# find usr/share/rear -name '*.sh' -ls | grep ppc64

and it seems much is same for ppc64 and ppc64le
but I found some differences in several files.

schabrolles commented at 2017-05-19 13:39:

it refers to the endianness.

  • During 90's, most the UNIX were Big Endian (AIX, Solaris, HP-UX, etc ...). (POWER runs IBM AIX)
  • In 2001, Linux is supported on POWER (big-endian was choosen, may be easier to migrate as AIX was Big-Endian)
  • In 2013, IBM want to accelerate Linux on POWER and create openPOWER foundation (google, nvidia, IBM, mellanox etc ...)
    OpenPOWER push Little-Endian (easier to port x86 code on POWER as x86 is Little Endian).

POWER8 processor can run Big or Little Endian:
but binary are Big or Little Endian => OS is Big or Litlle
ppc64: refers to the original ppc 64 bits (big-endian)
ppc64le : refers to the new architecture ppc 64 bits little endian

The future is clearly ppc64le. ppc64 still exists for transition of application to LE

From a user/admin point of LE or BE are the same, we choose the right version depending to the availability of the software we want to use.

Short status of what is available on POWER:

Linux distro Endianness Bootloader
RedHat 6 ppc64 only yaboot
RedHat 7.1 or > ppc64 or ppc64le (2 different version) grub2
Sles11 ppc64 only yaboot/lilo
Sles12 ppc64le only grub2
Ubuntu ppc64le only (named ppc64el !!!!) grub2
debian ppc64le only grub2

Redhat 7 is the only Linux distro with 2 different version available (BE or LE)
Grub2 is the preferred bootloader for new distro.

I hope it answers to your question.

@jsmeix I think there is some cleaning we can make there to avoid duplicates...
the command you gave definitely help to find them...
find usr/share/rear -name '*.sh' -ls | grep ppc64

The table above could help to understand some choice I made like:
if ppc64le => grub2
but ppc64 can be yaboot (rh6), lilo(sles11), grub2(rh7be)

schabrolles commented at 2017-05-19 14:50:

@schlomo I update the code with /usr/sbin/env instead of /bin/bash... it works
tested with centos7 ppc64le

schlomo commented at 2017-05-19 14:53:

@schabrolles thanks for the nice overview. What I meant is https://github.com/rear/rear/blob/master/usr/share/rear/conf/default.conf#L78 where we map all x86 and x64 architectures to i386 because there is no difference in code (and we use /lib* instead of /lib to mask the difference).

I was wondering if the same could be done for either all ppc architectures or at least for all ppc64 architectures.

schabrolles commented at 2017-05-19 15:03:

@schlomo Yes, they are quite equivalent. I already try to use link when I can.

447024    0 lrwxrwxrwx   1 root     root           44 May 19 10:29 usr/share/rear/finalize/Linux-ppc64/680_install_PPC_bootlist.sh -> ../Linux-ppc64le/680_install_PPC_bootlist.sh
447023    0 lrwxrwxrwx   1 root     root           37 May 19 10:29 usr/share/rear/finalize/Linux-ppc64/620_install_grub2.sh -> ../Linux-ppc64le/620_install_grub2.sh

I prefer ppc64 -> ppc64le as it will be the "preferred" architecture for the future.

The command provided by @jsmeix will help us to continue the cleaning for the ppc64/ppc64le part.

jsmeix commented at 2017-05-22 08:38:

If all what belongs directly to this pull request is solved
I would like to merge it tomorrow (to get it into ReaR 2.1)
unless there are objections.

The general ppc64/ppc64le cleanup should
be done after the ReaR 2.1 release.

schlomo commented at 2017-05-22 09:14:

I guess RedHat will be very happy to support PPC with ReaR :-)

jsmeix commented at 2017-05-24 07:38:

Merged to have that in ReaR 2.1.

[Export of Github issue for rear/rear.]