Two new methods for creating SWAP space in Linux

Source: Internet
Author: User
Article Title: Two new methods for creating SWAP space in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

LinuxOfSWAPThere are two ways to create a space: partition and file.SWAPSpace can be provided by partitions and files!

Partition type:

1. Use partitionsSWAPPrepare an unused partition, for example:/Dev/hdd4This partition usesFdiskToolTTo modify the tag of the partition.82

2.UseMkswapTool format.

For example:

[Root @ RAID/] # mkswap/dev/hdd4

3. UseSwaponCommand activation/Dev/hdd4This partition is usedSWAP

For example:

[Root @ RAID/] # swapon/dev/hdd4

4.  UseSwapon -SCheck whether it is used.

For example:

[Root @ RAID/] # swapon-s FilenameTypeSizeUsed /Dev/mapper/VolGroup00-LogVol01Partition327672680 /Dev/hdd4Partition3628720

File Type:

1.UseDdCommand to createSWAPFile

For example:

[Root @ RAID/] # dd if =/dev/zero of =/nihao123 bs = 1 M count = 100

100 + 0 records in

100 + 0 records out

If--Device that generates this empty file

Of --Name of the file to be generated

Bs--Size of each group

Mount--Total rent,BsXcount = SWAP!!!

2.Format the generated file/Nihao123

For example:

Mkswap/nihao123

3.UseSwaponCommand activationSWAP

For example:

Swapon/nihao123

Other related commands:

Swapoff?? Disabled, function andSwaponOn the contrary.

Swapon -S?? View

Boot LoadingSWAP, Modify/Etc/fstab

For example:

# This file is edited by fstab-sync-see 'man fstab-sync' for details /Dev/VolGroup00/LogVol00/Ext3Ults1 1 LABEL =/boot/BootExt3Ults1 2 None/Dev/ptsDevptsGid = 5, model = 6200 0 None/Dev/shmTmpfsUlts0 0 None/ProcProcUlts0 0 None/SysSysfsUlts0 0 /Dev/VolGroup00/LogVol01 swapSwapUlts0 0 /Nihao123SwapSwapUlts0 0

Note that both areSwap,Both are0!!!

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.