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!!!