Detailed allocation of swap partition in Linux

>>> Linux tutorial directory <<<

File system management -4.1 assign swap partition

Write in the front: If you finish the inspection by yourself, there may be some mistakes. If you find something wrong, you can leave a message or private message me below.

1. The free command

  • free
    • View memory and swap partition usage
  • cached (cache): refers to storing the read data in the memory, when reading again, without reading the hard disk and directly reading from the memory, speeding up the data reading process
  • buffer (buffer): refers to the storage of scattered write operations in the memory when writing data, and when it reaches a certain degree, it is concentrated on the hard disk, reducing disk fragmentation and repeated seek of the hard disk (that is, reading time ), Speeding up the data writing process

2. Create a new swap partition

  • fdisk /dev/sdb
  • The partition ID should be changed to 82

3. Format

  • mkswap /dev/sdb6

4. Join the swap partition

  • swapon / dev / sdb6 (add swap partition)
  • swapoff / dev / sdb6 (cancel swap partition)

5. The swap partition is automatically mounted at boot

  • vi /etc/fstab
  • /dev/sdb6 swap swap defaults 0 0
  • mount -a

Write in the back: I hope these explanations will be helpful to you, I hope everyone will like and pay attention to it. Your support is my biggest motivation (๑> ؂ <๑)

Published 366 original articles · praised 68 · 50,000+ views

Guess you like

Origin blog.csdn.net/qq_43479432/article/details/105655628