#2800 PR merged: Use disklayout.conf keyword 'raidarray' instead of 'raid'

Labels: cleanup, fixed / solved / done

jsmeix opened issue at 2022-05-06 12:22:

jsmeix commented at 2022-05-06 14:20:

I will test it next week.
In particular ReaR's automated layout component handling
is somewhat tricky so this needs thorough attention.

jsmeix commented at 2022-05-09 11:19:

Tested with a RAID1 system:

Original VM:

# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT,UUID
NAME                        TRAN TYPE  FSTYPE            LABEL                             SIZE MOUNTPOINT UUID
/dev/sda                    ata  disk                                                        6G            
|-/dev/sda1                      part                                                        8M            
|-/dev/sda2                      part  swap                                                  1G [SWAP]     3214aa3f-5ceb-4207-8f3d-08bbaee3014f
`-/dev/sda3                      part  linux_raid_member any:raidsda3sdb                     4G            a82e1697-4be8-79aa-6f20-71d41a58219b
  `-/dev/md127                   raid1                                                       4G            
    |-/dev/md127p1               part  ext4                                                3.5G /          73553933-21f1-4aeb-848a-1dfe09516f39
    `-/dev/md127p2               part  crypto_LUKS                                         400M            6154a400-970e-4d09-8da5-8cb079fa5f20
      `-/dev/mapper/cr_home      crypt ext4                                                398M /home      ffe7a283-6007-4a30-b1ac-aadd65d1f7cc
/dev/sdb                    ata  disk  linux_raid_member any:raidsda3sdb                     5G            a82e1697-4be8-79aa-6f20-71d41a58219b
`-/dev/md127                     raid1                                                       4G            
  |-/dev/md127p1                 part  ext4                                                3.5G /          73553933-21f1-4aeb-848a-1dfe09516f39
  `-/dev/md127p2                 part  crypto_LUKS                                         400M            6154a400-970e-4d09-8da5-8cb079fa5f20
    `-/dev/mapper/cr_home        crypt ext4                                                398M /home      ffe7a283-6007-4a30-b1ac-aadd65d1f7cc
/dev/sr0                    ata  rom   iso9660           SLE-15-SP3-Full-x86_64187.11.001 11.4G            2021-05-10-15-46-36-11

The changes in this pull request result
the following (relevant) changes
in var/lib/rear/layout/disklayout.conf

-# Format: raid /dev/<kernel RAID device> level=<RAID level> raid-devices=<nr of active devices> devices=<component device1,component device2,...> [name=<array name>] [metadata=<metadata style>] [uuid=<UUID>] [layout=<data layout>] [chunk=<chunk size>] [spare-devices=<nr of spare devices>] [size=<container size>]
-raid /dev/md127 level=raid1 raid-devices=2 devices=/dev/sda3,/dev/sdb name=raidsda3sdb metadata=1.0 uuid=a82e1697:4be879aa:6f2071d4:1a58219b
+# Format: raidarray /dev/<kernel RAID device> level=<RAID level> raid-devices=<nr of active devices> devices=<component device1,component device2,...> [name=<array name>] [metadata=<metadata style>] [uuid=<UUID>] [layout=<data layout>] [chunk=<chunk size>] [spare-devices=<nr of spare devices>] [size=<container size>]
+raidarray /dev/md127 level=raid1 raid-devices=2 devices=/dev/sda3,/dev/sdb name=raidsda3sdb metadata=1.0 uuid=a82e1697:4be879aa:6f2071d4:1a58219b

and in var/lib/rear/layout/disktodo.conf

-todo /dev/md127 raid
+todo /dev/md127 raidarray

but var/lib/rear/layout/diskdeps.conf is same
(as expected because it does not contain layout
component keywords like raid versus raidarray)

Recreating it worked well for me on my replacement VM
with somewhat different disk sizes with the following result:

rear> lsblk -ipo NAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT,UUID
NAME                        TRAN TYPE  FSTYPE            LABEL                  SIZE MOUNTPOINT      UUID
/dev/sda                    ata  disk                                             5G                 
|-/dev/sda1                      part                                             8M                 
|-/dev/sda2                      part  swap                                       1G                 3214aa3f-5ceb-4207-8f3d-08bbaee3014f
`-/dev/sda3                      part  linux_raid_member localhost:raidsda3sdb    4G                 a82e1697-4be8-79aa-6f20-71d41a58219b
  `-/dev/md127                   raid1                                          3.8G                 
    |-/dev/md127p1               part  ext4                                     3.5G /mnt/local      73553933-21f1-4aeb-848a-1dfe09516f39
    `-/dev/md127p2               part  crypto_LUKS                              306M                 6154a400-970e-4d09-8da5-8cb079fa5f20
      `-/dev/mapper/cr_home      crypt ext4                                     304M /mnt/local/home ffe7a283-6007-4a30-b1ac-aadd65d1f7cc
/dev/sdb                    ata  disk  linux_raid_member localhost:raidsda3sdb  3.8G                 a82e1697-4be8-79aa-6f20-71d41a58219b
`-/dev/md127                     raid1                                          3.8G                 
  |-/dev/md127p1                 part  ext4                                     3.5G /mnt/local      73553933-21f1-4aeb-848a-1dfe09516f39
  `-/dev/md127p2                 part  crypto_LUKS                              306M                 6154a400-970e-4d09-8da5-8cb079fa5f20
    `-/dev/mapper/cr_home        crypt ext4                                     304M /mnt/local/home ffe7a283-6007-4a30-b1ac-aadd65d1f7cc
/dev/sr0                    ata  rom   iso9660           REAR-ISO              69.7M                 2022-05-09-11-03-06-12

jsmeix commented at 2022-05-09 11:21:

@rear/contributors
please have a look here to review it - perhaps you detect something?

pcahyna commented at 2022-05-09 16:29:

I think it looks fine. raidarray is a bit of pleonasm ("RAID" is a "redundant array"), but this is not a big problem. I would prefer to grep for keywords properly (including the terminal space) in disklayout, but there is nothing wrong with using belt and suspenders.

(I would consider removing "None of the component keywords is a leading substring of another component keyword (e.g. disk is not a leading substring of opaldisk) so that one can get the lines that belong to a particular component via simple commands likegrep ^keyword /var/lib/rear/layout/disklayout.conf" from the guidelines eventually in order to encourage good habits.)

jsmeix commented at 2022-05-10 10:51:

I fear I am too much addicted to my own bad habits
just using sloppy commands like

# grep ^keyword var/lib/rear/layout/disklayout.conf

on command line so I would like to keep this possibility.
Of course for scripts I would not do that but use the proper way

grep "^keyword " $DISKLAYOUT_FILE

so I made things more clear in the documentation via
https://github.com/rear/rear/pull/2800/commits/26124c940b5c7bf3c2be25d2cd96cb74baf0e73d

jsmeix commented at 2022-05-10 10:59:

Yes, I know both raidarray and raiddisk are pleonasms
and I was thinking about better names but I found none
that is better except too long and oververbose monsters
which nobody likes to type in for sloppy commands like

# grep ^oververbose_keyword_name var/lib/rear/layout/disklayout.conf

while even supersloppy commands like

# grep ^raida var/lib/rear/layout/disklayout.conf

# grep ^raidd var/lib/rear/layout/disklayout.conf

would "simply just work" ;-)

jsmeix commented at 2022-05-10 11:03:

@rear/contributors
if there are no objections
I would like to merge it tomorrow afternoon.

pcahyna commented at 2022-05-10 11:53:

Using a pleonasm is not a showstopper for me - after all pleonasms are Redundant, forming a nice self-reference :-)


[Export of Github issue for rear/rear.]