[SunHELP] changing partition size?

Dale Ghent sunhelp at sunhelp.org
Tue Jun 12 19:19:56 CDT 2001


On Tue, 12 Jun 2001, Will Melick wrote:

| If I have some more free space on a disk, is there a way to increase an
| partition size without destroying the data on it?

Yes, but: that free space (partition) on your disk must immediately come
after the partition you want to increase in size. In other words, the
cylinders of a partition must be contiguous, and the new space must be at
the end of the existing partition. You just cant use cylinders 129-511 and
add cylinders 1232-1400 to it, or add cylinders 2-80 to the front of it.

An example:

You have partition 6 in use as a filesystem, and you wantthe add the
cylinders in the unused partition 7 to 6 to increase 6's size.

1) Go into format, select the disk, go into the partition menu, and print
   the current partition config of the disk.

   Say 6's cylinder range is 600-800, and 7's range is 801-1000

2) Select partition 7, and specify 0 for all numeric values. This
   effectively makes slice 7 zero-length. The cylinders assigned to it are
   now unallocated.

3) Select partition 6. Keep the staring cylinder number, and when asked
   for the size of the parition, specify the remaining difference in
   cyclinders.. so in this example, you'd type: 400c (which is the
   difference between 600, the starting cylinder, and 1000, the new end
   cylinder.)

4) label the disk to commit the new partition layout

5) Run the following little script to grow the UFS filesystem on slice 6
   to fill the newly appended cyclinders:

------------ begin growfs.sh script

#!/bin/sh

SIZE=`devinfo -p $1 | awk '{print $5}'`

/usr/lib/fs/ufs/mkfs -G $1 $SIZE

------------ end growfs.sh script

This script is ran with the argument of the raw slice of the partition you
just incresed in size.

example: ./growfs.sh /dev/rdsk/c0t0d0s6

You will then have increased slice 6's size, and yes, you can do this on
the fly, while it is mounted. The usual advices stands though. Make a
backup prior to doing this.

/dale




More information about the SunHELP mailing list