Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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