====== Add New Partitions And Logical Volumes And Swap To A System Non-destructively ====== **General Information** Different methods of adding swap. ---- ===== Swap with Logical Volumes ===== Create new partition with the Logical Volume type fdisk /dev/sdb n Partition type: primary Partition number: 1 First sector: default Last sector: +1G t Hex code: 8e w \\ Setup LVM physical volume, volume group, logical volume pvcreate /dev/sdb1 vgcreate vglocal /dev/sdb1 lvcreate -n lvswap -L 1G vglocal \\ Format logical volume with swap, enable, and add to fstab mkswap /dev/mapper/vglocal-lvswap swapon /dev/mapper/vglocal-lvswap vim /etc/fstab /dev/mapper/vglocal-lvswap swap swap sw 0 0 ---- ===== Swap with Physical Partition ===== Create physical disk partition for swap fdisk /dev/sdb n Partition type: primary Partition number: 2 First sector: default Last sector: +1G t Hex code: 82 w * Hex code 82 is Linux Swap \\ Create the swap filesystem mkswap /dev/sdb2 swapon /dev/sdb2 * edit /etc/fstab if you want persistent changes \\ View swap space swapon -s \\ Activate all swap on /etc/fstab swapon -a * Turn off swap with: swapoff /dev/ or swapoff -a ----