In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Linux how to view and modify the SWAP size, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1 View the size of swap space (total):
Total used free shared buffers cached Mem: 377 180 197 0 19 110-/ + buffers/cache: 50 327 Swap: 572 0572
2 View swap space (file (s) / partition (s)):
Include details of files and partitions
# swapon-s
Equivalent to
# cat / proc/swaps
3 add swap space
Two options: add a swap partition or add a swap file. It is recommended that you add a swap partition; however, if you do not have much free space available, add a swap file.
3.1 add a swap partition
The steps are as follows:
A use fdisk to create a swap partition (assuming / dev/sdb2 is a created swap partition)
B use the mkswap command to set the swap partition:
# mkswap / dev/sdb2
C enable swapping:
# swapon / dev/sdb2
D write / etc/fstab to enable at boot time:
/ dev/sdb2 swap swap defaults 0 0
3.2 add a swap file
A create a swap file with a size of 512m:
# dd if=/dev/zero of=/swapfile1 bs=1024k count=512
B use the mkswap command to set up the swap file:
# mkswap / swapfile1
C enable swapping:
# swapon / swapfile1
D write / etc/fstab to enable at boot time:
/ swapfile1 swap swap defaults 0 0
After adding a new swap partition and enabling it, check the output of the cat / proc/swaps or free command to make sure that the swap partition is enabled.
4 delete swap space:
A disable swapping:
# swapoff / dev/sdb2
B remove items from / etc/fstab
C use the fdisk or yast tool to delete the partition.
The steps for deleting the swap file are the same as above.
# free-m
Total used free shared buffers cached Mem: 377 180 197 0 19 110-/ + buffers/cache: 50 327 Swap: 572 0572
The Mem line shows memory usage from a system perspective. Total is the amount of memory available to the system, which is equal to the physical memory of the system minus the memory reserved by the kernel.
Buffers and cached are the memory that the system uses as buffers. Buffers is associated with a block device, contains file system metadata, and tracks block changes. Cache contains only the file itself.
The-/ + buffers/cache line displays memory information from the user's point of view, and the amount of available memory is equal to the mem row used column value minus the size of buffers and cached memory.
Because buffers and cached are set by the operating system to speed up the system, they can be used only for users when they need them.
Top displays the dynamic and real-time status of each process when the system is running (cpu, memory)
There are three columns VIRT RES SHR in the top, indicating the memory used by the process.
VIRT identifies the total amount of memory that the process can use, including the memory actually used by the process, mapped files, memory shared with other processes, and so on.
RES identifies the actual amount of memory consumed by the process.
SHR identifies the memory and library size that can be shared with other processes.
Vmstat shows memory usage
These commands read memory information from / proc/meminfo.
The meaning of the lines in / proc/meminfo is described in the Documentation/filesystems/proc.txt file of the kernel source code
The real memory size of the system can be seen with dmesg | grep [mM] [eE] [mM].
/ proc/pid/status displays the detailed status of a process\ # cat / proc/5346/statusName: bashState: s (sleeping) SleepAVG: 98%Tgid: 5346Pid: 5346PPid: 0Uid: 1000 1000 1000 1000Gid: 104104 104FDSize: 256Groups: 6 24 29 44 44 104 113 1000 1001VmPeak: 6528 kBVmSize: 6528 kBVmLck: 0 kBVmHWM: 1976 kBVmRSS: 1976 kBVmData: 752 kBVmStk: 84 kBVmExe: 644 kBVmLib: 1788 kBVmPTE: 16 kBThreads: 1SigQ: 0/4294967295SigPnd: 0000000000000000ShdPnd: 0000000000000000SigBlk: 0000000000000000SigIgn: 0000000000384004SigCgt: 000000004b813efbCapInh: 0000000000000000CapPrm: 0000000000000000CapEff: 000000000000
VmSize is the total memory size of the process, which is the same as the VIRT in the top output.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.