Rabu, 24 April 2019

How to resize swap disk redhat 7.3 lvm

  Tidak ada komentar
Before we resize the swap partition, resize the swap lvm first, make sure you have enough volume group
[[email protected] ~]# pvscan
  PV /dev/sda3   VG rhel            lvm2 [18.99 GiB / 0    free]
  Total: 1 [18.99 GiB] / in use: 1 [18.99 GiB] / in no VG: 0 [0   ]
[[email protected] ~]#
[[email protected] ~]# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[[email protected] ~]#
[[email protected]yhost ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda3  rhel lvm2 a--  48.99g 30.00g
[[email protected] ~]#
[[email protected] ~]# lvs
  LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- 16.99g
  swap rhel -wi-ao----  2.00g
[[email protected] ~]#
Extend the lvm
[[email protected] ~]# lvextend -L +27G /dev/rhel/root
  Size of logical volume rhel/root changed from 16.99 GiB (4350 extents) to 43.99 GiB (11262 extents).
  Logical volume rhel/root successfully resized.
[[email protected] ~]#
[[email protected] ~]# lvextend -L +2G /dev/rhel/swap
  Size of logical volume rhel/swap changed from 2.00 GiB (512 extents) to 4.00 GiB (1024 extents).
  Logical volume rhel/swap successfully resized.
[[email protected] ~]#
[[email protected] ~]# lvs
  LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root rhel -wi-ao---- 43.99g
  swap rhel -wi-ao----  4.00g
[[email protected] ~]#

Check the block disk
[[email protected] ~]# lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda             8:0    0  50G  0 disk
├─sda1          8:1    0   4M  0 part
├─sda2          8:2    0   1G  0 part /boot
└─sda3          8:3    0  49G  0 part
  ├─rhel-root 253:0    0  44G  0 lvm  /
  └─rhel-swap 253:1    0   4G  0 lvm  [SWAP]
sr0            11:0    1   3G  0 rom
[[email protected] ~]#
Check the swap size
[[email protected] ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       2097088 0       -1
[[email protected] ~]#
Turn off the swap
[[email protected] ~]# swapoff -v /dev/rhel/swap
swapoff /dev/rhel/swap
[root[email protected] ~]#
Make swap
[[email protected] ~]# mkswap /dev/rhel/swap
mkswap: /dev/rhel/swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 4194240 KiB
no label, UUID=07620b10-fc56-429f-a433-4caa67594d47
[[email protected] ~]#
Check the swap
[[email protected] ~]# swapon -va
swapon /dev/mapper/rhel-swap
swapon: /dev/mapper/rhel-swap: found swap signature: version 1, page-size 64, same byte order
swapon: /dev/mapper/rhel-swap: pagesize=65536, swapsize=4294967296, devsize=4294967296
[[email protected] ~]#
Check the swap size
[[email protected] ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       4194240 0       -1
[[email protected] ~]#

Tidak ada komentar :

Posting Komentar