Linux virtual memory problems-Linux Enterprise applications-Linux server application information, the following is a detailed description. Linux virtual memory problems
?? Recently, because snort is installed on linux, mysql automatically exits every day.
?? The error message is as follows:
?? Out of Memory: Killed process 18353 (mysqld)
?? I started to think that my mysql server was not secure, leading to hacker overflow ~~~, Crazy check. However, this is still the case.
?? Later I suspected it was my memory problem. RAM128M was poor after all!
?? Free-m
?? Idle memory is about 1 MB
?? But I still know that linux will use virtual memory. It should not cause the process to crash. I found some information on the Internet and found that my virtual memory was not set.
?? Swapon-s
?? No available memory displayed
??
?? I found some information on the Internet and finally got some results.
?? Example:
?? -----------------------------------
?? # Dd if =/dev/zero of = swapfile bs = 1024 count = 8192
??
?? # Mkswap swapfile 8192
??
?? # Sync
??
?? # Swapon swapfile
?? ----------------------------------
?? Explanation:
?? Dd if =/dev/zero of =/swap bs = 1024 count = 131070
??
?? /Swap for file name count for file size
??
??
?? Mkswap command to create a swap Partition
?? Mkswap creates a linux swap zone on a device or in a file.
?? Be careful when using mkswap because it does not check whether the file or partition is used by other things. You may use mkswap to easily overwrite important files and partitions! Fortunately, you only need to use mkswap when installing the system, and then you can follow the file size, in the unit of block.
?? Mkswap/swap
??
?? Swapon/swap
?? Enable/swap as virtual memory
??
?? Swapoff/swap
?? // Disable swap as virtual memory
?? Rm/swap // delete a file
??
??
?? If the swap space is included in/etc/fstab, it can be used automatically.
??
?? /Dev/hda8 none swap sw 0 0
?? /Swapfile none swap sw 0 0
??
?? Appendix:
?? Dd is a very useful command in Linux/UNIX. It is used to copy an object with a specified size block and perform the specified conversion at the same time.
??
?? Main options of dd:
?? If the following column ends with a specified number, multiply it by the corresponding number:
?? B = 512, c = 1, k = 1024, w = 2, xm = number m
??
?? If = file
?? Input File name. The default value is standard input.
??
?? Of = file
?? Output file name. The default value is standard output.
??
?? Ibs = bytes
?? Read bytes at a time (that is, the size of a block is bytes ).
??
?? Obs = bytes
?? Write bytes at a time (that is, the size of a block is bytes ).
??
?? Bs = bytes
?? Set the size of the read/write block to bytes, which can replace ibs and obs.
??
?? Cbs = bytes
?? Bytes are converted at a time, that is, the size of the conversion buffer.
??
?? Skip = blocks
?? The blocks are skipped from the beginning of the input file and then copied.
??
?? Seek = blocks
?? The blocks are skipped from the beginning of the output file and then copied. (Usually only valid when the output file is a disk or tape)
??
?? Count = blocks
?? Copy only blocks. The block size is equal to the number of bytes specified by ibs.
??
?? Conv = conversion [, conversion...]
?? Use the specified parameter to convert the file.
??
?? Conversion parameters:
??
?? Ascii conversion EBCDIC is ASCII.
??
?? Ebcdic converts ASCII to EBCDIC.
??
?? IBM converts ASCII to alternate EBCDIC.
??
?? Block converts each row to a record with a length of cbs. The missing part is filled with spaces.
??
?? Unblock
?? Make the length of each line be cbs, and fill the remaining part with spaces.
??
?? Lcase converts uppercase to lowercase.
??
?? Ucase converts lowercase to uppercase.
??
?? Swab exchanges each pair of input bytes. Unlike
?? Unix dd, this works when an odd number
?? Bytes are read. If the input file contains
?? An odd number of bytes, the last byte is
?? Simply copied (since there is nothing
?? Swap it ).
??
?? Noerror
?? Do not stop when an error occurs.
??
?? Notrunc
?? The output file is not truncated.
??
?? Sync fills each input block into ibs bytes, and the missing part is filled with null (NUL) characters.
??
?? Since the dd command allows binary read/write, it is particularly suitable for input/output on the original physical device. For example, you can use the following command to create an image file for a floppy disk:
?? Dd if =/dev/fd0 of = disk. img bs = 1440 k
?? Interestingly, this image file can be read by tools such as HD-Copy and Winimage. Another example is to save the first 512 bytes of the first hard disk as a file:
?? Dd if =/dev/hda of = disk. mbr bs = 512 count = 1
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