22.3 Creating Swap Space

   

After you have decided how much space you want to use for swap area and where it will be located, you can use the swapon command to actually create it. The swap space can also be created using SAM.

Creating Swap Space Using the Command Line

To create swap space on logical volume lvol3 in volume group vg03 , use the following swapon command.

 swapon /dev/vg03/lvol3 

After you use the swapon command, the swap area is created, and it becomes immediately usable to the system. If the logical volume already contains a file system, you need to use the -f option with the swapon command to force the creation of the swap area.

If you are using the whole-disk approach and want to use the c2t5d0 disk for swap space only, use the following command.

 swapon /dev/dsk/c2t5d0 

If you are using the whole-disk approach and you have created a file system on disk c2t5d0 , leaving some space at the end of the disk for swap space, use the following command.

 swapon -e /dev/dsk/c2t5d0 

Keep in mind that the -e and -f options are mutually exclusive and can't be used simultaneously while creating swap space.

If you want to create swap on c2t5d0 with a priority of 3, use this command.

 swapon -p 3 /dev/dsk/c2t5d0 

To create file system swap, you need to provide the mount point for the file system on which the swap space will be created. The swap space is created in a directory called paging on that file system. For example, the following command creates a file system swap on a file system mounted on the /myswap directory. The command puts a maximum limit of 200 Mbytes on the swap area. The actual directory that will be used for the swap space is /myswap/paging .

 swapon -l 200M /myswap 

When you create a file system swap, it can't be deleted while the system is using its swap space.

Creating Swap Space Using SAM

You can manage swap space using the Disk and File Systems area in SAM. You will use the Swap icon in this area and move a window similar to the one shown in Figure 22-1.

Figure 22-1. Using SAM to manage swap space.

graphics/22fig01.gif

This figure shows the current swap space used on your system and its type. It also shows the amount of swap space, how much of this space is used, and how much is free. The Enabled column shows whether this swap area is currently enabled. It also shows if it will be enabled when you reboot the system. It also shows how much space on the swap area is currently reserved by the running processes and how much is free. You can use the Actions menu to add a device swap area or file system swap area as shown in the figure.

Enabling Swap Space at System Startup

To activate swap area at boot time, you must put its information in the /etc/fstab file. All swap system entries in this file can be activated using the following command at any time.

 swapon -a 

When you reboot your system, the /sbin/init.d/swap_start script gets executed in run level 1. This script executes the above command to turn on the swap.

A device swap using LVM logical volume lvol3 in volume group vg03 has an entry in /etc/fstab as shown here.

 /dev/vg03/lvol3   .   swap    defaults   0   0 

Note that there is no mount point specified with this line. Instead, a dot is put in the mount point column. The file system type is swap .

If you are using a whole disk, c2t5d0 , as the swap space in the /etc/fstab file, you will use an entry like the following.

 /dev/dsk/c2t5d0   .   swap    defaults   0   0 

In case of a file system swap, you don't mention the block device file. Instead, a dot is placed for it. However, you specify the mount point for the file system being used as swap space and use options with it, as you have used on the command line.

 .   /myswap   swapfs    lim=200M   0   0 

   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net