Bug 182553

Summary: fdisk -l inside xen guest shows no disks
Product: [Fedora] Fedora Reporter: darren
Component: xenAssignee: Rik van Riel <riel>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: bstein, katzj, kzak, sct
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-23 17:17:36 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description darren 2006-02-23 03:58:39 EST
Description of problem:

"fdisk -l" doesn't see any disks inside a xen guest, but "fdisk
<name_of_disk_device>" does allow you to edit it

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

How reproducible:
Every time

Steps to Reproduce:
[root@xentest2 ~]# fdisk -l
[root@xentest2 ~]#

[root@xentest2 ~]# fdisk /dev/xvda
Command (m for help): p
Disk /dev/xvda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         456     3662788+  83  Linux
/dev/xvda2             457         521      522112+  82  Linux swap / Solaris

Actual results:
no disks seen on fdisk -l

Expected results:
disk listing on fdisk -l

Additional info:
Comment 1 Karel Zak 2006-02-23 07:36:49 EST
The problem is that fdisk is unable to detect "full disk" by HDIO_GETGEO -- the
ioctl(HDIO_GETGEO) call returns -1 on /dev/xvda. It seems like kernel bug.

The "fdisk /dev/xvda" command works, because it reads information from MBR.

And the parted command works, because it uses more simple heuristic base on
non-digit at end of the device name (xvda = disk, xvda1 = partition).

Maybe I can add to fdisk workaround that will use the "digit heriustic" for
devices where ioctl() returns error.

IMHO problem should be fixed in the kernel too.
Comment 2 Karel Zak 2006-02-23 08:21:52 EST
Maybe it makes sense that virtual block device hasn't any geomery ;-) 


        case HDIO_GETGEO:
                /* return ENOSYS to use defaults */
                return -ENOSYS;

It's seems like really old issue:

I'm going to fix fdisk...
Comment 3 Karel Zak 2006-02-23 08:57:34 EST
# ./fdisk  -l

Disk /dev/xvda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1         261     2096451   83  Linux

The patch will be available in util-linux-2.13-0.16.