I have an ext2 partition that takes up the whole disk (which is /dev/sdc). I have unplugged the disc and plugged into another (linux) computer. How can I shrink this partition using resize2fs and fdisk.

link|improve this question

1  
Do you have cfdisk? I've found the CLI layout of it makes it really easy to use compared to fdisk. – Rob Nov 1 '11 at 14:15
feedback

2 Answers

Use GParted in SystemRescueCD: http://en.wikipedia.org/wiki/Sysresccd

link|improve this answer
I would like to know how to do it with standard linux utilities without installing anything else thanks. – DanieL Nov 1 '11 at 1:41
feedback

You're pretty much there. First you can resize the filesystem on top of the parition by using resize2fs /dev/sdc1 new_size. You can then resize the underlying partition using fdisk /dev/sdc -- delete the partition and re-create it as the new size. Create a new partition in the newly freed space and then write the partition table + mkfs.ext3 on the new volume.

To be safe, you should probably back up anything important first.

link|improve this answer
That's what I thought, but after writing the partition table, the file system on the new shrunk partition is corrupt. – DanieL Nov 1 '11 at 8:31
Probably need to run an fsck afterwards. – Garrett Nov 15 '11 at 1:40
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.