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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. How to set “max_report_luns” and “max_luns” on CentOS/RHEL 7 to scan more than 16,383 LUNs
  2. shred Command Examples in Linux
  3. createrepo: command not found
  4. dig Command Examples in Linux
  5. Linux OS Service ‘rpcidmapd’
  6. ffsend: Easily and securely share files from command-line
  7. How to Change runlevels/targets using systemd in Ubuntu
  8. apt-file Command Examples in Linux
  9. git delta: List files that differ from another branch
  10. How to set nproc (Hard and Soft) Values in CentOS / RHEL 5,6,7

You May Also Like

Primary Sidebar

Recent Posts

  • “glab pipeline” Command Examples
  • “glab mr” Command Examples
  • “glab mr merge” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright