#3411 Issue closed: Enhance 300_map_disks.sh to also print the disk sizes

Labels: enhancement, fixed / solved / done

gdha opened issue at 2025-02-28 10:11:

Platform

Linux x64

When performing a DR on a system with lots of disks it may become cumbersome to know which disk relates to the original disk, therefore, it would be nice that in the rear logs also the disk size would be listed. That makes life a bit easier to tag which disk is linked to what (of the original ones).

2025-02-28 09:05:07.217022299 Including layout/prepare/default/300_map_disks.sh
2025-02-28 09:05:07.411556781 Using /dev/sda (same name and same size 59055800320) for recreating /dev/sda
2025-02-28 09:05:07.421783784 Using /dev/sdb (same name and same size 107374182400) for recreating /dev/sdb
2025-02-28 09:05:07.431783600 Using /dev/sdc (same name and same size 429496729600) for recreating /dev/sdc
2025-02-28 09:05:07.441584014 Using /dev/sdd (same name and same size 21474836480) for recreating /dev/sdd
2025-02-28 09:05:07.483250556 Original disk /dev/sde does not exist (with same size) in the target system
2025-02-28 09:05:07.489534091 /dev/sda excluded from device mapping choices (is already used as mapping target)
2025-02-28 09:05:07.495736646 /dev/sdb excluded from device mapping choices (is already used as mapping target)
2025-02-28 09:05:07.501468133 /dev/sdc excluded from device mapping choices (is already used as mapping target)
2025-02-28 09:05:07.507184561 /dev/sdd excluded from device mapping choices (is already used as mapping target)
2025-02-28 09:05:07.509295222 sr0 excluded from device mapping choices (is a removable device)
2025-02-28 09:05:07.510573838 No device found where to /dev/sde could be mapped so that it will not be recreated
2025-02-28 09:05:07.515821124 Current disk mapping table (source => target):
  /dev/sda => /dev/sda
  /dev/sdb => /dev/sdb
  /dev/sdc => /dev/sdc
  /dev/sdd => /dev/sdd
2025-02-28 09:05:07.528597125 Currently unmapped disks and dependent devices will not be recreated

PS: this script requires that library script usr/share/rear/lib/write-protect-functions.sh is available as well (could be important if back-ported to ReaR v2.6).

Describe the solution you'd like

Will create a Pull Request #3412 . It has been tested out in a real DR scenario already.

Describe alternatives you've considered

No response

Additional context

gdha commented at 2025-03-03 12:49:

Reported at RedHat: https://access.redhat.com/support/cases/#/case/04074004

gdha commented at 2025-03-06 09:31:

Output from a real test:

2025-03-06 09:33:46.436564564 Including layout/prepare/default/300_map_disks.sh
2025-03-06 09:33:46.878464089 '/dev/sda' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.879697040 Using /dev/sda (same name and same size 48318382080) for recreating /dev/sda
2025-03-06 09:33:46.900153935 '/dev/sdc' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.901367358 Using /dev/sdc (same size 107374182400) for recreating /dev/sdb
2025-03-06 09:33:46.918038187 '/dev/sdb' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.919244270 Using /dev/sdb (same size 59055800320) for recreating /dev/sdc
2025-03-06 09:33:46.927996910 '/dev/sdd' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.929169678 Using /dev/sdd (same name and same size 1073741824000) for recreating /dev/sdd
2025-03-06 09:33:46.938232895 '/dev/sde' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.939421037 Using /dev/sde (same name and same size 10737418240) for recreating /dev/sde
2025-03-06 09:33:46.948316715 '/dev/sdf' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.949507778 Using /dev/sdf (same name and same size 10737418240) for recreating /dev/sdf
2025-03-06 09:33:46.958384475 '/dev/sdg' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.959665194 Using /dev/sdg (same name and same size 5368709120) for recreating /dev/sdg
2025-03-06 09:33:46.968393863 '/dev/sdh' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.969547443 Using /dev/sdh (same name and same size 17179869184) for recreating /dev/sdh
2025-03-06 09:33:46.978391071 '/dev/sdi' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.979623286 Using /dev/sdi (same name and same size 536870912000) for recreating /dev/sdi
2025-03-06 09:33:46.988530674 '/dev/sdj' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:46.989829899 Using /dev/sdj (same name and same size 536870912000) for recreating /dev/sdj
2025-03-06 09:33:47.051093979 '/dev/sdm' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.052446194 Using /dev/sdm (same size 536870912000) for recreating /dev/sdk
2025-03-06 09:33:47.120408375 '/dev/sdn' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.121646236 Using /dev/sdn (same size 536870912000) for recreating /dev/sdl
2025-03-06 09:33:47.187642130 '/dev/sdo' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.188937253 Using /dev/sdo (same size 590558003200) for recreating /dev/sdm
2025-03-06 09:33:47.258104393 '/dev/sdp' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.259410996 Using /dev/sdp (same size 16106127360) for recreating /dev/sdn
2025-03-06 09:33:47.310356341 '/dev/sdk' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.311618143 Using /dev/sdk (same size 21474836480) for recreating /dev/sdo
2025-03-06 09:33:47.367076708 '/dev/sdl' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)
2025-03-06 09:33:47.368263629 Using /dev/sdl (same size 5368709120) for recreating /dev/sdp
2025-03-06 09:33:47.397798155 Current disk mapping table (source => target):
  /dev/sda => /dev/sda
  /dev/sdb => /dev/sdc
  /dev/sdc => /dev/sdb
  /dev/sdd => /dev/sdd
  /dev/sde => /dev/sde
  /dev/sdf => /dev/sdf
  /dev/sdg => /dev/sdg
  /dev/sdh => /dev/sdh
  /dev/sdi => /dev/sdi
  /dev/sdj => /dev/sdj
  /dev/sdk => /dev/sdm
  /dev/sdl => /dev/sdn
  /dev/sdm => /dev/sdo
  /dev/sdn => /dev/sdp
  /dev/sdo => /dev/sdk
  /dev/sdp => /dev/sdl

Thanks to the mentioned sizes it was for me much easier to verify it picked the right disk devices (with the corresponding size). Before it was not that simple (more guessing).

jsmeix commented at 2025-03-07 12:29:

I dare to close it when it is "fixed/solved/done".


[Export of Github issue for rear/rear.]