Resize the swap partition under Linux

Source: Internet
Author: User
Tags uuid

CentOS and Redhat Adjust the size of the Exchange partition is the same way, I have done;

The first step, you want to make sure that there is enough space on your disk to do swap partition, swap partition really find an empty space on the disk to simulate into memory, when the memory is not enough, put some unimportant content into the swap partition, so, execute some free-h command, Make sure some of your disks are airborne!

First, or confirm the size of your swap partition

[Email protected] ~]# free-m

Total used free shared buffers Cached

mem:988 137 851 0 10 49

-/+ buffers/cache:76 911

swap:1983 0 1983


Step two, start making swap partitions

1. Fill a 1G space in/tmp

[[Email protected] ~] #dd if=/dev/zero of=/tmp/swap bs=1mb count=1024

2. Make swap partition

[Email protected] ~]# Mkswap/tmp/swap

Mkswap:/tmp/swap:warning:don ' t erase bootbits sectors

On whole disk. Use-f to force.

Setting up Swapspace version 1, size = 999996 KiB

No label, uuid=d52e8354-3784-4468-aed5-8fcd2d8d554f

3, swap partition is required to activate, not you say is the Yo!

[Email protected] ~]# Swapon/tmp/swap

4, mount the swap partition, let it boot from the boot

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

/DEV/MAPPER/VG_CENTOS2-LV_ROOT/EXT4 Defaults 1 1

Uuid=416d2b88-9e18-49b5-a5f7-3a34b4824216/boot EXT4 Defaults 1 2

/dev/mapper/vg_centos2-lv_swap swap swap defaults 0 0

/tmp/swap swap swap defaults 0 0

TMPFS/DEV/SHM TMPFS Defaults 0 0


5. Confirm again if the swap partition is really successful.

[Email protected] ~]# free-h

Total used free shared buffers Cached

mem:988m 925M 63M 240K 4.8M 819M

-/+ buffers/cache:100m 888M

swap:2.9g 0B 2.9G

OK, swap partition This is the creation of the complete, small partners, work together!

Resize the swap partition under Linux

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.