After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706604 - Failure to properly grow or shrink linux-swap when resizing
Failure to properly grow or shrink linux-swap when resizing
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2013-08-22 18:20 UTC by Curtis Gedak
Modified: 2013-09-18 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix regression - linux-swap grow and shrink broken (2.17 KB, patch)
2013-08-22 18:51 UTC, Curtis Gedak
none Details | Review
Patch to fix regression - linux-swap grow and shrink broken (v2) (2.23 KB, patch)
2013-08-24 09:32 UTC, Mike Fleetwood
none Details | Review

Description Curtis Gedak 2013-08-22 18:20:30 UTC
GParted fails to correctly resize (grow or shrink) linux-swap file
systems inside a partition.

The following steps demonstrate the problem when growing a linux-swap
partition:

1)  Note your current swap usage.
       # free
                    total       used       free
       Swap:     16777212          0   16777212

2)  With GParted create a 1024 MiB swap partition (e.g., /dev/sdd2).

3)  Enable the new swap partition.
       # swapon /dev/sdd2

4)  Note the increase in swap size (+1,048,572).
       # free
                    total       used       free
      Swap:     17825784          0   17825784

5)  Disable the new swap partition.
       # swapoff /dev/sdd2

6)  Note current swap usage.
       # free
                    total       used       free
       Swap:     16777212          0   16777212

7)  With GParted grow the swap partition to 2048 MiB.

     *** NOTE ***
     In the GParted details, only the partition is grown.  The swap
     file system remains the same.

8)  Enable the swap partition.
       # swapon /dev/sdd2

9)  Note current swap usage (+1,048,572 but should be twice this amount).
       # free
                    total       used       free
       Swap:     17825784          0   17825784

     *** NOTE ***
     Only the originally swap format of 1024 MiB has been added.  The
     extra 1024 MiB is not used.

I am working on a fix for this problem.
Comment 1 Curtis Gedak 2013-08-22 18:51:09 UTC
Created attachment 252782 [details] [review]
Patch to fix regression - linux-swap grow and shrink broken

This patch addresses a logic error introduced in GParted 0.14.1 in the following commit:

Prevent file system grow when partition grow fails (#686668)
https://git.gnome.org/browse/gparted/commit/?id=fd963289201532f2216029ffd1e0b

With this patch I have successfully tested growing and shrinking a linux-swap partition.

Also successfully tested is growing and shrinking a non-linux-swap partition (e.g., ext2).
Comment 2 Mike Fleetwood 2013-08-24 09:32:56 UTC
Created attachment 253006 [details] [review]
Patch to fix regression - linux-swap grow and shrink broken (v2)

Hi Curtis,

Tested the patch and it works.  Hope you don't mind I have made a few
cosmetic changes to the commit message.

1) Removed the prefix URL for the referenced commit.
   Gitk on the desktop and GNOME's cgit on the web automatically convert
   things which look like commit messages into clickable links without
   the prefixing URL to the public repository.
   (I reserve including the full URL if I ever refer to commits in other
   repositories).

2) Added "Closed Bug #..." footer.

3) Re-line wrapped the text to column 72.

If you don't object I'll commit this by Sunday morning.

Thanks,
Mike
Comment 3 Curtis Gedak 2013-08-24 14:48:03 UTC
Hi Mike,

Thanks for the review and making the patch better.  I am in favour of the enhancements you made to the patch.  Please feel free to proceed with the commit.

Curtis
Comment 4 Mike Fleetwood 2013-08-24 15:23:57 UTC
Thank Curtis,

Git commit applied.  Can be seen here:

Fix regression - linux-swap resize broken (#706604)
https://git.gnome.org/browse/gparted/commit/?id=51845b7799b637b83d62ca6c4b89348e914d786a
Comment 5 Curtis Gedak 2013-09-18 16:47:46 UTC
The patch to address this report has been included in GParted 0.16.2 released on September 18, 2013.