Swap volumes created in a non rootdg/bootdg disk group are not added as swap devices during system boot. As such 'swapon -a' must be run to add the swap device after the system has initialized.
book
Article ID: 100000936
calendar_today
Updated On:
Resolution
Description Of Issue:
Create a Volume Managervolume to be used as a swap device in a non rootdg/bootdg disk group (here weuse localdg):
# vxassist -g localdg make local_swapvol 10m
# vxprint -g localdg -thq
dglocaldg default default 0 1264695967.64.rdgv20z04
dm d1 hds9500-alua0_390 auto65536 1931008 -
v local_swapvol- ENABLED ACTIVE 20480 SELECT - fsgen
pl local_swapvol-01 local_swapvol ENABLED ACTIVE20480 CONCAT - RW
sdd1-02 local_swapvol-01 d1 20480 20480 0 hds9500-alua0_390 ENA
Initialize the volume as a swapdevice:
# mkswap -v1 /dev/vx/dsk/localdg/local_swapvol
Setting up swapspace version 1, size = 10481 kB
Add thevolume as an active swap area:
# swapon -v/dev/vx/dsk/localdg/local_swapvol
swapon on/dev/vx/dsk/localdg/local_swapvol
Note that the volume is now listedas an active swap device:
# swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 -1
/dev/vx/dsk/localdg/local_swapvol partition 10232 0 -2
As per normal, update /etc/fstab to indicate that the volume shouldbe used as a swapdevice:
/dev/vx/dsk/localdg/local_swapvol swap swap 0 0
Note, however, that if the system is rebooted, the disk group isimported and volume recovered, however the volume is NOT added as a swap deviceduring the boot process:
#swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 -1
Thereason for this is that swap devices are configured during boot via/etc/rc.d/rc.sysinit:
...
# Start up swapping.
update_boot_stage RCswap
action $"Enabling /etc/fstabswaps: " swapon -a -e
if [ "$AUTOSWAP" = "yes" ]; then
...
Note that then rc.sysinit is run, Volume Manager willonly have imported the rootdg/bootdg disk group and recovered volumes requiredto boot the system (assuming the boot disk is encapsulated). As such any volumesin other disk groups are not available for use at this time. Full Volume Managerinitialization is performed via init scripts in /etc/rc1.d which are run after/etc/rc.d/rc.sysinit.
Once the system has performed full Volume Managerinitialization (i.e. corresponding init scripts in /etc/rc.d/rc1.d have beenrun), extra swap volumes can be added as normal using the 'swapon' command, forexample:
#swapon -a
#swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 2031608 0 -1
/dev/vx/dsk/localdg/local_swapvol partition 10232 0 -2
Recommended Workaround:
To allow the system toautomatically add volumes in non bootdg/rootdg disk groups as swap devicesduring system boot it is necessary to re-run the 'swapon -a' command afterVolume Manager initialization has completed. The most convenient way in which todo this is to add this command to /etc/rc.d/rc.local. This file containscommands which will be executed after all normal rc scripts have beencompleted. For example:
/etc/rc.d/rc.local:
#!/bin/sh
#
# This script will be executed *after* all the otherinit scripts.
# You can put your own initialization stuff in here ifyou don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/sbin/swapon -a
Once done, the volume will be added automatically as a swap deviceat the end of the boot sequence.
Note: In testing, the secondaryswap space did not appear until about 10 minutes after the bootcompleted.
Issue/Introduction
Swap volumes created in a non rootdg/bootdg disk group are not added as swap devices during system boot. As such 'swapon -a' must be run to add the swap device after the system has initialized.
Additional Information
ETrack: 1958361
Was this article helpful?
thumb_up
Yes
thumb_down
No