# Online-resizing an ext2 filesystem with resize2fs

## schaubi

Hello!

I just tried to grow an ext2 filesystem with resize2fs. I'm running a vanilla-2.6.29.3

kernel, e2fsprogs are version 1.41.3-r1 (from portage). Kernel config options

concerning ext2 are these:

```
CONFIG_EXT2_FS=y

CONFIG_EXT2_FS_XATTR=y

# CONFIG_EXT2_FS_POSIX_ACL is not set

CONFIG_EXT2_FS_SECURITY=y

# CONFIG_EXT2_FS_XIP is not set

```

Now when I create, mount, and resize an ext2 filesystem, I get the following error:

```
> mkfs.ext2 -b 1024 /dev/sda1 131040

mke2fs 1.41.3 (12-Oct-2008)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

32768 inodes, 131040 blocks

6552 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=67371008

16 block groups

8192 blocks per group, 8192 fragments per group

2048 inodes per group

Superblock backups stored on blocks: 

        8193, 24577, 40961, 57345, 73729

Writing inode tables: done                            

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

>

>

> mount /dev/sda1 /mnt/sda1

> resize2fs /dev/sda1 262082s

resize2fs 1.41.3 (12-Oct-2008)

Filesystem at /dev/sda1 is mounted on /mnt/sda1; on-line resizing required

old desc_blocks = 1, new_desc_blocks = 1

resize2fs: Kernel does not support online resizing

```

The newly created filesystem does have the resize_inode, which I've learned

is necessary for online-resizing:

```
dumpe2fs /dev/sda1 | grep resize_inode

dumpe2fs 1.41.3 (12-Oct-2008)

Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super

```

In the source code of e2fsprogs I can find the statement, where the wohle

thing fails. It comes from the following ioctl in resize/online.c:

```
 73     if (ioctl(fd, EXT2_IOC_GROUP_EXTEND, &size)) {

 74         if (errno == EPERM)

 75             com_err(program_name, 0,

 76                 _("Permission denied to resize filesystem"));

 77         else if (errno == ENOTTY)

 78             com_err(program_name, 0,

 79             _("Kernel does not support online resizing"));

 80         else

 81             com_err(program_name, errno,

 82             _("While checking for on-line resizing support"));

 83         exit(1);

 84     }

```

The problem is obviously the EXT2_IOC_GROUP_EXTEND ioctl, which is not

known to the kernel (at least I cannot find this ioctl anywhere in my

2.6.29.3 kernel sources).

Has anyone an idea what's wrong here? Unfortunately offline-resizing is

not an option for me in this case.

Thanks in advance and best regards

Christian

----------

## Hu

According to man resize2fs, you can resize ext3, but not ext2.  You created that filesystem as an ext2, but you need it to be ext3 if you want online resize to work.  You can convert ext2 to ext3 using tune2fs.

----------

