Swap swap

First, view the current swap
[server0 the root @ ~] # -m Free
Total Free Shared Used BUFF / Cache Available
Mem: 489. 4 140 145 202 304
Swap: 0 0 0

[server0 the root @ ~] # the swapon -s
current system , there is no swap. If your system has, please observe the size, follow-up experiment will increase the size of the swap.

Second, increase the swap partition

1. Partitioning (ready to / dev / sde disk is divided into partitions 1G)
[the root server0 @ ~] # the fdisk / dev / sde (T 82 converts the partition ID)
[the root server0 @ ~] # the partprobe / dev / sde
[server0 the root @ ~] # LL / dev / SDE *
BRW -----RW. Disk the root. 1 253, dated 16 12 is 10:18. 6 / dev / SDE
BRW -----RW. Disk 253 the root. 1, dated 1712 10:18. 6 / dev / sde1,

2. format
[server0 the root @ ~] # the mkswap / dev / sde1,

3. mount
[root @ server0 ~] # blkid / dev / sde1 ( see No. UUID)
/ dev / sde1,: the UUID = "ea5b1c77-e540-463c-9644-0d75450f8b4c" the TYPE = "the swap"

[server0 the root @ ~] # Vim / etc / fstab (mount)
the UUID = "ea5b1c77-e540-463c-9644-0d75450f8b4c" 0 0 Defaults the swap the swap

[server0 the root @ ~] # the swapon -a (reading / etc / fstab)
[the root server0 @ ~] # the swapon -s
Filename the Priority the Type Size Used
/dev/vdb1 partition 524284 0 -1

Third, the tuning of the swap

1, on the swap priority

 Priority swap partition (Priority) using a descending order, the highest 32767, the lowest priority is 0

this set makes use of parallel Linux swap partition the same priority (Priority = Partition 1), which will significantly improve on read the swap. When these partitions is full, it will swap partition to use lower priority (Priority = Partition 0)

2, the priority setting swap

A plurality of switching partitions in different disks
when mounted, using the same priority

[server0 the root @ ~] # Vim / etc / fstab
the UUID = "ea5b1c77-e540-463c-9644-0d75450f8b4c" Defaults the swap the swap, PRI. 1 = 0 0
the UUID = "ea5b1c77-e540-465c-9644-0d75457f8b45" Defaults the swap the swap, PRI = 0 0. 1
PRI is the priority means, the same can be provided.

[server0 the root @ ~] # the swapon -a
[server0 the root @ ~] # the swapon -s
Filename the Type Size Used the Priority
/ dev / sdb1 Partition 0. 1 524284
/ dev / 0. 1 sdc1 Partition 524284

Note: When memory is not (about 4G ), the memory swap should be made twice

Guess you like

Origin www.cnblogs.com/zjz20/p/11295608.html