4

I recently backed up an 11GB ext4 partition to a file using dd, repartitioned, and restored the file to a 40GB partition. parted now shows the partition as 40GB, Nautilus reads it as 11GB, and both list the drive as only having 2GB free.

Is this a filesystem issue or partition issue and how can I fix it without repartitioning to 11GB, dd'ing the file, and growing the partition?

1 Answers1

7

If all is well up to that point then I think you just need to resize2fs the filesystem up to 40Gb:

resize2fs /dev/sdc1

where /dev/sdc1 is the name of your partition.

Took off the size as per womble's excellent comment below.

resize2fs will grow the filesystem when it's mounted. It can also shrink it but needs to be unmounted for that.

gm3dmo
  • 10,057
  • 1
  • 42
  • 36
  • 4
    Don't give resize2fs a size; it'll work out the correct size to expand the filesystem to all by itself, and will get it right, too. – womble Jan 02 '10 at 10:35
  • 1
    and for anyone coming across this at a later point, but happens to use reiserfs: `resise_resierfs` :) – BuildTheRobots Jan 02 '10 at 11:10
  • 1
    Of course anyone using Reiser should move off ASAP, it's a known dangerous filesystem (no not making the obvious joke). XFS and EXT2/3/4 are the (IMHO) only sane options. – LapTop006 Jan 02 '10 at 14:03
  • Thanks. I'm amazed that resize2fs can even be used on a mounted partition. –  Jan 02 '10 at 15:50
  • 1
    @laptop005 i've been using it happily for years now. care to elaborate please :) – BuildTheRobots Jan 02 '10 at 18:45