How to resize ext3 partitions?

Ambrogio fn050202 at flashnet.it
Fri May 12 13:05:14 UTC 2006


Il giorno gio, 11/05/2006 alle 13.14 -0300, Marcelo Magno T Sales ha
scritto:

> ext3 partition = partition formated with ext3 file system.
Ok, I can understand your point of view.
For me Partitions are partitions and filesystems are filesystems.
I can have a partition with a filesystem formatted as ext3, but it is
evrytime a partition. So you can treat it as a partition.

> > So to resize a partition you can use all tools related to it (for
> > examples fdisk)
> 
> fdisk does not resize partitions, unless you delete it and recreate it, but 
> then you loose all data. The softwares I mentioned resize partition 
> on-the-fly. However, for some reason, the resize option is disabled in both.
fdisk permit you to manage partitions, but never you loose data, if you
know what you are doing.
I'm working with partitions every days, and I never loose data.

> > To resize the filesystem you have to use other command.
> > ext2resize I don't remember but I think works online.

As mentioned in other post, I suggest reading the LVM-Howto.

But to summarize the steps.
If you want to extend a filesystem by extend also the partition you have
to:

1. copy your partition configuration by for example the 'fdisk -l'
command. There are other command that permit to have a simple file that
can be used to reconfigure the partition table, but I don't remember
which because I'm not using it.
2. Calculate the dimension of your new partition, standing that the
first block as to be the same as before (otherwise you can't see data).
Note that you can't see data, but data is not lost. If you reconfigure
the partition as before, you can see the same data.

3. Maybe you need to reboot before you can use the new disk layout.
4. try to use the filesystem by mount it.
4.1 Note that df let you see the old dimension of the filesystem,
because filesystem is not partition (even if the partition size is
increased).
5 Extend your filesystem as you want.
6. After extending filesystem whit resize2fs you must check filesystems

If you want to shrink fileystem I suggest other steps, even if is
possible in some case to be done online.

1. Stop user accessing data
2. Umount filesystem
3. resize filesystem (shrink)
3.1 a test is made to be sure that the new dimension is possible without
data loss.
3.2 check filesystem and remount it (if you want to be sure that
filesystem is there)
4. calculate the new partition dimension in block, and change it. be
carefull in the calc
5. Maybe you need to reboot before you can use the new disk layout.
6. Try to use the filesystem by mount it or check only without doing
nothing to filesystem. If you trouble reconfiguring partitions, and try
to check filesystem with repair mode, you can loose data.
7. if it's ok, resize the filesystem. This is because you can leave some
MB or GB without knowning it.

Bye
 Ambrogio




More information about the fedora-list mailing list