Bug 870501 - rootfs-resize causes loss of root filesystem
Summary: rootfs-resize causes loss of root filesystem
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: rootfs-resize
Version: 18
Hardware: arm
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Chris Tyler
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-26 16:52 UTC by Quentin Armitage
Modified: 2013-01-24 22:32 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-24 22:32:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
A patch that appears to resolve the reported problem (639 bytes, patch)
2012-10-26 16:52 UTC, Quentin Armitage
no flags Details | Diff

Description Quentin Armitage 2012-10-26 16:52:15 UTC
Created attachment 633991 [details]
A patch that appears to resolve the reported problem

Description of problem:
After resizing the root filesystem partition and rebooting, prior to the resize of the filesystem itself, there is no filesystem in the second partition of the card. 

Version-Release number of selected component (if applicable):
rootfs-resize-0.9-1.fc18.noarch

How reproducible:
Always

Steps to Reproduce:
1.Copy the downloaded boot/rootfs image to the SDIO card
2.Boot the system
3.Wait for it to come up
4.yum update all available packages (including rootfs-resize)
5.Reboot the system and then let it reboot itself following the resize of the rootfs partition
  
Actual results:
There is no filesystem found on /dev/sdb2

Expected results:
A root filesystem is on /dev/sdb2, as it was prior to the resize of the partition.

Additional info:
I have installed the latest nightly snapshot that I can find (17 September) of Fedora 18 on one of my Dreamplugs.

[I did notice on the initial boot of the nightly snapshot that the rootfs-resize service failed due to /usr/sbin/rootfs-resize being missing (it appears that it is in /usr/bin instead), so as a consequence the system was running without a resized rootfs. That nightly snapshot has rootfs-resize version 0.4-1.]

I then did a yum update followed by a reboot. Part way through rebooting, the system shut itself down and rebooted. After this, the system failed to start, reporting that it could not find the rootfs. I went through this whole process (starting from the nightly snapshot) 3 more times, always with exactly the same result.

Finally, I did the yum update but excluded the rootfs-resize package from the update. This time the system restarted successfully after the yum update.

It appears that the problem is in rootfs-resize's use of fdisk, when rootfs-resize resizes the partition.

Manually doing the same as the rootfs-resize script, I get the following:

Running fdisk /dev/sdb:

Command (m for help): p
> 
> Disk /dev/sdb: 4102 MB, 4102029312 bytes, 8011776 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 identifier: 0x00000000
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sdb1   *          63     1044224      522081    c  W95 FAT32 (LBA)
> /dev/sdb2         1044225     8011775     3483775+  83  Linux
> 
> (this has already been resized, so ignore the end block for sdb2).
I now delete the second partition, and recreate it:

Command (m for help): d
> Partition number (1-4): 2
> Partition 2 is deleted
> 
> Command (m for help): n
> Partition type:
>    p   primary (1 primary, 0 extended, 3 free)
>    e   extended
> Select (default p): p
> Partition number (1-4, default 2): 2
> First sector (1044225-8011775, default 1044480): 
> Using default value 1044480
> Last sector, +sectors or +size{K,M,G} (1044480-8011775, default 8011775): 
> Using default value 8011775
> Partition 2 of type Linux and of size 3.3 GiB is set

The problem here is that although the first sector can be from 1044225 upwards, the default is 1044480, which is what the rootfs-resize script selects. Since the new partition is created starting at a different sector from the original partition, no filesystem can be found in that partition.

Instead of letting the rootfs-resize script do the resize, I have done it manually, entering 1044225 as the start sector, and that works fine.

Does the rootfs-resize script need to be modified to read the start sector of the partition before it deletes it, and force the new partition to have the same start sector? I have attached a patch to the rootfs-resize script that does that.

Comment 1 Fedora Update System 2013-01-15 02:53:02 UTC
rootfs-resize-2.0-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/rootfs-resize-2.0-1.fc18

Comment 2 Fedora Update System 2013-01-16 19:43:34 UTC
Package rootfs-resize-2.0-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rootfs-resize-2.0-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-0872/rootfs-resize-2.0-1.fc18
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2013-01-24 22:32:27 UTC
rootfs-resize-2.0-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


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