Skip to content

[Method Improvement] Update DiskSetup.sh to Ensure That parted or wipefs Are Consistently Used for Clearing Pattition Tables #54

@ferricoxide

Description

@ferricoxide

Describe the bug

With RHEL 9, in particular, use of the:

dd if=/dev/zero of="${CHROOTDEV}" bs=512 count=1000 > /dev/null 2>&1 || \

Is contraindicated. Better methods are:

parted -sf "${CHROOTDEV}" rm "${PART_NUM}"

Or:

wipefs -a "${CHROOTDEV}" 

The parted -sf ... method is used in the script, but not universally.

Severity

  • Moderately Broken (Trivial work-around)

To Reproduce
Steps to reproduce the behavior:

  1. Run AMIgen9
  2. Observe script-outputs
  3. Note that outputs include a block like:
    [...ELIDED...]
    logger -i -t DiskSetup.sh -p kern.crit -s -- 'Clearing existing partition-tables...'
    [[ NONE =~ ^[0-9]+$ ]]
    dd if=/dev/zero of=/dev/sda bs=512 count=1000
    partprobe /dev/sda
    [...ELIDED...]
    (Example from Azure)
  4. Build-script may or may not error-exit after this output

Expected behavior

All partitions should be removed using either parted -s <DEVICE> rm <TARGET_SLICE> or, per updated guidance from Red Hat, wipefs -a <DEVICE> .

Deviance Description

Previous efforts to remove/replace use of the dd-based method seem to be incomplete.

Screenshots

Additional context

Fix Suggestions

Update all actions attempting to clear the target-device's partitions to us the parted or wipefs method.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions