Adding swap
From Brandonhutchinson.com
(Difference between revisions)
(New page: == Overview == Swap needed to be increased to 8GB from 4GB on a RHEL 5 system. All hard drive space was already allocated, so I had to create a swapfile (''/files0/swapfile'' in this exam...) |
|||
| (5 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
| - | Swap needed to be increased to 8GB from 4GB on a RHEL 5 system. All hard drive space was already allocated, so I had to create a | + | Swap needed to be increased to 8GB from 4GB on a RHEL 5 system. All hard drive space was already allocated, so I had to create a swap file (''/files0/swapfile'' in this example) instead of a swap partition. |
$ '''free''' | $ '''free''' | ||
| Line 9: | Line 9: | ||
Swap: '''4192912''' 0 4192912 | Swap: '''4192912''' 0 4192912 | ||
| - | * Create the 4GB | + | == Procedure == |
| + | |||
| + | * Create the 4GB swap file. | ||
# '''dd if=/dev/zero of=/files0/swapfile bs=1024 count=4194304''' | # '''dd if=/dev/zero of=/files0/swapfile bs=1024 count=4194304''' | ||
4194304+0 records in | 4194304+0 records in | ||
4194304+0 records out | 4194304+0 records out | ||
4294967296 bytes (4.3 GB) copied, 36.1759 seconds, 119 MB/s | 4294967296 bytes (4.3 GB) copied, 36.1759 seconds, 119 MB/s | ||
| - | * Setup the | + | * Setup the swap file. |
# '''mkswap /files0/swapfile''' | # '''mkswap /files0/swapfile''' | ||
Setting up swapspace version 1, size = 4294963 kB | Setting up swapspace version 1, size = 4294963 kB | ||
| - | * Enable the | + | * Enable the swap file immediately. |
| - | # '''swapon /files0/ | + | # '''swapon /files0/swap file''' |
| - | * Enable the | + | * Enable the swap file after reboot. |
Add the following to ''/etc/fstab'': | Add the following to ''/etc/fstab'': | ||
/files0/swapfile swap swap defaults 0 0 | /files0/swapfile swap swap defaults 0 0 | ||
| + | * Confirm the swap file has been added to swap. | ||
| + | $ '''free''' | ||
| + | total used free shared buffers cached | ||
| + | Mem: 8177384 8058892 118492 0 116668 7534592 | ||
| + | -/+ buffers/cache: 407632 7769752 | ||
| + | Swap: '''8387208''' 0 8387208 | ||
| + | |||
| + | == Links == | ||
| + | * [http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/s1-swap-adding.html Adding Swap Space] | ||
Current revision
Overview
Swap needed to be increased to 8GB from 4GB on a RHEL 5 system. All hard drive space was already allocated, so I had to create a swap file (/files0/swapfile in this example) instead of a swap partition.
$ free
total used free shared buffers cached
Mem: 8177384 4098900 4078484 0 133220 3671700
-/+ buffers/cache: 293980 7883404
Swap: 4192912 0 4192912
Procedure
- Create the 4GB swap file.
# dd if=/dev/zero of=/files0/swapfile bs=1024 count=4194304 4194304+0 records in 4194304+0 records out 4294967296 bytes (4.3 GB) copied, 36.1759 seconds, 119 MB/s
- Setup the swap file.
# mkswap /files0/swapfile Setting up swapspace version 1, size = 4294963 kB
- Enable the swap file immediately.
# swapon /files0/swap file
- Enable the swap file after reboot.
Add the following to /etc/fstab:
/files0/swapfile swap swap defaults 0 0
- Confirm the swap file has been added to swap.
$ free
total used free shared buffers cached
Mem: 8177384 8058892 118492 0 116668 7534592
-/+ buffers/cache: 407632 7769752
Swap: 8387208 0 8387208
