# resize a ext3 partition [solved]

## swooshOnLn

Hey, I am trying to resize my ext3 partition (its a seccond storage drive), can I do this without loosing the current data? Am I going to have to do anythign special? Or can I do it from this system, since its not depending on the storage drive?

----------

## swooshOnLn

I didnt use LVM

----------

## rev138

As far as I know, you can't resize a mounted ext2/3 partition, but other than that, it should be pretty easy. Just be careful when you're repartitioning the drive. I'd recommend that you resize it to as small as possible, then repartition, then resize it (bigger) again to fit the new space.

----------

## rev138

You might want to make a tarball of the partition before you start, just in case.

----------

## swooshOnLn

ok.. sounds good. How would I do that?

----------

## yabbadabbadont

emerge gparted

Nice graphical partition resizer and editor.  (su to root in a terminal and then run it)  As long as the partition isn't mounted, and there is freespace to expand into (assuming you are enlarging the partition), then you should be able to do so from your booted system.  If the partition to be altered is on the same drive as your root partition though, you will have to reboot after the resize operation completes so that the kernel can read the new partition table.

----------

## swooshOnLn

you say "assuming you are enlarging the partition", I am not. I am trying to make it smaller, and then create more partitions with the unsed space. Will that still work?

----------

## yabbadabbadont

Yes.  Assuming that you are doing this in an extended partition, or that you only have at most three primary partitions currently.

----------

## swooshOnLn

its a primary partition, but the only one on the drive.

----------

## yabbadabbadont

You should be fine then.

----------

## rev138

As a side note, qtparted is also available, if you're a KDE user.

Strictly speaking, however, all you need is e2fsprogs and fdisk. Use resizee2fs to shrink the filesystem, then use fdisk to re-write the partition table.

g/qtparted will automate this for you somewhat.

----------

## rev138

 *rev138 wrote:*   

> As a side note, qtparted is also available, if you're a KDE user.

 

From the looks of your avatar, I guess you're not. Nevermind  :Razz: 

----------

## swooshOnLn

 *rev138 wrote:*   

>  *rev138 wrote:*   As a side note, qtparted is also available, if you're a KDE user. 
> 
> From the looks of your avatar, I guess you're not. Nevermind 

 

:-p thankyou for all your help!

----------

## dentharg

How can I shrink ext3 filesystem? I have an LVM and want to shift some free space between volumes.

----------

## troymc

resize2fs

ie. If you want to reduce a 10G to 9G, do something like this:

```

# resize2fs /dev/vg/lv 9G

# lvreduce -L-1G /dev/vg/lv

```

troymc

----------

## batistuta

How do I reduce my ext3 partition by EXACTLY 5 gigs? The problem is that I'm scared that when I've created the partition, my parition size might have been rounded from gigs to "blocks". So if I just resize with something like

```
resize2fs /dev/myvg/homevol 30G
```

I'm not entirely sure what is the new size of my partition, so how can I later then use fdisk/lvreduce to match the exact size?

I like the way it is done in reiser:

```
# umount /home

# resize2fs /dev/myvg/homevol 524288

# lvreduce -L-1G /dev/myvg/homevol

# mount /home
```

Here there is no confusion, both are shrinked. But with ext3, specifyin the size scares my a bit...

----------

## batistuta

Even if not efficient, this is how I did it. This is the only way, that I'm 100% sure everything will be fine

The size of my original partition is 230G, and I wanto to reduce it by 10G

```

mafalda ~ # umount /dev/backup/backup1

mafalda ~ # e2fsck -f /dev/backup/backup1

mafalda ~ # resize2fs /dev/backup/backup1 210G

mafalda ~ # lvreduce -L -10G /dev/backup/backup1

mafalda ~ # resize2fs /dev/backup/backup1

mafalda ~ # mount /dev/backup/backup1

```

Anyone knows a better way?

----------

