I want to install oracle10g in the Virtual Machine and find that the default swap space does not meet the minimum requirement. Because the physical memory I allocate is 1 GB, 2 GB swap space is required as required, by default, only 1 GB of swap space is available. To add a swap space, follow these steps:
Step 1: make sure that there is sufficient space in the system for swap. I am using KVM and want to add a swap file to an independent file system, add 2 GB swap file to/opt/image
Step 2: add the swap file and set its size to 2 GB. Run the following command:
[Root @ sense image] # dd if =/dev/zero of =/opt/image/swap bs = 1024 count = 2048000
After a period of time, the following results are returned:
2048000 + 0 records in
2048000 + 0 records out
2097152000 bytes (2.1 GB) copied, 272.867 seconds, 7.7 MB/s
Step 3: Create (SET) the swap space and run the mkswap command.
[Root @ sense image] # mkswap/opt/image/swap
Setting up swapspace version 1, size = 2097147 kB
Step 4: Check the size of the existing swap space and run the free command.
[Root @ sense image] # free-m
Total used free shared buffers cached
Mem: 1011 989 21 0 1 875
-/+ Buffers/cache: 112 898
Swap: 1027 0 1027
Or check the meminfo file.
Grep SwapTotal/proc/meminfo
Step 5: Start the newly added 2 GB swap space and run the swapon command
[Root @ sense image] # swapon/opt/image/swap
Step 6: confirm that the new 2G swap space has taken effect. Run the free command.
[[Root @ sense image] # free-m
Total used free shared buffers cached
Mem: 1011 995 15 0 4 877
-/+ Buffers/cache: 113 897
Swap: 3027 0 3027
Or check the meminfo file.
Grep SwapTotal/proc/meminfo
Step 7: Modify the/etc/fstab file so that the newly added 2G swap space will automatically take effect after the system restarts.
Add at the end of the file:
/Opt/image/swap defaults 0 0