Bug 837111

Summary: The resize fails to run if the device does not have exactly two partitions.
Product: [Fedora] Fedora Reporter: D. Marlin <dmarlin>
Component: rootfs-resizeAssignee: Chris Tyler <ctyler.fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: blc, ctyler.fedora, jcm, pbrobinson
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: arm   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-25 13:43:03 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 245418    
Attachments:
Description Flags
Make rootfs-resize work for number of partitions not equal 2. none

Description D. Marlin 2012-07-02 16:06:23 EDT
Description of problem:
When installing F17 on a Trim Slice, the shipped version of U-Boot requires an ext3 or VFAT /boot partition (or wherever the U-Boot images are located), but F17 wants ext4 for the / (root) partition.  If a swap partition is also added, we have three partitions, and rootfs-resize refuses to run.

Version-Release number of selected component (if applicable):
  rootfs-resize-0.3-3.fc17

How reproducible:
  always.

Steps to Reproduce:
1.  create an F17 image with the following partitions:
    - /boot  ext3
    - /      ext4
    - swap   swap
2.  install rootfs-resize and ensure /.rootfs-resize exists
3.  reboot
  
Actual results:
  Partition count on /dev/sda is not 2, exiting.

Expected results:
  The root (/) partition on /dev/sda is resized

Additional info:
  Please enable rootfs-resize to run on devices with an arbitrary number of partitions.
Comment 1 Chris Tyler 2012-07-05 03:00:32 EDT
The script only performs resizing -- not partition moves. In the scenario that you've outlined, I would assume that the swap partition immediately follows the root filesystem, and therefore a move would be required. The design assumption was that an experienced user who is creating swap partitions would be easily able to resize the root partition first.

Moving a swap (or other) partition while the system is live is probably not possible, and would be very slow.

As an alternative, we're experimenting with a firstboot module which asks the user for a swap space size, which rootfs-resize picks up and creates as a swap file on the rootfs after resizing (instead of a swap partition).
Comment 2 D. Marlin 2012-07-05 11:09:08 EDT
I understand the issue, but the partition layout on the rootfs I'm using is:

  /dev/sda1   /boot
  /dev/sda2   swap
  /dev/sda3   /

so there is nothing after '/', and a resize is all that is required.  I have performed the resize manually to verify this.

What about changing the check in rootfs-resize to ensure the '/' partition is on the the last partition on the device, rather than ensuring the number of partitions is exactly '2'?  That way it would work for any number of partitions, as long as the root parition ('/') was on the last the last partition on the device.
Comment 3 Brendan Conoboy 2012-07-07 00:21:22 EDT
Chris, in light of David's partition scheme please reconsider this restriction.  There is almost no gain whatsoever in the arbitrary limitation of 2 partitions.  It's just as likely that there will be 1 partition (Trimslices can boot to an ext3 /), 3 partitions (David's example), 4 partitions (Add a /home directory) and so forth.  Working when the partition count is 2 and not otherwise is completely arbitrary.
Comment 4 Chris Tyler 2012-07-07 00:44:43 EDT
I agree, resize-if-last makes sense - will implement.
Comment 5 D. Marlin 2012-10-14 10:18:07 EDT
Created attachment 626991 [details]
Make rootfs-resize work for number of partitions not equal 2.
Comment 6 D. Marlin 2012-10-14 10:18:56 EDT
I have a fix for rootfs-resize that works on the Panda and Trim Slice devices with more than two partitions.  This has been tested on Panda, Trim Slice, and and Raspberry Pi, and they all worked as expected.

The have uploaded the patch to this BZ and I have put a copy of my git tree on fedorapeople.org:

   git://fedorapeople.org/~dmarlin/rootfs-resize.git
Comment 7 Fedora Update System 2012-10-24 17:34:16 EDT
rootfs-resize-0.9-2.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/rootfs-resize-0.9-2.fc18