In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "the usage of the Linux basic command swapon". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Swapon
Enables the swap partition on the specified device, and the device or file used is provided by the dedicated file parameter. It can be "- L label" or "- U UUID" to indicate the label or UUID of a device. Calls to swapon usually occur in the system boot script, making all switching devices available, so paging and swapping activities intersect between multiple devices and files.
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Swapon-s [- h] [- V]
Swapon [- f] [- p priority] [- v] specialfile...
Swapon-a [- e] [- f] [- v]
2. List of options
Option
Description
-V |-- version
Display version information
-h |-- help
Show help documentation
-v |-- verbose
Display details during execution
-a |-- all
Open all swap partitions. All devices marked "swap" in "/ etc/fstab" are available except those with the "noauto" option. Devices that have been used for exchange will be quietly skipped.
-e |-- ifexists
Skip devices that do not exist
-f |-- fixpgsz
If the page size of the swap space does not match the currently running kernel, reinitialize (exec/sbin/mkswap). Mkswap (2) initializes the entire device without checking for error blocks.
-L label
Start the swap partition of the specified label, which requires access to the / proc/ partition.
-p
Set priority 032767. The larger the number, the higher the priority. Add "pri=value" to the "/ etc/fstab" option field used with "swapon-a".
-s |-- summary
Displays a summary of switching purposes by device, equivalent to "cat / proc/swaps"
-U uuid
Start the swap partition of the specified uuid
3. Description
You should not use swapon on vulnerable files. Swapping NFS may not work. Swapon automatically detects and suspends data rewriting swap space signatures with old software (for example, S1SUSPENDjournal S2SUSPENDmt.). The problem is that if we don't, we will have data corruption the next time we try to unsuspend.
4. Examples
1) start sdb4
[root@localhost ~] # swap / / create a swap partition
Setting up swapspace version 1, size = 16380 KiB
LABEL=wj, UUID=aec14728-0f33-4676-8bef-612ea1bdf985
[root@localhost ~] # swapon / dev/sdb4 / / enable swap partition
[root@localhost ~] # swapon-s / dev/sdb4 / / View information
Filename Type Size Used Priority
/ dev/sdb4 partition 16376 0-1
[root@localhost ~] #
2) start in the form of a label
[root@localhost ~] # blkid-c / dev/null / / find the UUID of the swap partition
Dev/sda1: UUID= "059facc9-c58e-42d0-b8f5-7644c4574888" TYPE= "ext4"
Dev/sda2: UUID= "z3WRza-EIUl-dib9-7CGq-zRYt-DMdL-jT2ld9" TYPE= "LVM2_member"
/ dev/mapper/VolGroup-lv_root: UUID= "9ad51e8e-3700-45a8-a195-531a95ff717d" TYPE= "ext4"
/ dev/mapper/VolGroup-lv_swap: UUID= "2ebcaf57-3c6a-45be-8f34-3326d1fa1762" TYPE= "swap"
[root@localhost ~] # free / / View
Total used free shared buffers cached
Mem: 1659316 1601620 57696 0 261664 1075780
-/ + buffers/cache: 264176 1395140
Swap: 0 0 0
[root@localhost ~] # swapon-U 2ebcaf57-3c6a-45be-8f34-3326d1fa1762 / / start the swap partition
[root@localhost ~] # free / / View
Total used free shared buffers cached
Mem: 1659316 1604132 55184 0 261684 1075780
-/ + buffers/cache: 266668 1392648
Swap: 2940920 0 2940920
[root@localhost ~] #
This is the end of the introduction to "the usage of the Linux basic command swapon". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.