RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1278767 - parted doesnt tokenize "free" keyword when there is a warning for the partition
Summary: parted doesnt tokenize "free" keyword when there is a warning for the partition
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: parted
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-06 11:28 UTC by nikhil kshirsagar
Modified: 2019-08-15 05:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-06 16:50:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description nikhil kshirsagar 2015-11-06 11:28:22 UTC
Description of problem:
parted doesnt tokenize "free" keyword when there is a warning for the partition. 
Example of issue faced

[root@slab290vm4 omc]# parted /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:8:0 unit MB print free
Warning: Not all of the space available to /dev/sde appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the
current setting?
parted: invalid token: free

Why is free an invalid token ? its valid if there is no warning associated with the partition.

[root@nkshirsa nkshirsa]# parted /dev/sda unit MB print free
Model: ATA SAMSUNG MZ7TE256 (scsi)
Disk /dev/sda: 256061MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start     End       Size      Type     File system  Flags
        0.03MB    1.05MB    1.02MB             Free Space
 1      1.05MB    3222MB    3221MB    primary  ext4         boot
 2      3222MB    256060MB  252838MB  primary
        256060MB  256061MB  0.35MB             Free Space


Version-Release number of selected component (if applicable):



[root@slab290vm4 omc]# rpm -qa | grep parted
parted-2.1-29.el6.x86_64


[root@slab290vm4 omc]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
How reproducible:


Steps to Reproduce:
1. run parted with "free" or possible any other supported token for a partition which has some warning associate with it, for instance, Warning: Not all of the space a appears to be used, or in case there is no backup partition table stored at the end of the disk.

current setting?

Actual results:


Expected results:
parted should not claim free is an invalid token even if there is an associated warning for the partition.

Additional info:
I also would like a feature to suppress warnings in parted, in case the user tries to automate parted using the -s switch, the warnings require intervention and defeat the automation..


[root@sprintlab423vm4 ~]# /sbin/parted -s /dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:2:0 mkpart primary 65927MB 68075MB
Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
Warning: Not all of the space available to /dev/sdc appears to be used, you can fix the GPT to use all of the space (an extra 4194304 blocks) or continue with the current setting?
Error: Unable to satisfy all constraints on the partition.  <--------

Comment 3 Brian Lane 2015-11-06 16:50:47 UTC
You need to pass -s on the cmdline when using multiple commands. Also note that you are still prompted to fix/ignore when this happens.

Comment 5 nikhil kshirsagar 2015-11-09 04:20:58 UTC
is there also a way to suppress the parted warnings that break the automation ? 

for instance, as soon as there is a warning and parted expected ignore/fix responses, the automation breaks.. how do we supress this warning to always ignore?

Comment 6 Brian Lane 2015-11-09 22:43:11 UTC
parted reads the commands from the cmdline as needed, the warning interrupts this and when not using -s it is processed as an invalid response.

You cannot suppress the warnings, and even if you could you wouldn't want to -- you'd end up losing data or with unexpected results. When -s is used any error or warning fails safe, preventing data loss.

If you are going to automate things by scripting with parted you need to use -s and check parted's return code.


Note You need to log in before you can comment on or make changes to this bug.