linux : removing swap space

reducing swap on an LVM2 logical volume
to reduce an LVM2 swap logical volume (ex. /dev/swap is the volume you want to extend):

  1. disable swapping for the associated logical volume:

    swapoff -v /dev/swap
  2. reduce the LVM2 logical volume by 512 MB:

    lvm lvreduce /dev/swap -L -512M
  3. format the new swap space:

    mkswap /dev/swap
  4. enable the extended logical volume:

    swapon -va
  5. test that the logical volume has been reduced properly:

    cat /proc/swaps
    free

removing an LVM2 logical volume for swap
to remove a swap volume group (assuming /dev/swap is the swap volume you want to remove):

  1. disable swapping for the associated logical volume:

    swapoff -v /dev/swap
  2. remove the LVM2 logical volume of size 512 MB:

    lvm lvremove /dev/swap
  3. remove the following entry from the /etc/fstab file:

    /dev/swap   swap     swap    defaults     0 0
  4. test that the logical volume has been extended properly:

    cat /proc/swaps
    free

removing a swap file

  1. at a shell prompt as root, execute the following command to disable the swap file (where /swapfile is the swap file):

    swapoff -v /swapfile
  2. remove its entry from the /etc/fstab file.

  3. Remove the actual file:

    rm /swapfile
Previous
Previous

aws ec2 : mount: wrong fs type, bad option, bad superblock on /dev/xvdf

Next
Next

iMovie doesn’t work with my images