Linuxswap partition control (lvm management of swap partitions)

Source: Internet
Author: User
Linux swap partition control (swap partition lvm management) Note: Linux swap partition uses lvm management. you can use the following method to view swaplv [root @ testdb ~] Vgdisplay-vFindingallvolumegroupsFindingvolume linux swap partition control (swap partition lvm management)
Note: linux swap partitions are managed by lvm. the following method can be used for control. 1. View swap lv [root @ testdb ~] # Vgdisplay-v Finding all volume groups Finding volume group "VolGroup" --- Volume group --- VG Name VolGroup System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable max lv 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 357.38 GiB PE Size 4.00 MiB Total PE 91489 Alloc PE/Size 34512/134 .81 GiB Free PE/Size 56977/222 .57 GiB vg uuid q6q2 Yf-Isfw-DnkL-JeSN-uTvC-l5m2-M0HEco --- Logical volume --- LV Path/dev/VolGroup/lv_root LV Name lv_root VG Name VolGroup lv uuid volume LV Write Access read/write LV Creation host, time localhost. localdomain, 08:41:58 + 0800 LV Status available # open 1 LV Size 29.30 GiB Current LE 7500 Segments 1 Allocation inherit Read ahead sectors auto-currently set To 256 Block device 252: 0 --- Logical volume --- LV Path/dev/VolGroup/lv_swap LV Name lv_swap VG Name VolGroup lv uuid OJaxbf-MPay-cjep-L44c-UKDx-ZmGW-v24yUf LV Write Access read/write LV Creation host, time localhost. localdomain, 08:42:00 + 0800 LV Status available # open 2 LV Size 7.86 GiB Current LE 2012 Segments 1 Allocation inherit Read ahead sectors auto-currently set to 256 Blo Ck device 252: 1 --- Logical volume --- lvpath/dev/VolGroup/lv_home LV Name lv_home VG Name VolGroup lv uuid HZvOuv-G8NW-2ZyW-3Ffl-H54i-Kmjp-8ndVqo LV Write Access read/write LV Creation host, time localhost. localdomain, 08:42:01 + 0800 LV Status available # open 1 LV Size 97.66 GiB Current LE 25000 Segments 1 Allocation inherit Read ahead sectors auto-currently set to 256 Block devic E 252: 2 --- Physical volumes --- PV Name/dev/sda2 pv uuid gQvj3L-kOPV-LILA-KPnD-a8W9-lgdE-09vtlQ PV Status allocatable Total PE/Free PE 91489/56977 swap partition lv for/dev/VolGroup/lv_swap II. expand swap partition close swap partition [root @ testdb ~] # Swapoff/dev/VolGroup/lv_swap [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 14682 1398 0 83 13680-/+ buffers/cache: 919 15162 Swap: 0 0 0 expansion/dev/VolGroup/lv_swap, add 8336 M [root @ testdb ~] # Lvextend-L + 8336 M/dev/VolGroup/lv_swap Extending logical volume lv_swap to 16.28 GiB Logical volume lv_swap volume resized set/dev/VolGroup/lv_swap to swap partition [root @ testdb ~] # Mkswap/dev/VolGroup/lv_swapmkswap:/dev/VolGroup/lv_swap: warning: don't erase bootbits sectors on whole disk. use-f to force. setting up swapspace version 1, size = 17072124 KiBno label, UUID = f5fa0e85-da9e-440c-8f1c-e3ab978c9d6b [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 14683 1398 0 83 13680-/+ buffers/cache: 918 15162 Swap: 0 0 0 start swap partition [root @ testdb ~] # Swapon/dev/VolGroup/lv_swap [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 14695 1386 0 83 13680-/+ buffers/cache: 931 15150 16671 Swap: 16671 0 III. reduce swap partition close swap partition [root @ testdb ~] # Swapoff/dev/VolGroup/lv_swap [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 15141 940 0 255 13953-/+ buffers/cache: 932 15149 Swap: 0 0 0 decrease/dev/VolGroup/lv_swap 8000 M [root @ testdb ~] # Lvreduce-L-8000 M/dev/VolGroup/lv_swap WARNING: switching active logical volume to 8.47 GiB this may destroy your data (filesystem etc.) Do you really want to reduce lv_swap? [Y/n]: y Cing logical volume lv_swap to 8.47 GiB Logical volume lv_swap successfully resized [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 15143 938 0 256 13955-/+ buffers/cache: 931 15149 Swap: 0 0 0 set/dev/VolGroup/lv_swap to swap partition [root @ testdb ~] # Mkswap/dev/VolGroup/lv_swapmkswap:/dev/VolGroup/lv_swap: warning: don't erase bootbits sectors on whole disk. use-f to force. setting up swapspace version 1, size = 8880124 KiBno label, UUID = 1951f318-e2eb-45d5-b1ed-25a2bf87adea [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 15142 938 0 256 13955-/+ buffers/cache: 931 15150 Swap: 0 0 0 enable swap partition [root @ testdb ~] # Swapon/dev/VolGroup/lv_swap [root @ testdb ~] # Free-m total used free shared buffers cachedMem: 16081 15149 932 0 256 13955-/+ buffers/cache: 937 15143 8671 Swap: 8671 0 [root @ testdb ~] #
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.