Bug 598024

Summary: fdisk -l produces no output for RHEL 3/4 virtio-blk devices
Product: Red Hat Enterprise Linux 4 Reporter: Ying Cui <ycui>
Component: kernelAssignee: Red Hat Kernel Manager <kernel-mgr>
Status: CLOSED WONTFIX QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: low    
Version: 4.8CC: bcao, bugzilla, d.bz-redhat, jbustos, jwest, lihuang, llim, mbooth, mkenneth, moli, mshao, raphael.lechner, rdassen, rjones, rwu, sputhenp
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-14 20:30:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
add convert.log
none
dmesg none

Description Ying Cui 2010-05-31 09:31:15 UTC
Description of problem:
After RHEL4.8 32/64 guest was converted to KVM, the fdisk -l command can not list the partition info.

No matter what the source hypervisor is it, if the guest OS is RHEL4.8 32/64, the problem can be reproduced always. 

Version-Release number of selected component (if applicable):
virt-v2v-0.6.0-2.el5
libguestfs-1.2.7-1.el5.3

OS:Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
kernel:2.6.9-89.ELsmp

How reproducible:

Steps to Reproduce:
1. run virt-v2v to convert RHEL4.8 64 guest to kvm successfully.
   e.g.
 # virt-v2v -f /root/virt-v2v.conf -i libvirtxml -o rhev -osd 10.66.90.115:/vol/v2vwulinglu/wulingluv2v/export /tmp/rhel4u8-64b-hv-raw-intel.img.xml
2. login RHEV-M
3. Navigate to 'Storage'-->'VM Import'
4. Select this VM that is converted above.
5. Import this VM successfully.
6. Run this VM 
7. Console to login this VM
8. run the command as the following:
   # fdisk -l
  
Actual results:
  step8: Before converted, the fdisk -l can list partition info, 
e.g.
[root@dhcp-66-70-186 ~]# fdisk -l

Disk /dev/hda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1305    10377990   8e  Linux LVM

     After converted, the fdisk -l can not list partition info. 
e.g.
[root@dhcp-66-70-19 ~]# fdisk -l
[root@dhcp-66-70-19 ~]# fdisk -l

Expected results:
  step8: After converted, the fdisk -l can list partition info.


Additional info:

Comment 1 Ying Cui 2010-05-31 10:34:34 UTC
Created attachment 418248 [details]
add convert.log

Comment 2 Richard W.M. Jones 2010-06-01 10:31:46 UTC
(In reply to comment #0)
>      After converted, the fdisk -l can not list partition info. 
> e.g.
> [root@dhcp-66-70-19 ~]# fdisk -l
> [root@dhcp-66-70-19 ~]# fdisk -l
> 

Not even an error message?

Does the fdisk command return an error status?

Can you attach 'dmesg' (ie. boot messages) from the guest?

Comment 3 Rita Wu 2010-06-01 10:50:37 UTC
Created attachment 418580 [details]
dmesg



>Not even an error message?
>Does the fdisk command return an error status?
no error status, only no output:
#fdisk -l
#

>Can you attach 'dmesg' (ie. boot messages) from the guest?    
Attached.

Comment 4 Richard W.M. Jones 2010-06-01 15:33:33 UTC
My 'fdisk' command (on Fedora) gets its idea of all the block
devices it should look at by examining /proc/partitions.

The 'dmesg' output looks fine -- it sees the partitions at boot,
albeit with virtio names (ie. vda: vda1 vda2).

Comment 5 Ying Cui 2010-06-02 09:12:07 UTC
Hi Richard,
   I have checked the /proc/partitions content on RHEL 4.8 32 guest after converted.

# cat /proc/partitions
major minor  #blocks  name

 253     0   10485760 vda
 253     1     104391 vda1
 253     2   10377990 vda2
 252     0    9273344 dm-0
 252     1    1081344 dm-1

Thanks 
 Ying

Comment 6 Rita Wu 2010-06-05 10:05:22 UTC
FYI, the output when converting rhel4u8 guest

virt-v2v -f /etc/virt-v2v.conf -o rhev -osd 10.66.xx.xxx:/vol/export ESX35-RHEL4U8-i386-smp
unknown filesystem /dev/hda
unknown filesystem /dev/fd0
virt-v2v: ESX35-RHEL4U8-i386-smp_ESX35-RHEL4U8-i386-smp configured with virtio drivers

Comment 7 Matthew Booth 2010-06-30 13:33:47 UTC
I can't think of anything virt-v2v does which might affect this behaviour. Does this work for a RHEL4.8 32/64 KVM guest with virtio drivers which was installed normally?

Comment 8 Richard W.M. Jones 2010-07-01 13:28:17 UTC
My second guess would be this is something to do with
disk CHS geometry.  Virtio uses a different disk geometry
from the ones detected by the IDE and SCSI drivers in Linux.
With a recent version of qemu, it gets passed up using a
virtio extension.  With older qemu / older virtio-blk it was
faked/fixed.  See:

http://lxr.linux.no/linux+v2.6.34/drivers/block/virtio_blk.c#L209

CHS geometry hasn't really mattered since Bill Gates was still
a programmer, but it can still break programs reading MBR
partition tables.

My third guess would be the first sector has somehow got
corrupted, but I think it's unlikely the guest would boot at
all if that was the case.

Comment 9 Richard W.M. Jones 2010-07-01 13:31:03 UTC
(In reply to comment #8)
[...]

I was going to add that you can easily find out the disk geometry,
either by looking at dmesg or by doing this inside the guest:

# sfdisk -g
/dev/sda: 121601 cylinders, 255 heads, 63 sectors/track
# sfdisk -G
/dev/sda: 121601 cylinders, 255 heads, 63 sectors/track

The '-g' version tells you what the kernel thinks is the geometry.

The '-G' version tells you the geometry from reading the first
sector (ie. from the MBR).

In general the numbers should agree, but it's not necessarily
a problem if they are different.

Comment 10 Rita Wu 2010-07-02 08:22:04 UTC
(In reply to comment #7)
> I can't think of anything virt-v2v does which might affect this behaviour. Does
> this work for a RHEL4.8 32/64 KVM guest with virtio drivers which was installed
> normally?    

Hi Matt,

"fdisk -l" doesn't give output for RHEL4.8 32/64 KVM guest with virtio drivers and RHEL4.8 32/64 KVM guest without virtio drivers before conversion.

Comment 11 Matthew Booth 2010-07-02 09:51:28 UTC
(In reply to comment #10)
> Hi Matt,
> 
> "fdisk -l" doesn't give output for RHEL4.8 32/64 KVM guest with virtio drivers
> and RHEL4.8 32/64 KVM guest without virtio drivers before conversion.    

I've updated the component for this bug to util-linux in RHEL 4. Sounds odd.

Comment 12 Rita Wu 2010-07-02 10:02:26 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Hi Matt,
> > 
> > "fdisk -l" doesn't give output for RHEL4.8 32/64 KVM guest with virtio drivers
> > and RHEL4.8 32/64 KVM guest without virtio drivers before conversion.    
> 
> I've updated the component for this bug to util-linux in RHEL 4. Sounds odd.    

Matt,

I'm so sorry. I guess I made a typo there. I did want to say:*After* conversion

"fdisk -l" doesn't give output for RHEL4.8 32/64 KVM guest with virtio drivers
and RHEL4.8 32/64 KVM guest without virtio drivers *After* conversion.

Comment 13 Richard W.M. Jones 2010-07-02 10:15:11 UTC
Linglu, could you do:

# dd if=/dev/vda of=/tmp/sector0 bs=512 count=1

and attach that to the bug or send it to me?

Also I'd like to see the output of:

# sfdisk -g /dev/vda
# sfdisk -G /dev/vda

Most helpful would be after conversion, but if you have the time
to do the same (sector & sfdisk of /dev/hda) before conversion
too that would also be helpful.

Comment 14 Matthew Booth 2010-07-02 10:23:46 UTC
Moving this back to virt-v2v after discussion with the reporter, as it's clear that the behaviour is changing during conversion.

Comment 15 Rita Wu 2010-07-02 11:11:48 UTC
My BAD.

RHEL4u8-32 KVM guest with virtio driver before conversion: no output after
"fdisk -l"
KVM-rhel4u8-32-virtio.xml
**********************************
<devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' cache='none'/>
      <source file='/xx/xx.raw'/>
      <target dev='hda' bus='virtio'/>
    </disk>
*************************************

# lspci |grep -i virtio
00:04.0 SCSI storage controller: Qumranet, Inc. Virtio block device
00:05.0 RAM memory: Qumranet, Inc. Virtio memory balloon
# uname -a
Linux virtlab-66-84-89.englab.nay.redhat.com 2.6.9-89.EL #1 Mon Apr 20 10:23:08
EDT 2009 i686 i686 i386 GNU/Linux
# cat /etc/redhat-release 
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
# fdisk -l
# 


# dd if=/dev/vda of=/tmp/sector0 bs=512 count=1
1+0 records in
1+0 records out
# sfdisk -g /dev/vda
/dev/vda: 41610 cylinders, 16 heads, 63 sectors/track


================================================================================
RHEL4u8-32 KVM guest with IDE driver before conversion: has output after "fdisk
-l"

# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
(rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL-8139/8139C/8139C+ (rev 20)
00:04.0 RAM memory: Qumranet, Inc. Virtio memory balloon

# uname -a
Linux virtlab-66-84-89.englab.nay.redhat.com 2.6.9-89.EL #1 Mon Apr 20 10:23:08
EDT 2009 i686 i686 i386 GNU/Linux
[root@virtlab-66-84-89 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
# fdisk -l

Disk /dev/hda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        2610    20860402+  8e  Linux LVM

Comment 16 RHEL Program Management 2010-09-05 07:57:27 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 17 Richard W.M. Jones 2010-09-05 08:35:32 UTC
Reading back over the comments it seems like we still have no idea
what causes this, or am I missing something?

Comment 20 Matthew Booth 2010-09-06 09:20:42 UTC
Closed as per comments 18 and 19.

Comment 21 Richard W.M. Jones 2010-09-06 11:04:59 UTC
Closed?  Or reassigned to the relevant kernel component?

Comment 22 Rita Wu 2010-09-06 12:28:36 UTC
I prefer the latter.

Comment 23 Richard W.M. Jones 2010-09-06 12:53:54 UTC
Reopening and assigning to RHEL 4 kernel component.

Please see comment 18 and comment 19 for details.

Comment 24 Mike Cao 2010-09-28 08:20:38 UTC
Start RHEL3.9 guest with virtio image also hit the issue.
eg -drive file=RHEL3u9_virtio.raw  ..-device virtio-blk-pci...

Comment 25 Jason 2010-10-06 14:11:17 UTC
I can confirm I have this problem on rhel3.9 as well.

I expect to see /dev/vda output in fdisk, and even though I can interface using 'fdisk /dev/vda' directly, 'fdisk -l' does not give output about vda.

# fdisk -l                                                                                                                                                                                                             

Disk /dev/hda: 20.9 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        13    104391   83  Linux
/dev/hda2            14       268   2048287+  82  Linux swap
/dev/hda3           269      2549  18322132+  8e  Linux LVM


# cat /proc/partitions                                                                                                                                                                                                 
major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

 254     0    1024000 vda 25 72 284 120 15715 470063 3690498 38050100 0 83790 38050220
 254     1    1023592 vda1 18 3 132 110 15714 470063 3690496 38050070 0 83750 38050180
  58     0   10240000 lvma 0 0 0 0 0 0 0 0 0 0 0
  58     1    1572864 lvmb 0 0 0 0 0 0 0 0 0 0 0
  58     2    2048000 lvmc 0 0 0 0 0 0 0 0 0 0 0
   3     0   20480000 hda 4827 11456 121518 8250 7266 7962 122058 370330 0 91350 378590
   3     1     104391 hda1 49 599 1296 20 14 11 50 630 0 580 650
   3     2    2048287 hda2 18 68 232 10 0 0 0 0 0 10 10
   3     3   18322132 hda3 4721 10600 119534 8140 7252 7951 122008 369700 0 91290 377850

# uname -a                                                                                                                                                                                                             
Linux rhel3test 2.4.21-63.EL #1 Wed Oct 28 23:18:31 EDT 2009 i686 i686 i386 GNU/Linux

# rpm -qi kmod-virtio                                                                                                                                                                                                  
Name        : kmod-virtio                  Relocations: (not relocatable)
Version     : 0.1                               Vendor: Red Hat, Inc.
Release     : 17.el3                        Build Date: Tue Nov  3 02:00:00 2009
Install Date: Wed Oct  6 09:53:26 2010      Build Host: hs20-bc2-3.build.redhat.com
Group       : System Environment/Kernel     Source RPM: virtio-0.1-17.el3.src.rpm
Size        : 46414                            License: GPL
Signature   : DSA/SHA1, Thu Mar 18 02:15:52 2010, Key ID 219180cddb42a60e
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary     : virtio kernel module(s)
Description :
This package provides the virtio kernel modules built for the Linux
kernel 2.4.21-63.EL for the i686 family of processors.

Comment 26 Didier 2011-02-10 10:56:51 UTC
Additional info :

Clean minimal domU installation of a VirtIO RHEL4.8 guest on a RHEL6.0 dom0 host.
Installation succeeds.

After initial reboot :
# fdisk -l
(nothing detected)
# fdisk -l /dev/vda
(detected)
  Disk /dev/vda: ...
    /dev/vda1 ...
    /dev/vda2 ...
# cat /proc/partitions
(detected)

# grub-install /dev/vda
expr: non-numeric argument
/dev/vda1 does not have any corresponding BIOS drive.


This last grub error prevented me from smoothly converting a physical to virtual machine (bug 479760 & bug 484986 ?).


Package versions (RHEL4.8):
  kernel-2.6.9-89.35.1.ELsmp
  grub-0.95-3.8
  util-linux-2.12a-24.el4_8.1

Comment 27 Jesus bustos 2011-05-02 12:57:02 UTC
Hi there,

I have also reproduced the issue  here is the set-up 

RHEL 4.8 fresh install 
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.9-89.EL #1 Mon Apr 20 10:22:29 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

1. From a fresh install fdisk shows 2 partitions on hda 

[root@localhost ~]# fdisk -l

Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM


2. I've Added a new virtio storage disk from the virt-manager GUI and rebooted.

3. The virtual disc exists  /dev/vda  

 [root@localhost ~]# ll /dev/vda 
brw-------  1 root root 252, 0 May  2 12:31 /dev/vda


4.But fdisk -l shows only hda* partitions 

 [root@localhost ~]# fdisk -l

Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM

5. I can see /dev/vda in /proc/partitions 

[root@localhost ~]# cat /proc/partitions 
major minor  #blocks  name

   3     0    8388608 hda
   3     1     104391 hda1
   3     2    8281507 hda2
 253     0    7241728 dm-0
 253     1    1015808 dm-1
 252     0    8388608 vda

Kind regards

Jesus Bustos.

Comment 28 Jesus bustos 2011-05-02 12:59:59 UTC
Also, I created a partition on /dev/vda

root@localhost ~]# fdisk -l /dev/vda 

Disk /dev/vda: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1               1       16644     8388544+  83  Linux


But fdisk -l shows the same 

[root@localhost ~]# fdisk -l 

Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2              14        1044     8281507+  8e  Linux LVM