GNOME Bugzilla – Bug 706604
Failure to properly grow or shrink linux-swap when resizing
Last modified: 2013-09-18 16:47:46 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.
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).
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
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
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
The patch to address this report has been included in GParted 0.16.2 released on September 18, 2013.