etx4 online shrinking issue

Help
2009-01-30
2012-11-28
  • Fabio Coatti
    Fabio Coatti
    2009-01-30

    Hi all, I'm trying to on-line resize (shrink) a ext4 volume, but without success. (it's supposed to work, right? :) )

    ext4 partition has been created for testing purposes, so I can destroy and rebuild it without problems.
    Basically I created a 55GB lv on a lvm vg ( /dev/vg1/home2 LV Size 55GB) with a straight

    mke2fs -t ext4  /dev/vg1/home2

    mount:
    /dev/mapper/vg1-home2
                           55G  180M   52G   1% /home2

    Then I've  tried to online resize it to 40GB, but the result is not OK:

    # resize2fs /dev/vg1/home2 40G
    resize2fs 1.41.4 (27-Jan-2009)
    Filesystem at /dev/vg1/home2 is mounted on /home2; on-line resizing required
    On-line shrinking from 14417920 to 10485760 not supported.

    I can't understand exactly what I've done wrong, to be honest. Maybe I've to round the dimension to some number, but I found no hints about this.

    unmounting the partition:

    kefk ~ # umount /dev/vg1/home2
    kefk ~ # resize2fs /dev/vg1/home2 40G
    resize2fs 1.41.4 (27-Jan-2009)
    Eseguire prima 'e2fsck -f /dev/vg1/home2'.

    (italian: basically it says: run e2fsck -f /dev/vg1/home2 before resizing)

    After running e2fsck as recommended, the off-line (unmounted) shrinking works:

    resize2fs /dev/vg1/home2 40G
    resize2fs 1.41.4 (27-Jan-2009)
    Resizing the filesystem on /dev/vg1/home2 to 10485760 (4k) blocks.
    The filesystem on /dev/vg1/home2 is now 10485760 blocks long.

    This sounds a bit weird to me, can someone tell me where I'm wrong?

    ext2 tools version: 1.41.4
    Kernel: 2.6.28.2 (64 bit amd)

     
    • Theodore Ts'o
      Theodore Ts'o
      2009-01-30

      Sorry, on-line shrinking is not supported.