Posted in Howto Linux

Resize ext3 partitions

March 16, 2007 - 4 comments

Say we have a brand new already ext3 formatted disk on our system.. say it has a 300 GB partition and it is brand new, so not running anything on the system. DO NOT TRY RESIZING PARTITIONS ON SYSTEM DISKS UNLESS YOU KNOW WHAT YOU ARE DOING.

We are gonna copy the old 100 GB partition to the new partition.

Old : sda2
New : sdb1

dd if=/dev/sda2 of=/dev/sdb1 bs=4k

When it’s done, if mounted, the system will think the new partition is 100 GB big. We need to resize it.

Don’t mount ! Or if you did to make sure data were correctly copied, unmount the new partition !

Check for problems on the new partition

fsck -n /dev/sdb1

Remove the old ext3 journal, this is needed to resize..

tune2fs -O ^has_journal /dev/sdb1

Force checking, this is absolutely needed for the next step

e2fsck -f /dev/sdb1

Resize partition

resize2fs /dev/sdb1

Check fs again

fsck -n /dev/sdb1

Create ext3 journal

tune2fs -j /dev/sdb1

Now mount the new partition, relabel it or edit your fstab.. It all depends on your config there.

More info : http://www.howtoforge.com/linux_resizing_ext3_partitions

Wouter explains you can do online resizing of an ext3 partition : http://www.grep.be/blog/en/computer/cluebat/actually_you_can

Comments

Sebastian

March 16, 2007 - 13:01

Hi!
You can skip the tune2fs parts – with newer resize2fs versions you just need the fsck before actually resizing the ext3 fs.

Ben

March 16, 2007 - 14:26

You do it the hard way ;)

I use qtparted.

Sébastien Wains

March 16, 2007 - 14:37

I did it on a GUI-less server :)

In runlevel 1…

130 GB and/or 5 years worth of data to migrate to a new RAID1 array.. I could not trust GUI tools there.

Expansión de array RAID (1+0) en HP Proliant + Red Hat Linux « we’re only gonna die from our arrogance

November 8, 2007 - 14:06

[...] de ext3, y hay que quitárselo y metérselo después del redimensionado (con tune2fs) como puede verse aquí. Además, resize2fs recibe el tamaño nuevo de la unidad redimensionada en bloques de 4KB, y eso [...]

Leave Comment

Please consider visiting the partners below if you enjoyed this article :

If this post saved you time and money, please consider checking my Amazon wishlist.

Before submitting, some rules :
- Is your comment related to the article ?
- You're having a problem ? Have you checked Google, other howtos, docs, manpages ?
- You're still having the problem ? Have you raised log verbosity, checked traces, ran tcpdump ?
- Have you checked your configuratoin for typo ?
Unless your comment is providing additional info or respect the rules above, DON'T comment.
If you don't understand what you are doing, I urge you to read the documentation, I'm not your free Level 1 helpdesk guy.