Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
2  
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
up vote 2 down vote accepted

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.

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .