• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Move Swap From Disk Partition to LVM Volume in Linux

by admin

There is no command or method exists that allows you to move swap space from one location to another. You can turn off the current swap space with swapoff command in the original location.

1. Turn swapoff on old disk:

# swapoff /dev/device
Note – Assuming there is free space in volume group, we will continue with LVM volume creation. Also, ensure that you do this when you have a maintenance window. (All applications are not running)

2. Create LVM Partition:

# lvcreate -L  -n logical_volume vol_group

3. Format the new swap space:

# mkswap /dev/[vg_name]/[lv_name]

4. Test that the swap has been created on logical volume.

# cat /proc/swaps

5. Enable the extended logical volume:

# swapon /dev/[vg_name]/[lv_name]

6. Add the swap entry in /etc/fstab.

Filed Under: Linux

Some more articles you might also be interested in …

  1. e2label: command not found
  2. CentOS / RHEL : How to assemble a software RAID in Rescue mode
  3. apache2ctl Command Examples in Linux
  4. eyeD3 Command Examples in Linux
  5. cryptsetup Command Examples in Linux
  6. asterisk: command not found
  7. whois Command Examples in Linux
  8. How to block non-root user from creating crontab entry in Linux
  9. CentOS / RHEL 6,7 : How to enable or disable XDMCP service (GDM)
  10. /var/log/chrony Directory Empty in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • qtile: command not found
  • qtile Command Examples in Linux
  • qtchooser Command Examples in Linux
  • qtchooser: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright