Why does anaconda fail to create the swap partition in %post script during kickstart installation of Red Hat Enterprise Linux 6?

Solution Verified - Updated -

Issue

  • The kickstart file contains the following line.
logvol swap --name=lv_swap --vgname=vg_sys --size=1044
  • And the %post script is available in the kickstart file which contains the following snippet.
# Add additional swap partitions for priority
TASK='Add additional swap partition on dasdb1'
infolog "$TASK"
mkswap /dev/dasdb1
errorlog "$?"

# Add additional swap partitions for priority
TASK='Add additional swap partition on dasdc1'
infolog "$TASK"
mkswap /dev/dasdc1
errorlog "$?"

# Enable all swap partitions
TASK='Enable dasdb1 swap partitions'
infolog "$TASK"
swapon /dev/dasdb1
errorlog "$?"

# Enable all swap partitions
TASK='Enable dasdc1 swap partitions'
infolog "$TASK"
swapon /dev/dasdc1
errorlog "$?"
  • Still post installation, the swap space is as follows.
[root@localhost ~]# free | grep -i swap
Swap:      1212404          0    1212404

[root@localhost ~]# cat /proc/meminfo | grep -i swap
SwapCached:            0 kB
SwapTotal:       1212404 kB
SwapFree:        1212404 kB
  • The swap partitions miss /dev/dasdc1 as follows.
[root@localhost ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-0                               partition       1081340 0       -1
/dev/dasdb1                             partition       131064  0       2
  • Post installation, one can create and enable the swap manually on /dev/dasdc1.

Environment

  • Red Hat Enterprise Linux 6.6
  • Kickstart

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content