Linux Extended Swap partition

Source: Internet
Author: User

Swap partition Management

First, view the current swap partition

[Email protected] ~]# free-m

Total used free shared buffers Cached

mem:1841 519 1322 16 0 213

-/+ buffers/cache:304 1536

swap:0 0 0

[Email protected] ~]# swapon-s

Second, increase the swap partition

can be a partition, LVM,File

= = = Partition = = =

1. Preparing Partitions

[[email protected] ~]# Fdisk/dev/vdb (t conversion partition ID 82)

[Email protected] ~]# PARTPROBE/DEV/VDB

[Email protected] ~]# ll/dev/vdb*

BRW-RW----. 1 root disk 253, 6 10:18/dev/vdb

BRW-RW----. 1 root disk 253, 6 10:18/dev/vdb1

2. Initialize

[Email protected] ~]# MKSWAP/DEV/VDB1

3. Mounting

[Email protected] ~]# BLKID/DEV/VDB1

/dev/vdb1:uuid= "ea5b1c77-e540-463c-9644-0d75450f8b4c" type= "swap"

[Email protected] ~]# Vim/etc/fstab

Uuid= "ea5b1c77-e540-463c-9644-0d75450f8b4c" swap swap default 0 0

[[email protected] ~]# swapon-a ( read /etc/fstab)

[Email protected] ~]# swapon-s

Filename Type Size used priority

/DEV/VDB1 Partition 524284 0-1

===file===

[Email protected] ~]# df-th

Filesystem Type Size used Avail use% mounted on

/DEV/VDA1 xfs 10G 3.3G 6.8G 33%/

[[email protected] ~]# dd If=/dev/zero of=/swap2.img bs=1m count=512

Or

[[email protected] ~]# dd </dev/zero >/swap2.img bs=1m count=512

[Email protected] ~]# mkswap/swap2.img

[Email protected] ~]# Vim/etc/fstab

/swap2.img Swap swap default 0 0

[Email protected] ~]# swapon-a

Swapon:/swap2.img:insecure permissions 0644, 0600 suggested.

[Email protected] ~]# chmod 600/swap2.img

[Email protected] ~]# swapon-a

[Email protected] ~]# swapon-s

Filename Type Size used priority

/DEV/VDB1 Partition 524284 0-1

/swap2.img file 524284 0-2

Third, the exchange of sub-tune excellent

Multiple swap partitions are distributed across different disks

When mounted, use the same priority level

[Email protected] ~]# Vim/etc/fstab

Uuid= "ea5b1c77-e540-463c-9644-0d75450f8b4c" swap swap default,pri=1 0 0

Uuid= "Ea5b1c77-e540-465c-9644-0d75457f8b45" swap swap default,pri=1 0 0

[Email protected] ~]# swapoff-a

[Email protected] ~]# swapon-s

[Email protected] ~]# swapon-a

[Email protected] ~]# swapon-s

Filename Type Size used priority

/DEV/SDB1 Partition 524284 0 1

/DEV/SDC1 Partition 524284 0 1


This article is from the "technical Discrimination" blog, please be sure to keep this source http://emg2012.blog.51cto.com/3705315/1613301

Linux Extended Swap partition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.