1

Topic: Data corruption after resizing ext4 partitions.

Today I wanted to resize some partitions to redistribute better the available space. The partitions were ext4 and I used gparted live 0.4.6 (the last stable according to the website)

Gparted seemed to make all the chages without errors, the system booted fine. When it reached the login manager (KDM) I switched to a virtual terminal and restarted forcing a fsck (shutdown -F) When the system booted, it found errors on my main partition but seemed to correct them. The other partitions didn't reported errors.

I shrinked my main partition (/) and enlarged others (/home)

The thing is that some files have been zeroed ( I suspect at least of http://pastebin.com/d11e35dfe )

The e2fsprogs version shiped with 0.4.6 is 1.41.3. The changelog shows that since then, there have been a lot of fixes on ext4 resizing.

Do you have any tip on what steps should I take to recover the system? I have backups of most of my personal data. I also could reinstall the packages or simply reinstall the whole system, but I would want to avoid that hassle.

PS: Please, update the e2fsprogs version or put a warning on the download page about the issue.
PS2: I also wrote a post in the archlinux forums about the issue http://bbs.archlinux.org/viewtopic.php?id=89221

2

Re: Data corruption after resizing ext4 partitions.

Thank you for reporting this problem you experienced resizing an ext4 file system with GParted Live 0.4.6-1.

GParted Live 0.5.0-3 does contain e2fsprogs-1.41.9-1.  Unfortunately a resizing problem was found when using GParted/libparted with newer GNU/Linux kernels and udev.  See:
WARNING! Problem Resizing File Systems with GParted

On January 25th, 2010 we will be releasing gparted-0.5.1 which will contain a work around for the resizing problem.

Unfortunately I do now know how to recover your file system.  My advice would be to search the Internet for any others that experienced the same problem to see if they were able to devise a solution (short of re-installing).

Best wishes to you in this quest.

3 (edited by naw 2010-01-21 20:01:45)

Re: Data corruption after resizing ext4 partitions.

Thanks for the answer. I saw the problems tith the last versions of gparted and assumed that with 0.4.6 I would be safe. I even saw that gparted used e2fsprogs 1.41 or later (it's listed on the gparted capabilities) but I didn't check the exact version nor took some time to read the changelog (even when I already had the page open). So I must take blame here, after all, I knew that I was using a old version of gparted on a relatively new filesystem.

About the problem, well, I'm going to reinstall the system (I detected 12315 files corrupted, files without using disk blocks but which reported size wasn't zero). My user data seems to not be corrupted, anyway I have backups.

I hope that today I will get the system ready again. Anyway, not everything is bad, since this is an oportunity to learn. smile

PS: Let me insist on that, until the next version is released, a warning should be written on http://gparted.sourceforge.net/download.php

4

Re: Data corruption after resizing ext4 partitions.

As per your request, the download page warning has been updated regarding "do not resize ext4 file systems with GParted Live 0.4.6-1".

Hopefully your system re-install goes smoothly.

5

Re: Data corruption after resizing ext4 partitions.

I have GParted version 0.5.0, as included on the SystemRescueCD 1.3.4 that I found on SourceForge.

My SATA hard drive is ~112GiB.
I have a 66.6GiB NTFS 'sda1' partition with XP installed on it, followed by 257 MiB in 'sda2' unused (rounding?).

sda3 is a 1.5GiB ext3 /boot partition for fedora 11.
Then comes 15.5GiB unallocated (formerly part of sda3)... I was able to unmount sda3 (/boot) and resize it (to 1.5GB) using GParted 0.4.8 in fc11 with no problems.

sda4 is an extended partition of about 27.5GiB consisting of 17.5GiB ext4 sda5 ( / ) and 10GiB sda6 (/SWAP - ready for upgrading the box to 8GB RAM from its current 4GB).

Of course it won't allow unmounting the / partition sda5 while fedora's running from that, and partition magic express (dated 06 MAY 2009) says it doesn't find any partitions it can resize when I point it at sda4, 5 or 6 while booted from windows (so maybe it doesn't know what ext4 is?).

The GParted 0.5.0 from the SystemRescue CD has no problem accessing sda4 and letting me drag its left side over to grow it to enclose the unallocated 15.5GiB. But reading about the problems with ext4 in this thread makes me hesitate to even apply that change, nevermind moving (ext4) sda5 to the left and growing it to 33GiB, too.

So, any idea what time on the 25th the new version will be released?  wink

I guess I can abort the pending changes, boot clonezilla and do an image to the NAS while I'm waiting... just in case the new version has similar problems with ext4. Restoring an image should be faster than reinstalling fedora if I need to do so.

Don't you love Mondays?

6

Re: Data corruption after resizing ext4 partitions.

To have a image or a backup is always a good idea. So, do it before resizing.
Check also what version of e2fsprogs comes with SystemRescue CD. Be sure that is 1.41.9 (released in august)

Instead resizing you also can create a  tar.gz with the partition contents, send it to the NAS and then delete and recreate the partition. I think that it would be safer than resizing it.

BTW I switched to ext3.

7

Re: Data corruption after resizing ext4 partitions.

The most recent beta version of SystemRescueCd-1.3.5-beta8 already contains the beta version of GParted 0.5.1.  There were no significant changes other than language updates between the beta release and today's release of the source code.

8

Re: Data corruption after resizing ext4 partitions.

OK...  as I said, I have the latest stable version of SystemRescueCD - 1.3.4 - which includes GParted 0.5.0...  I'll post back to this thread with the results after I use that to expand the sda4 extended partition to the left to include the unallocated ext3 space that was shrunk out of sda3 on the primary partition, then grow to the left that ext4 volume in the extended partition so that space is added to sda5.

If it does mess up, I tend to think it's more the fedoraproject.org team's fault for making ext4 the default on '/' in fc11. It might have been prudent to beta test it another cycle rather than release it as the default for all partitions in fedora 12, 'ready or not.'

And if I have to restore the image I might just switch back to ext3 too, since it is dual boot and nobody (that I'm aware of) has come up with a driver to access ext4 from windows.

Thanks for the quick reply.  smile

9

Re: Data corruption after resizing ext4 partitions.

Darr247 wrote:

OK...  as I said, I have the latest stable version of SystemRescueCD - 1.3.4 - which includes GParted 0.5.0...  I'll post back to this thread with the results after I use that to expand the sda4 extended partition to the left to include the unallocated ext3 space that was shrunk out of sda3 on the primary partition, then grow to the left that ext4 volume in the extended partition so that space is added to sda5.

Well, I have used GParted (via the SystemRescueCD) a few times now to resize ext4 '/' partitions, and it has worked just fine. The last one I ended up having to run
# grub-install /dev/sda
from fedora's rescue mode because I had moved and grew the /boot partition (hd0,1) during the same session that I resized the root partition, and
grub> setup (hd0,1)
didn't fix it.

Sorry it took so long to confirm that GParted does work just fine growing ext4 partitions. neutral

10

Re: Data corruption after resizing ext4 partitions.

ChrisBrad51 wrote:

I also try to use GParted. It is very useful. I want to know more about this. Thanks.

Be sure to use the latest e2fsprogs version to avoid corruption problems with ext4.

11 (edited by winechristmas 2010-09-08 04:05:09)

Re: Data corruption after resizing ext4 partitions.

I think it is always safer, better, easier to use the Live GParted CD (except maybe for quick, small jobs).  In your case, you could not use gparted from within your Kubuntu (since you are changing the Kubuntu partition!).

In general, if you don't have gparted installed in your Kubuntu, get it using your package manager.  It will show up under K > System > Partition editor.  But, as I say, to be safe and sure, always try to take  your time and use the GParted Live CD.
The capabilities of GParted are given under "Features" on the left side bar of the main page:
http://gparted.sourceforge.net/livecd.php

David Scott

12

Re: Data corruption after resizing ext4 partitions.

Use the combination of BootIt NG and the Linux file system resizing utilities. This method is appropriate for BootIt NG users who do not limit primaries, as well as for those that do. It involves a two step process; one to resize the partition itself using BootIt NG, and the other to resize the file system contained in the partition using the appropriate Linux file system resizing utility. Using this method will require BootIt NG as well as a Live CD containing the Linux file system resizing software. The Linux file system resizing utilities are available on the IFL Boot Disk (Image for Linux), as well as on many Linux Live CDs such as Knoppix.

The two most common Linux file systems are ext2/ext3/ext4 and reiserfs. Both of these file systems have a set of utility programs associated with them, and in both cases the program set includes a file system resizing utility. For ext2/3/4 the resize utility is resize2fs, while for reiserfs the resize utility is resize_reiserfs. Both are strictly command line utilities, and both will resize only the file system, and not the actual partition.

Important Note: If using resize2fs to resize an ext4 file system, ensure that you are using version 1.41.5 or later of resize2fs. Using any earlier version can result in file system corruption. If using the IFL Boot Disk, it should be version 2.40 or later to safely use resize2fs to resize ext4. Run the command 'resize2fs' without parameters to display the version.

The procedure for resizing a Linux partition with this method is different depending on whether you are expanding or shrinking the partition. The steps must be performed in a different order. The following are example sequences of how to expand and shrink a Linux partition using the combination of BootIt NG and the Linux resizing utilities on the IFL Boot Disk.

13 (edited by Allnsmth 2011-03-01 12:44:15)

Re: Data corruption after resizing ext4 partitions.

Hi,
You know window would not allow. If you will be changing the main Windows partition you should backup anything important. Altering the partitions can be risky, be careful and know what you are doing - there is no Windows safety option when using this.

14

Re: Data corruption after resizing ext4 partitions.

hi

Do you know why I sometimes difficult to merge two partitions into one partition

sometimes even the other partition instead becomes lost

Can you help me

15

Re: Data corruption after resizing ext4 partitions.

@ biblio
Please, create a new topic for your problem.

*** It is highly recommended to backup any important files before doing resize/move operations. ***