Home > System Tutorial > LINUX > How to adjust swap size in Linux? Tips for expanding Linux swap partition

How to adjust swap size in Linux? Tips for expanding Linux swap partition

WBOY
Release: 2024-01-03 19:46:16
forward
1729 people have browsed it

Let me share with you how to expand the swap partition capacity in Linux.

First, use the fdisk -l command to check the size of the swap partition of the current system. The current size is 4G;

linux怎么调整swap大小? linux扩容swap分区的技巧

Edit the host settings and add a 10G hard disk .

linux怎么调整swap大小? linux扩容swap分区的技巧

linux怎么调整swap大小? linux扩容swap分区的技巧

Use the fdisk -l command again to check whether the newly added hard disk is recognized normally.

linux怎么调整swap大小? linux扩容swap分区的技巧

For the newly added hard disk partition, adjust the format to LVM

Use in sequence:

fdisk /dev/sdb --> n --> p --> 1 -->Enter->Enter--> t --> 8e --> p --> w

command.

linux怎么调整swap大小? linux扩容swap分区的技巧

Use partx /dev/sdb to view the newly formatted new hard disk

linux怎么调整swap大小? linux扩容swap分区的技巧

View pv, vg and lv status

#pvs #vgs #lvs

linux怎么调整swap大小? linux扩容swap分区的技巧

Create pv and check pv status

#pvcreate /dev/sdb1

#pvs

linux怎么调整swap大小? linux扩容swap分区的技巧

Add pv to vg and check pv and vg status

#vgextend centos /dev/sdb1

#pvs

#vgs

linux怎么调整swap大小? linux扩容swap分区的技巧

Expand lv, and check pv, vg and lv status:

#lvextend -l 100 %FREE /dev/mapper/centos-swap

#pvs #vgs #lvs

linux怎么调整swap大小? linux扩容swap分区的技巧

Check the system partition again. The swap partition has been expanded successfully.

#fdisk -l

linux怎么调整swap大小? linux扩容swap分区的技巧

The above is the detailed content of How to adjust swap size in Linux? Tips for expanding Linux swap partition. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template