LINUX increase SWAP partition --- install_oracle

We all know that when you install Linux system can allocate swap partition when the partition, and the system is installed (in operation) how to set up or adjust the swap partition it?
After Bahrain Linux system, there are two ways to establish Swap partition.
1. Create a new disk partition as swap partition
2. Use the file as a swap partition (operation easier, I more often)
Here are two methods :( must, during the operation should be careful with root privileges.)

First, create a new disk partition as swap partition
1. Go to the console (login system) as root, enter
# swapoff -a # Stop all swap partitions

2. fdisk command (Example: # fdisk / dev / sdb) disk partition, swap partition is added, the new partition, to 82 (Linux swap type) with the fdisk "t" command newly added partition id, Finally, the actual write operation to the hard disk w (w useless before the operation is invalid).

3. # mkswap / dev / sdb2 # format the swap partition, sdb2 here to look after your plus p command displays the actual partition device name

4. # swapon / dev / sdb2 # start a new swap partition

5. In order to let the system automatically enabled when you start the swap partition, you can edit the / etc / fstab, adding the following line to
/ dev / sdb2 swap swap defaults 0 0


Second, with the file as a Swap partition

1. Create a file to a swap partition: 1GB swap partition size increases, the command written as follows, where the count is equal to a desired number of blocks (bs * count = file size).
# Dd if = / dev / zero of = / root / swapfile bs = 1M count = 1024

2. formatted as a swap file:
# mkswap / root / swapfile # establish a swap file system

3. Enable the swap file:
# swapon / root / swapfile # Enable swap file

4. Since the system is enabled at boot time, add a line in the file / etc / fstab in:
/ root / swapfile swap swap Defaults 0 0



New and used swap increased command is: mkswap, swapon, etc., and want to close out a swap with the "swapon / dev / sdb2" such an order can be

 

Swap configure Linux environment

Scene:
This afternoon a CentOS6.5 operating system installation, configuration forget swap partition. After a look at how to install the system, add and remove swap partition.
As follows:
1. Memory consumption
[Joshua the root @ ~] # -m Free
Total Free Used Shared buffers cached
Mem: 31 is 33 is 574 2006 1886 119
- / + buffers / Cache: 1278 727
Swap: 0 0 0
2. By dd command to increase the swap, increasing the swap space a 2g of
[the root @ Joshua ~] # dd IF = / dev / ZERO of = / var / swap BS = 1024 COUNT = 2048000
2048000 + 0 Records in
2048000 + 0 Records OUT
2.097152 billion bytes (2.1 GB) copied, 36.4509 s, 57.5 MB / s


3.创建swap文件
[root@joshua ~]# mkswap /var/swap
mkswap: /var/swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=eba0b718-b5d0-488f-a368-0af288def8b6

[root@joshua ~]# mkswap -f /var/swap
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=5039b019-2db5-41b2-a289-3caf4fdd98bf
[root@joshua ~]#


4. Load the file: 
[Joshua the root @ ~] # the swapon / var / swap
5. The swap to see if commencement
[@ mysql01 the root var] # Free 
6. The swap view the current status: 
[Joshua the root @ ~] # CAT / proc / swaps 
Filename the Type Size Used the Priority
/ var / File 2,047,996 the swap 0 -1

7. Add to the / etc / fstab, vim / etc / fstab

#
# /etc/fstab
# Created by anaconda on Thu Aug 24 12:21:20 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=1ae5f12f-79c1-47d4-bed7-941ab9385396 / ext4 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/var/swap swap swap defaults 0 0

8. If no longer needed swap, the partition can be cleaned: 
[Joshua the root @ ~] # The swapoff / var / the swap

Guess you like

Origin www.cnblogs.com/klb561/p/11241638.html
Recommended