chpt(8)chpt(8)Namechpt - change a disk partition table
Syntax
/etc/chpt [ -a ] [ -d ] [ -q ] [ -v ] [ [ -px offset size ] ... ]
device
Description
The command lets you alter the partition sizes of a disk. You can use
the command to tailor your system disks and their partitions to suit
your system's individual needs.
If you want to create a file system on a partition that has been modi‐
fied, you must use
The standard procedure to change a partition table is:
1. Look at the current partition table by using the -q option.
2. If a file system does not exist on the a partition, create one by
using the command.
If a file system exists on the a partition but does not contain a
partition table in its superblock, copy the partition table from the
driver to the superblock by using the command with the -a option.
3. Change the partition offsets and sizes by using the -px option. You
can change all the partitions for one disk on one command line.
The device must be either the a or c partition of the raw device,
depending upon where the file system resides. For example, if the file
system resides in the a partition of an RM05 in drive 0, device is
rhp0a.
A file system must exist on the a or c partition of the disk. If you
do not have a file system there, create one by using the command.
Options-a Copies the partition table in the device driver to the disk.
-d Copies the default partition table to the disk and to the current
partition table in the driver. The default partition table is
the table that was built with the disk driver.
-q Runs the command without modifying the partition tables. This
prints the partition table of the specified disk. It prints the
default partition table in the driver if there is no partition
table on the disk.
-v Prints verbose messages showing the progress of the command.
-px Changes the parameters of one of the partitions on the disk to
the specified offset and size. The x argument is the partition
you are modifying (a, b, c, d, e, f, g, or h). The Offset argu‐
ment is the new beginning sector, and the size argument is the
new total number of sectors of the partition being modified.
Examples
This example shows how to change the partition table on an RM05 disk in
drive 1. The commands in this example change the size of the h parti‐
tion to include the g partition. Comments are in parenthesis to the
right of commands.
% chpt-q /dev/rhp1a (view partition table)
/dev/rhp1a
No partition table found in superblock...
using default table from device driver.
Current partition table:
partition bottom top size overlap
a 0 15883 15884 c
b 16416 49855 33440 c
c 0 500383 500384 a,b,d,e,f,g,h
d 341696 357579 15884 c,g
e 358112 414047 55936 c,g
f 414048 500287 86240 c,g
g 341696 500287 158592 c,d,e,f
h 49856 341201 291346 c
In all of the tables generated by the command, the bottom column con‐
tains the offset (starting sector), the top column contains the ending
sector, and the size column contains the number of sectors in the par‐
tition. The overlap column contains the other sectors that are par‐
tially or entirely included in the partition.
% bc (basic calculator)
500287-49856 (top of g minus bottom of h)
450431
450431+1 (add 1 because it is zero-based)
450432 (size of new h partition)
In the display of the example query, you can see that there is no par‐
tition table in the superblock of the a partition. If this is because
there is no file system in the a partition, run the command to create
one.
For this example, assume that there is a file system in the a partition
of the disk, but the file system does not contain a partition table in
its superblock. Therefore, run the command with the -a option to copy
the partition table in the driver to the superblock of the a partition.
% chpt-a /dev/rhp1a (add table to a partition)
Now you have a partition table to change. For example:
% chpt-v -ph 49856 450432 /dev/rhp1c (change h)
/dev/rhp1c
New partition table:
partition bottom top size overlap
a 0 15883 15884 c
b 16416 49855 33440 c
c 0 500383 500384 a,b,d,e,f,g,h
d 341696 357579 15884 c,g,h
e 358112 414047 55936 c,g,h
f 414048 500287 86240 c,g,h
g 341696 500287 158592 c,d,e,f,h
h 49856 500287 450432 c,d,e,f,g
Caution
Changing partition tables indiscriminately can result in the loss of
large amounts of data.
Check for file systems on all the partitions of the disk before using
the -p option. If a file system exists whose partition may be
destroyed, copy it to a backup medium. After you have changed the par‐
titions, restore the backed up file system.
Restrictions
You must have superuser privileges to use the command.
You can not shrink or change the offset of a partition with a file sys‐
tem mounted on it or with an open file descriptor on the entire parti‐
tion.
You can not change the offset of the a partition.
See Alsoioctl(2), disktab(5), fsck(8), mkfs(8), newfs(8)
Guide to System Disk Maintenance
chpt(8)