Comment 25 for bug 1487365

Revision history for this message
bugproxy (bugproxy) wrote : partman-prep: basic support for PReP partitions out of Software RAID1 devices

------- Comment on attachment From <email address hidden> 2016-01-12 08:12 EDT-------

Hi Canonical @mathieu-tl,

Here's a patch for partman-prep for basic support to Software RAID1 devices.

- It allows for manual and guided partitioning with a PReP partition in one of the component devices (not in the RAID array, which is currently not support by grub2), which is enough for our needs at this time.
- The current limitation is, for guided partitioning only, after the partitions are created in the RAID device, it's required to select the PReP partition in the component device (and just exit w/ Done setting up this partition), to make sure the 'method' file contains 'prep' (autopartitioning renames that to 'method-old', and I didn't find a safe/quick method to rename that back in the correct PReP partition... ideas welcome :- ).

This is the error fixed for Manual partitioning (see patch):

    ~ # tail /var/log/syslog
    <...>
    <...> clear_partitions: Considering /,/dev/sda1.
    <...> main-menu[1679]: (process:12610): mount: mounting /dev/sda1 on /tmp/tmp.VVjm38 failed: Invalid argument
    <...> main-menu[1679]: (process:12610): umount: can't umount /tmp/tmp.VVjm38: Invalid argument
    <...> main-menu[1679]: (process:12610): mount: mounting /dev/sda1 on /mnt/tmpmount failed: Invalid argument

Tested with Trusty jan/12 daily build, in this scenario:
- 2 disks (sda, sdb)
- PReP partition in sda1
- Software RAID1 in 'sda free space #2' (after PReP partition) and 'sdb free space #1' (entire disk)

... with the following partitioning methods:
1) manual partitioning
2) guided partitioning
3) guided partitioning w/ LVM

All have successfully installed and booted.

For reference, the relevant parts of the installer's syslog, and post-install/post-boot partitions/LVs used:

~ # grep 'prep_sync_flag\|grub-installer' /var/log/syslog
<...> anna[6666]: DEBUG: retrieving grub-installer 1.78ubuntu20.3
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> prep_sync_flag: Not setting the PReP partition flag on Software RAID device '/dev/md0' (writes not yet supported by grub2)
<...> main-menu[1675]: INFO: Menu item 'grub-installer' selected
<...> grub-installer: info: architecture: ppc64el/chrp_ibm
<...> grub-installer: info: Identified partition label for /dev/md0p2: loop
<...> grub-installer: info: Wiping PReP partition /dev/sda1
<...> grub-installer: info: Installing grub on '/dev/sda1'
<...> grub-installer: info: grub-install does not support --no-floppy
<...> grub-installer: info: Wiping PReP partition /dev/sda1
<...> grub-installer: info: Running chroot /target grub-install --force "/dev/sda1"
<...> grub-installer: Installing for powerpc-ieee1275 platform.
<...> grub-installer: Installation finished. No error reported.
<...> grub-installer: info: grub-install ran successfully

$ mount | grep ' / '
/dev/mapper/ubuntu--vg-root on / type ext4 (rw,errors=remount-ro)

$ cat /proc/swaps
Filename Type Size Used Priority
/dev/dm-1 partition 1417152 0 -1

$ sudo lvm lvs
  LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
  root ubuntu-vg -wi-ao--- 30.38g
  swap_1 ubuntu-vg -wi-ao--- 1.35g

$ sudo lvm pvs
  PV VG Fmt Attr PSize PFree
  /dev/md0p3 ubuntu-vg lvm2 a-- 31.73g 0

$ for dev in sda sdb md0; do sudo parted /dev/$dev print; done
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 1049kB 8389kB 7340kB prep
 2 8389kB 34.4GB 34.4GB raid

Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 1049kB 34.4GB 34.4GB raid

Model: Linux Software RAID Array (md)
Disk /dev/md0: 34.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
 1 17.4kB 8018kB 8001kB boot
 2 8018kB 264MB 256MB ext2
 3 264MB 34.3GB 34.1GB lvm