# [SOLVED] Shrinking ext3 partition problem

## kamillys

I try to shrink ext3 partition. After shrinking it with GParted there are some kind of weird errors, partition table says that size is different that fsck says.

That's what fsck says:

```
root :~# fsck.ext3 /dev/sda3 # any options are useless here, won't work

The filesystem size (according to the superblock) is 30782208 blocks

The physical size of the device is 28222229 blocks

Either the superblock or the partition table is likely to be corrupt!

Abort<y>?
```

I choose no

```

Pass 1: Checking inodes, blocks, and sizes

Error reading block 28246018 (Invalid argument) while getting next inode from scan. Ignore error<y>?
```

Well... It tries to read over the partition... 

So I try resize2fs:

```
root :~# resize2fs -f /dev/sda3

Resizing the filesystem on /dev/sda3 to 28222229 (4k) blocks.

resize2fs: Can't read an block bitmap while trying to resize /dev/sda3

Please run 'e2fsck -fy /dev/sda3' to fix the filesystem

after the aborted resize operation

```

And output of e2fsck is above(the first one).

I thought that GParted will propertly resize /dev/sda3 so i new partition after it, but I deleted for repair issues.

Are there any options to fix this problem? I don't want to format it (a root partition of gentoo), restore from backups will last too long.

GParted now can't do anything... fsck also..

It is no LVM/RAID or any other things, just SATA hard drive(sda) and Windows 7 near Gentoo. Nothing weird(except Windows 7, but I can't remove it).

Maybe output of fdisk -l will help:

```

Disk /dev/sda: 320.1 GB, 320072933376 bytes

255 heads, 63 sectors/track, 38913 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device        Start  End   Blocks    ID System

/dev/sda3     15298  29352 112888916 83 Linux

```

_____

kamillysLast edited by kamillys on Thu Jul 01, 2010 12:00 pm; edited 1 time in total

----------

## BradN

I would use fdisk and recreate your partition how it was before, then fsck it, then resize the filesystem down (resize it smaller than it will be at the end for safety), then resize the partition (leave it a little larger than the filesystem), then grow the filesystem to fill the slack space.

This I think is the safest way to do it.

----------

## gentoo_ram

I used that method once on a ext4 filesystem.  Resize it smaller than you want before you repartition.  Redo the partition size, then resize back up again to fill the partition size space.  Of course, I did it with LVM2, but the principle is the same.

----------

## kamillys

Thanks for hint with fdisk, now problem is fixed  :Smile: 

----------

## wengm

 *kamillys wrote:*   

> Thanks for hint with fdisk, now problem is fixed 

 

Could you please show the details of the solution? Thanks! ：）

----------

## MrTorque

Hi.

I have a very similar problem, maybe it is identical. resize2fs does not work for me too.

Please post how to use fdisk instead.

Thanks in advance!

----------

