Colin Paul Adams wrote:
I need to shrink a disk partition in order to fit the iso images on a
new partition.
I have used resize2fs to shrink my /usr filesystem from 20G to 15G (it
was only using 10G). This reported that it is now 3932160 4K blocks in
size.
How can I shrink the partition to match it, so as to free space for a
new partition? The resize2fs man page saya I can use fdisk to do this
but it doesn't say how. The sizes fdisk reports are clearly not 4k
blocks as they do not match the figures (it shows 27823288 as the
partition size). And I can't find a command to shrink the partition anyway.
Note: Partitioning can completely destroy your system if you do not pay
attention to what you are doing! (Or even if you do, sometimes)
With that said, you can use fdisk or parted, start them up with fdisk
/dev/hda or parted /dev/hda, with whatever disk you're working with.
With parted, type help to see what commands you can use, and with fdisk m.
What you need to do is DELETE the partition, and then recreate it at the
correct size. (If you're using ext3; parted can resize some other types
of filesystems like ext2, vfat itself.) But if you do it too small, you
could lose everything.
You might be able to use gparted or Qtparted, GUI frontends for parted,
but again, ext3 doesn't resize easily. So I'd backup everything on the
partition first, if that's possible.
-Dan