Two type of swap devices - disk slices or files
Disk Layout- normally, swapfs is on partition 1. root is on partition 0.
The following is a non-labled partition -
because swap slice starts at 0 sector.
Partition
0 root wm 258 - 508 500.04MB (251/0/0) 1024080
1 swap wu 0 - 257 513.98MB (258/0/0) 1052640
2 backup wm 0 - 38306 74.53GB (38307/0/0) 156292560
3 var wm 509 - 764 510.00MB (256/0/0) 1044480
4 unassigned wm 765 - 767 5.98MB (3/0/0) 12240
5 unassigned wm 768 - 770 5.98MB (3/0/0) 12240
6 usr wm 771 - 4284 6.84GB (3514/0/0) 14337120
7 unassigned wm 4285 - 38306 66.19GB (34022/0/0) 138809760s
labled partition - root is at the beginning of the disk, vtoc at 0 sector.
Example:
Sector Content
================
0 vtoc ;sector 0 of cyclinder 0
1-15 bootblk
16- ufs
SWAP
Physical Memory -> swap/swapfs -> Virtual Memory=(swapfs + physical)
Memory contention - paging/swaping. Put anonymous pages on the swap.
1)The default location for the primary swap space is slice 1 of the boot disk.
2)Entry in /etc/vfstab determines the congiruation of the swap partition.
----- /etc/vfstab -----------------------------------------------------------
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
...
/dev/dsk/c0t0d0s1 - - swap - no -
swap - /tmp tmpfs - yes -
-----------------------------------------------------------------------------
Two forms of swap:
1) swap slices (like the above c0t0d0s1)
1) swap files - swap files are files reside on the file system. (use mkfile)
Commands:
swap -s ; summary of the swap
swap -l ; longer listing
swap -a ; add additional swap, don't put two swaps in the one disk.
swap -d ; delete swap
To Add swap slice; (assume s1 is available)
1. vi /etc/vfstab
echo "/dev/dsk/c1t3d0s1 - - swap - no -" >> /etc/vfstab
2.
#swap -a /dev/dsk/c1t3d0s1
To Add swap files:
1. mkdir -p /usr/local/swap
2. mkfile 20m /usr/local/swap/swapfile
3. swap -a /usr/local/swap/swapfile
4. echo "/usr/local/swap/swapfile - - swap - no -" >> /etc/vfstab
swap -l
swapfile dev swaplo blocks free
/usr/local/swap/swapfile - 16 40944 40944
swap -s
To remove swap space
;swap slice
#swap -d /dev/dsk/c1t3d0s1
;swap file
#swap -d /usr/local/swap/swapfile; rm /usr/local/swap/swapfile
Paging - the transfer of selected memory pages between RAM and the swap area.
Commands:
pagesize ; display current page size
pagesize -a ; display all supported pagesizes