Sunday 4 March 2012

How to add swap on the fly

Suppose you need more swap at the moment, say a 2GB file /swap2gb (Linux only).

# dd if=/dev/zero of=/swap2gb bs=1024k count=2000

# mkswap /swap2gb     # create the swap area

# swapon /swap2gb    # activate the swap. It now in use

# swapoff /swap2gb    # when done deactivate the swap

# rm /swap2gb

No comments:

Post a Comment