Resizing partitions

Resizing of partitions requires full backup and restore of the data in those
partitions and in any adjacent partitions which will be affected by the
procedure.

Partitions which do not have their starting or ending cylinder changed do
not have
to be backed-up. They will not be affected.

Example: To grow "root" (Part. 0) and take away space from "/data"
(Part. 4), these partitions, as well as the partitions between them
must be backed up and restored since the boundaries of each one will
be affected by the resizing. In this example we will not have to backup
Part. 1 (swap) or Part. 2 (backup). This is because swap is not a filesystem
(only stores temporary info while the system is running) and "backup" is just
an unused slice spanning the entire drive (again, there is no filesystem on
it).
Actually, part. 2 will not be touched at all.

Current layout of the disk:
Part Tag Flag Cylinders Size Blocks
0 root wm 0 – 808 600.43MB (809/0/0) 1229680
1 swap wu 809 – 1213 300.59MB (405/0/0) 615600
2 backup wm 0 – 2732 1.98GB (2733/0/0) 4154160
3 alternates wm 1214 – 1779 420.08MB (566/0/0) 860320
4 alternates wm 1780 – 1914 100.20MB (135/0/0) 205200
5 unassigned wm 1915 – 2184 200.39MB (270/0/0) 410400
6 usr wm 2185 – 2589 300.59MB (405/0/0) 615600
7 home wm 2590 – 2732 106.13MB (143/0/0) 217360

In the above example Part. (slice) 4 is mounted on /data (even though the
Tag shows "alternates". This is because there is no format tag for "data".
The tag field does not have to correspond to mountpoint name.)

So we have to backup Part 0, 3 and 4 only.

After the procedure:

Part Tag Flag Cylinders Size Blocks
0 root wm 0 – 878 652.38MB (879/0/0) 1336080
1 swap wu 879 – 1283 300.59MB (405/0/0) 615600
2 backup wm 0 – 2732 1.98GB (2733/0/0) 4154160
3 alternates wm 1284 – 1849 420.08MB (566/0/0) 860320
4 alternates wm 1850 – 1914 48.24MB (65/0/0) 98800
5 unassigned wm 1915 – 2184 200.39MB (270/0/0) 410400
6 usr wm 2185 – 2589 300.59MB (405/0/0) 615600
7 home wm 2590 – 2732 106.13MB (143/0/0) 217360

Here are the examples of commands used to perform this procedure:

1) Boot system into single user mode.
Note: If modifying partitions on the boot disk the system must be booted
from the CD-ROM.
This is because partition table cannot be modified on a disk with
mounted filesystems.
Also to get a reliable backup of the OS slices (/, /usr and /var) they
must be unmounted
while being backed up.

ok boot cdrom -s

2) Run fsck on each filesystem being backed up.

# fsck /dev/rdsk/c#t#d#s#
(c#t#d#s# is the address of the slice we are currently working on Ex.
c0t0d0s0)

3) Run ufsdump on each filesystem (assuming there is a tape drive /dev/rmt/0).
We are using a fresh tape foreach filesystem (for simplicity).

# ufsdump 0uf /dev/rmt/0 /dev/rdsk/c#t#d#s#

4) Start the format utility and layout the filesystems with new sizes and
label the disk.

5) Create the new file system(s) for each of the resized partitions.

# newfs /dev/rdsk/c#t#d#s#

6) Run fsck on the new file system(s).

# fsck /dev/rdsk/c#t#d#s#

7) Mount each new file system on a generic mount point and
cd to that mount point and restore each filesystem.

Insert that the tape containing the filesystem being restored.
# mount /dev/dsk/c#t#d#s# /mnt
# cd /mnt
# ufsrestore -rvf /dev/rmt/0
# rm restoresymtable
# cd /
# umount /mnt
(repeat above steps for each filesystem)

8) If resizing the / partition, reinstall the boot block.

# cd /usr/platform/`uname -i`/lib/fs/ufs
# installboot bootblk /dev/rdsk/c#t#d#s#
(c#t#d#s# is the address of the root slice)

9) Reboot

# reboot

Leave a Reply

Your email address will not be published. Required fields are marked *