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 1225694 - Disk partition table is broken after wiping an extended partition
Summary: Disk partition table is broken after wiping an extended partition
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-28 02:16 UTC by Yang Yang
Modified: 2015-11-19 06:39 UTC (History)
8 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:39:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Yang Yang 2015-05-28 02:16:03 UTC
Description of problem:
Disk partition table is broken after wiping an extended partition

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. define/build/start a disk pool
# cat disk-pool.xml
<pool type="disk">
        <name>disk2</name>
        <source>
          <device path='/dev/sdl'/>
<format type='dos'/>
        </source>
        <target>
          <path>/dev</path>
        </target>
      </pool>

# virsh pool-define disk-pool.xml
Pool disk2 defined from disk-pool.xml

[root@rhel7_test yy]# virsh pool-build disk2
Pool disk2 built

[root@rhel7_test yy]# virsh pool-start disk2
Pool disk2 started

2. create 3 primary partitions and 1 extended partition
[root@rhel7_test yy]# for i in {1..3}; do virsh vol-create-as disk2 sdl$i 2G; done
Vol sdl1 created

Vol sdl2 created

Vol sdl3 created

[root@rhel7_test yy]# virsh vol-create-as disk2 sdl4 30G --format extended
Vol sdl4 created

[root@rhel7_test yy]# parted /dev/sdl
GNU Parted 3.1
Using /dev/sdl
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdl: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  2149MB  2148MB  primary
 2      2149MB  4297MB  2149MB  primary
 3      4297MB  6446MB  2149MB  primary
 4      6446MB  38.7GB  32.2GB  extended               lba

(parted) quit                                                            

3. do vol-wipe on extended partition

[root@rhel7_test yy]# virsh vol-wipe sdl4 disk2
Vol sdl4 wiped

4. check partition table via parted
[root@rhel7_test yy]# parted /dev/sdl
GNU Parted 3.1
Using /dev/sdl
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Error: Invalid partition table on /dev/sdl -- wrong signature 0.
Ignore/Cancel? cancel                                                    
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdl: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

5. create a logical partition
# virsh vol-create-as disk2 sdl5 2G
error: Failed to create vol sdl5
error: internal error: Child process (/usr/sbin/parted /dev/sdl mkpart --script 'logical ext2' 6445629440B 8594128895B) unexpected exit status 1: Error: Invalid partition table on /dev/sdl -- wrong signature 0.

Actual results
Disk partition table is broken after wiping an extended partition
so that disk pool does not work

Expected results
If wiping extended partition is supported, do not crash disk partition table
If NOT, provide an error message.


Additional info:

Comment 2 John Ferlan 2015-06-09 22:29:05 UTC
The following patch has been posted upstream

http://www.redhat.com/archives/libvir-list/2015-June/msg00389.html

Comment 3 John Ferlan 2015-06-15 11:50:20 UTC
Patch pushed upstream:

commit 84020f9a398f739ee2cf7588a7cf3b4b0c077984
Author: John Ferlan <jferlan>
Date:   Tue Jun 9 18:15:39 2015 -0400

    storage: Disallow wiping an extended disk partition
      
    Check if the disk partition to be wiped is the extended partition, if
    so then disallow it. Do this via changing the wipeVol backend to check
    the volume before passing to the common virStorageBackendVolWipeLocal


$ git describe 84020f9a398f739ee2cf7588a7cf3b4b0c077984
v1.2.16-151-g84020f9
$

Comment 5 yisun 2015-07-16 08:15:49 UTC
Verified and passed with:
libvirt-1.2.17-2.el7.x86_64
qemu-kvm-rhev-2.3.0-9.el7.x86_64
kernel-3.10.0-290.el7.x86_64

Steps:
1. prepare a disk sdb and make 3 partitions, sdb1 (primary) sdb2 (extended) sdb3 (logical) as follow:

# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): print

Disk /dev/sdb: 8004 MB, 8004304896 bytes, 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1e3d54c6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2099199     1048576   83  Linux
/dev/sdb2         2099200     6293503     2097152    5  Extended
/dev/sdb5         2101248     2121727       10240   83  Linux

2. create a disk pool
# cat pool.xml 
<pool type="disk">
        <name>usbdisk</name>
        <source>
          <device path='/dev/sdb'/>
          <format type='dos'/>
        </source>
        <target>
          <path>/dev</path>
        </target>
</pool>


# virsh pool-create pool.xml 
Pool usbdisk created from pool.xml

# virsh vol-list usbdisk --details
 Name  Path       Type    Capacity  Allocation
-----------------------------------------------
 sdb1  /dev/sdb1  block   1.00 GiB    1.00 GiB
 sdb2  /dev/sdb2  block   2.00 GiB    2.00 GiB
 sdb5  /dev/sdb5  block  10.00 MiB   10.00 MiB

3. vol-wipe the primary, logical and extended partition to see if it works as expected.
# virsh vol-wipe sdb5 usbdisk
Vol sdb5 wiped   <=== logical 

# virsh vol-wipe sdb1 usbdisk
Vol sdb1 wiped    <=== primary 

# virsh vol-wipe sdb2 usbdisk
error: Failed to wipe vol sdb2
error: this function is not supported by the connection driver: cannot wipe extended partition '/dev/sdb2'   <=== extended, failed as expected. 

4. check the partition table of /dev/sdb
# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): print

Disk /dev/sdb: 8004 MB, 8004304896 bytes, 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1e3d54c6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2099199     1048576   83  Linux
/dev/sdb2         2099200     6293503     2097152    5  Extended
/dev/sdb5         2101248     2121727       10240   83  Linux

Comment 7 errata-xmlrpc 2015-11-19 06:39:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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