Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-119566

GNU parted unintentionally shrink partitions without warning

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Undefined Undefined
    • None
    • rhel-8.10
    • parted
    • None
    • No
    • Low
    • image-builder-1
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      What were you trying to do that didn't work?

      The user tried to shrink the partition size and they canceled. However, the partition size was unintentionally shrunk.

      What is the impact of this issue to you?

      The user was confused because the couldn't know why the partition was changed.

      Please provide the package NVR for which the bug is seen:

      parted-3.2-39.el8.x86_64

      How reproducible is this bug?:

      Reproducible

      Steps to reproduce

      1. Attach a new disk to the host (e.g. /dev/sdb)
      2. Create a new partition:
        1. parted /dev/sdb 
        2. mklabel msdos
        3. mkpart primary 2048s 1GB
        4. print
        5. quit
      3. Shrink the partition created with step 2:
        1. parted /dev/sdb 
        2. resizepart 1 500MB
        3. Tyep "No" on the prompt "Warning: Shrinking a partition can cause data loss, are you sure you want to continue?"
        4. print
        5. resizepart 1 600MB
        6. quit
      4. Show the partition table
        1. parted /dev/sdb print

      Expected results

      • The "print" command shows the previous value (1GB in this example) on step 3-4
      • The "resizepart" command warns about shrinking the partition on step 3-5
      • The "parted" command shows the partition is not changed on step 4-1

      Actual results

      • The "print" command shows that the partition is shrank to 500MB on step 3-4 even the user typed "No" on step 3-3
      • The "resizepart" command doesn't warn about shrinking the partition on step 3-5
      • the "parted" command shows the partion is shrank to 600MB on step 4-1

       

      BTW, this issue doesn't occur on RHEL-9. I think the following upstream commit might fix this issue:

      clean the disk information when commands fail in interactive mode.

              brlane@redhat.com Brian Lane
              rhn-support-syoshida Shigeru Yoshida
              Brian Lane Brian Lane
              Release Test Team Release Test Team
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: