How to Create a swap partition in an OpenStack Virtual Machine instance

Source: Internet
Author: User
Tags mapr

In the test group, a student is responsible for setting up MapR. In the MapR document, we recommend that each node have at least 24 GB of swap partitions. I don't know why MapR has such anti-human suggestions ...... Swap is nothing more than a disk space for sequential read/write. Does it save memory usage and improve efficiency with swap? Maybe it uses swap to store temporary map-reduce files?

However, we have to follow this advice. After all, we are not familiar with MapR.

To make the OpenStack instance have swap partitions, you can add them to the image, but it is very troublesome and it is difficult to get dozens of GB of swap, so the image will be very large.

Another method is as follows:

1. install necessary software

Mkfs. ext4 and parted are not found in our streamlined CentOS. Therefore, to install e4fsprogs and parted, generally centos has been installed. Set the software source:

# Yum update
# Yum install parted
# Yum install e4fsprogs

2. Create partitions and file systems

The vda in the instance is the root file system provided by openstack, which has a system. Therefore, you can only partition vdb, that is, ephemeral storage, and create a file system:

# Parted/dev/vdb -- script "mktable gpt"
# Parted/dev/vdb -- script "mkpart primary 1024KB 48 GB"
# Parted/dev/vdb -- script "mkpart primary 48 GB-1"
# Ls/dev | grep vdb
# Mkswap/dev/vdb1
# Mkfs. ext4/dev/vdb2

Here, ephemeral disk (vdb) is set to 500 GB in flavor, and swap is allocated 48 GB. The rest is allocated to vdb2.

3. Modify fstab

Change/etc/fstab to the following content:

/Dev/vda/ext4 defaults 0 0
/Dev/vdb1 swap defaults 0 0
/Dev/vdb2/opt ext4 defaults 0 0

Restart the instance or mount all.

Use free to check if swap is 48 GB

OpenStack monitoring-integrated Nagios survey summary

Install OpenStack Nova in CentOS 6.4

Use OpenStack HP to push Cloud OS Cloud Operating System

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.