Borrowing space from /swap
To borrow space from /swap, you'll need to bring your system down to single-user mode. Once in single-user mode, turn off swapping to the partition you intend to borrow. Enter the command
swap -l
You should see something similar to this: swapfile dev swaplo blocks free
/dev/dsk/c0t1d0s1 32,9 16 2097952 2097952
To disable swapping to the partition, enter the command swap -d /dev/dsk/c0t3d0s1
Once you've done this, you're ready to re-allocate the partition by editing the disk label with the format command.
At the prompt, enter the command
format
and select the appropriate disk number to edit. If you have only one hard disk in your system, enter 0 to load the Format menu. At the bottom of the Format menu, enter the command
format>partition
at the prompt. This will bring you to the partition> prompt. At the prompt, enter the command
partition>print
to view the partition table for your hard disk. Once you've displayed the partition table, enter the partition number in the far left column on your screen assigned to swap. To demonstrate, we'll use the partition table shown in Table A.
Table A: Unless you specify otherwise, the swap partition is usually partition number 1 on Solaris systems.
Part
|
Tag
|
Flag
|
Cylinders
|
Size
|
Blocks
|
0
|
root
|
wm
|
0 - 507
|
250.03MB
|
(508/0/0) 512064
|
1
|
swap
|
wu
|
508 - 638
|
64.48MB
|
(131/0/0) 132048
|
2
|
backup
|
wm
|
0 - 2035
|
1002.09MB
|
(2036/0/0) 2052288
|
3
|
usr
|
wm
|
639 - 890
|
124.03MB
|
(254/0/0) 254016
|
4
|
unassigned
|
wm
|
0
|
0
|
(0/0/0) 0
|
5
|
unassigned
|
wm
|
891 - 1198
|
151.59MB
|
(308/0/0) 310464
|
6
|
usr
|
wm
|
1199 - 1422
|
110.25MB
|
(224/0/0) 225792
|
7
|
home
|
wm
|
1423 - 2032
|
300.23MB
|
(610/0/0) 614880
|
At the partition> prompt enter 1 for the swap partition, and you'll be shown four prompts. You can answer the first three prompts
Enter partition id tag [swap]:
Enter partition permission flags [wu]:
Enter new starting cyl [508]:
by simply pressing [Enter] after each one. For the fourth prompt
Enter partition size [132048b, 131c, 64.48mb]:
you'll need to enter the new size of the par-tition. Since you'll be borrowing from this partition to create a new one for your meta-device state database, you'll use half of the partition, or 65c. Once you enter this number, you'll return to the partition> prompt.
After you change your swap partition size, you'll need to allocate the now-unused disk space to a partition. In Table A, you can see that partition 4 is unassigned and has a size of 0. To view your current partition table, enter the command print at the prompt. Notice that the swap partition now ends on cylinder 573. This will be important when you assign the disk space to the new partition.
Enter 4 at the partition>prompt and answer the next two prompts by pressing [Enter]. The third prompt requires you to enter the new starting cylinder for the partition. Since your new swap ends on 573, the starting cylinder will be 574 for this partition. Enter this number and press [Enter].
The fourth prompt asks for the partition size. Enter the same number as you did for the new swap partition size, 65c. When you finish, enter the command print to view your changes to your partition table. They should appear as shown in Table B.
Table B: Once you make your partition table changes, you can view them before making them permanent.
Part
|
Tag
|
Flag
|
Cylinders
|
Size
|
Blocks
|
0
|
root
|
wm
|
0 - 507
|
250.03MB
|
(508/0/0) 512064
|
1
|
swap
|
wu
|
508 - 573
|
32.48MB
|
(66/0/0) 66528
|
2
|
backup
|
wm
|
0 - 2035
|
1002.09MB
|
(2036/0/0) 2052288
|
3
|
usr
|
wm
|
639 - 890
|
124.03MB
|
(254/0/0) 254016
|
4
|
unassigned
|
wm
|
574 - 638
|
31.99MB
|
(65/0/0) 65520
|
5
|
unassigned
|
wm
|
891 - 1198
|
151.59MB
|
(308/0/0) 310464
|
6
|
usr
|
wm
|
1199 - 1422
|
110.25MB
|
(224/0/0) 225792
|
7
|
home
|
wm
|
1423 - 2032
|
300.23MB
|
(610/0/0) 614880
|
Now that you've made your changes to you partition table and double-checked your filesystem sizes, you can write the partition table with the command
partition> label
You'll then be prompted to confirm the labeling procedure. Answer yes and you'll return to the prompt. Simply enter quit at the partition> and format> prompts to return to your command prompt. Reboot the system for the changes to take effect.
|