Resizing disk is a very hot topic of discussion among the system administrators. A few admins agree and many disagree with the idea of resizing disk partitions. I am sharing my piece of knowledge on this.
I have been in a situation where /tmp partition of disk has to be resized. My disk was of 350 cylinder and partition was as follows.
start Cylinder| End Cylinder | Partition
0 | 10 | /dev/sda1
11 | 200 | /dev/sda2
201 | 299 | /dev/sdb3
300 | 330 | /dev/sda4
Here /tmp partition is /dev/sda4 (cylinder 300 to 330), so here cylinder 331 to 349 was unused and I had to allocate same to /dev/sda4.
To resize /dev/sda4, I rebooted system in single user mode and edited partition table with sfdisk command as follows
sfdisk /dev/sda -N4 <<EOF
Remember that here I changed end cylinder, Never think to change start cylinder (sector) as it will overwrite superblock and resulted in corruption of partition.
After resizing /dev/sda4, I resized file system using below command
fsck -y /dev/sda4
Good to go with reboot now.