Bug 520627 - unhandled exception when trying to resize a partition
Summary: unhandled exception when trying to resize a partition
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: anaconda
Version: rawhide
Hardware: ia32e
OS: All
low
low
Target Milestone: ---
Assignee: David Cantrell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-09-01 13:51 UTC by IBM Bug Proxy
Modified: 2009-10-06 06:21 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-02 20:19:23 UTC


Attachments (Terms of Use)
report saved through gui (98.56 KB, text/plain)
2009-09-01 13:51 UTC, IBM Bug Proxy
no flags Details
tmp-anaconda.tar (240.00 KB, application/octet-stream)
2009-09-01 13:51 UTC, IBM Bug Proxy
no flags Details


Links
System ID Priority Status Summary Last Updated
IBM Linux Technology Center 55873 None None None Never

Description IBM Bug Proxy 2009-09-01 13:51:08 UTC
The machine has one disk with 3 partitions and entire disk space allotted to these partitions. 
During F12 installation , I chose 'create custom layout' option and went ahead to resize one of the
partition to stretch beyond it's current allocated size.  Since the disk is full this action errors
out. But a window pops up informing that an exception has not been handled and it gives an option to
save the report, debug it or exit. I saved the report and the installer exits after this.  We cannot
continue with resizing/partitioning  the disk again. System needs to be restarted for installation.

kernel version 2.6.31-0.125.4.2.rc5.git2.fc12  , F12 Alpha

anaconda 12.15 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.6/site-packages/parted/disk.py", line 254, in setPartitionGeometry
    start, end)
  File "/usr/lib/python2.6/site-packages/parted/decorators.py", line 30, in localeC
    ret = fn(*args, **kwds)
  File "<string>", line 2, in setPartitionGeometry
  File "/usr/lib/anaconda/storage/devices.py", line 1061, in _setTargetSize
    start=geometry.start, end=geometry.end)
  File "/usr/lib/anaconda/storage/devices.py", line 486, in <lambda>
    lambda s, v: s._setTargetSize(v),
  File "/usr/lib/anaconda/storage/deviceaction.py", line 239, in __init__
    self.device.targetSize = newsize
  File "/usr/lib/anaconda/iw/partition_dialog_gui.py", line 293, in run
    actions.append(ActionResizeDevice(request, size))
  File "/usr/lib/anaconda/iw/partition_gui.py", line 1121, in editPartition
    actions = parteditor.run()
  File "/usr/lib/anaconda/iw/partition_gui.py", line 1082, in editCB
    self.editPartition(device)
PartitionException: Can't have overlapping partitions.



attached files:
report saved through gui
tar'ed files from /tmp/

Comment 1 IBM Bug Proxy 2009-09-01 13:51:17 UTC
Created attachment 359395 [details]
report saved through gui

Comment 2 IBM Bug Proxy 2009-09-01 13:51:25 UTC
Created attachment 359396 [details]
tmp-anaconda.tar

Comment 3 David Cantrell 2009-10-02 01:10:25 UTC
(In reply to comment #0)
> The machine has one disk with 3 partitions and entire disk space allotted to
> these partitions. 
> During F12 installation , I chose 'create custom layout' option and went ahead
> to resize one of the
> partition to stretch beyond it's current allocated size.  Since the disk is
> full this action errors
> out. But a window pops up informing that an exception has not been handled and
> it gives an option to
> save the report, debug it or exit. I saved the report and the installer exits
> after this.  We cannot
> continue with resizing/partitioning  the disk again. System needs to be
> restarted for installation.

What exactly were the 3 partitions and filesystems?  Primary, any extended?  ext2, ext3, ext4, ntfs, ... ?

Comment 4 David Cantrell 2009-10-02 02:03:21 UTC
Nevermind, I found the fdisk_l_output file in the tar file attached to the bug:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xea86ea86

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1290    10361893+   7  HPFS/NTFS
/dev/sda2            1291        4611    26675932+  83  Linux
/dev/sda3            4612        4865     2040255   82  Linux swap / Solaris

Comment 5 David Cantrell 2009-10-02 02:04:55 UTC
I see what's happening here.  You can resize an NTFS volume and take it to one MB beyond it's maximum size.  For ext2/3/4, that doesn't happen.  We do restrict you to the max size of the volume when resizing, so really you can only shrink a volume, but our max size calculation for NTFS appears to be off by one.

Comment 6 David Cantrell 2009-10-02 02:13:19 UTC
The problem is in the _getExistingSize() method in storage/formats/fs.py.  When we compute the size of an existing filesystem, the result is rounded up.  For the example I had locally, the NTFS filesystem was computed at 153770.57 MB, which was rounded up to 153771.  When I checked Resize and expanded it by one MB, I got the traceback you reported.

I've created the following patch to address the issue:

diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index a78ecb2..c549942 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -27,6 +27,7 @@
         - migration
         - bug 472127: allow creation of tmpfs filesystems (/tmp, /var/tmp, &c)
 """
+import math
 import os
 import tempfile
 import isys
@@ -262,7 +263,7 @@ class FS(DeviceFormat):
                     size *= value
 
                 # report current size as megabytes
-                size = size / 1024.0 / 1024.0
+                size = math.floor(size / 1024.0 / 1024.0)
             except Exception as e:
                 log.error("failed to obtain size of filesystem on %s: %s"
                           % (self.device, e))

Comment 7 David Cantrell 2009-10-02 20:19:23 UTC
This will be fixed in either anaconda-12.33-1 or anaconda-13.0-1, whichever comes next.

Comment 8 IBM Bug Proxy 2009-10-06 06:21:02 UTC
------- Comment From  2009-10-06 02:16 EDT-------
Thanks Dave, I will verify this issue in the next beta and update the results in this bug. thanks


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