ლ(ಠ益ಠლ)

Ubuntu 12.04.4 LTS: Resize2fs Hang on Ext4 Filesystem

Filesystem (ext4) resize failed on Ubuntu 12.04.4 LTS, following an mdraid expansion.

1
2
3
4
5
6
$ resize2fs /dev/mapper/foo
resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/mapper/foo to XXXXXXXXXX (4k) blocks.

^C
Terminated.

It quickly became clear that this operation was hanging and would not complete (unfortunately I did not capture a stack trace).

A launchpad bug report as well as the linux-ext4 mailing list document this bug thoroughly.

Ubuntu 12.04.4 LTS is using an older version of e2fsprogs and, therefore, resize2fs.

The following is the versioning disparity between the recent Ubuntu LTS releases (with the exception of 14.10) for the e2fsprogs package:

1
2
# Ubuntu 12.04.4 LTS:
ii  e2fsprogs                                      1.42-1ubuntu2
1
2
# Ubuntu 14.04.1 LTS:
ii  e2fsprogs                                      1.42.9-3ubuntu1
1
2
# Ubuntu 14.10:
ii  e2fsprogs                                      1.42.10-1.1ubuntu1

Upgrading Ubuntu was not an option for the client. Based on the information above, moving from Ubuntu 12.04.4 LTS to 14.10 would not give access to the latest version of e2fsprogs.

As of writing this, the latest version is 1.42.12.

Let’s compile our own.

Note, you should have the build-essential meta-package installed.

Warning, do not proceed with a filesystem resize(s) unless you have healthy backups in place.

1
2
3
$ wget https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.12/e2fsprogs-1.42.12.tar.gz
# sha256sum.asc:
# https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.12/sha256sums.asc
1
2
$ tar xvfz e2fsprogs-1.42.12.tar.gz
$ cd e2fsprogs-1.42.12

Careful, you should specify a custom prefix here, I used /opt, but you can use whatever you prefer.

1
$ ./configure --prefix=/opt/e2fsbuild
1
$ make && make_install

The new compiled collection of e2fs utilities will be located in the prefix you specified during the configure step previously.

1
$ cd /opt/e2fsbuild/sbin/
1
2
3
4
# PWD: /opt/e2fsbuild/sbin/
$ ./resize2fs
resize2fs 1.42.12 (29-Aug-2014)
Usage: ./resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [new_size]

Expand the filesystem using this custom compiled resize2fs binary–it may prompt you to perform an e2fsck before-hand.

1
2
3
4
5
$ ./resize2fs /dev/mapper/foo

resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/mapper/foo to XXXXXXXXXX (4k) blocks.
The filesystem on /dev/mapper/foo is now XXXXXXXXXX (4k) blocks long.

Success!

Naturally, this is only a temporary measure–we’ll be moving this client to a newer operating system as soon as possible, as custom compiled packages strewn throughout an environment, is irresponsible and unsustainable.

Comments