Linux Swap Partition Setup – Don't Make This Mistake
Topics covered in this videos: How to creating a swap partition How to Format the partition with swap file system how to Turn on/turn off the newly created swap space How to removing the SWAP Partition Commands to be used in maintaining Swap spaces MANAGING PARTITIONS & FILE SYSTEMS Creating a Swap Partition: Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory. Recommended System Swap Space: Amount of RAM in the System Recommended Amount of Swap Space 4GB of RAM or less a minimum of 2GB of swap space 4GB to 16GB of RAM a minimum of 4GB of swap space 16GB to 64GB of RAM a minimum of 8GB of swap space 64GB to 256GB of RAM a minimum of 16GB of swap space 256GB to 512GB of RAM a minimum of 32GB of swap space The Basic Rule for the Size of SWAP: Apart from the above recommendation a basic rule is applied to create the swap partitions • if the size of the RAM is less than or equal to 2GB, then size of SWAP=2 X RAM SIZE • If the size of the RAM is more than 2GB, then size of SWAP= 2GB + size of the RAM Swap space is compulsory to be created at the time of installation. But, additional swap spaces can be created and deleted at any point of time, when it is required. Sometimes we need to increase the swap space, so we create additional swap spaces which will be added to the existing swap space to increase the size. Commands to be used in maintaining Swap spaces: To see the memory size and the swap space size #free –m (or) free -h To see used swap devices #swapon –s To format the partition with swap file system use #mkswap parititon name To deactivate the swap space use #swapoff partition name #lsblk (To check whether swap is OFF or not) To activate the swap space use #swapon partition name #lsblk (To check whether swap is ON or not) How to create swap partition: Follow the below steps to create swap memory: 1.fdisk /dev/sda 1.1 Command (m for help): p 1.2 Command (m for help): n - Select (default p) : p - Selected partition 3 - First sector (616448-83886079, default 616448): - Last sector, +sectors or +size{K,M,G,T,P} (616448-6907903, default 6907903): 1.3 Command (m for help): l (letter L) 1.4 Command (m for help): t 1.5 Partition number (1-5, default 5): 1 1.6 Hex code (type L to list all codes): 82 1.7 Command (m for help): w 2. #partprobe /dev/sda1 (Update the partition table using partprobe ) 3. #mkswap /dev/sda2 (Format the partition with swap file system) 3. #reboot -f 4. #swapon -s 5. #lsblk (to check the swap is ON or not) Format the partition with swap file system #mkswap /dev/sda6 Turn on the newly created swap space and verify it. #swapon /dev/sda6 Make an entry in fstab: Making the Newly Created SWAP Partition to mount after reboot. In order to make the swap partition mount automatic after reboot, we need to make an entry in /etc/fstab file. #vim /etc/fstab Removing the SWAP Partition: 1. Deactivate the swap partition #swapoff device name 2. Remove the entry from /etc/fstab. UUID=32609489-1625-40fc-ba7e-830436386dd6 swap swap defaults 0 0 3. Delete the partition through fdisk 3.1 fdisk /dev/sda 3.2 Command (m for help): d 3.3 Select (default p) : 1 3.4 Selected partition 2 3.5 First sector (616448-83886079, default 616448): 3.6 Last sector, +sectors or +size{K,M,G,T,P} (616448-6907903, default 6907903): 3.7 Command (m for help): w 4. #partprobe /dev/sda1 (Update the partition table using partprobe ) 5. #lsblk (to check the swap is OFF or not) #LinuxPartitions #LinuxFileSystem #DiskManagement #LinuxAdministration #PartitioningLinux linux mint,linux mint swap,linux swap,linux swap file,linux swap memory,linux swap partitions,linux swap space,linux swappiness,linux tutorial,mkswap,redhat linux,swap,swap in linux,swap linux,swap memory,swap memory in linux,swap partition,swap partition in linux,swap space,swapon,virtual memory,swappiness,linux swap partition,how to increase swap memory in linux,swap space in linux,what is swap space,linux,Linux Swap vs Windows Paging: The TRUTH,Unveiling the Secrets of Linux Partitions: Expert Guide,how to create swap partition in linux,linux swap size,do i need swap partition,The Swap Mistake Every Linux User Makes,Linux Swap Partition Setup – Don't Make This Mistake
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.