Blog
How to create a swap partition in Linux
- October 15, 2022
- Posted by: sayali@learnomate.org
- Category: Uncategorized
How to create a swap partition in Linux ?
1. Run the following command to create a file of 1 GB, for example:
# dd if=/dev/zero of=/swapfile bs=1M count=1000
2. Run the following command to modify the file permissions :
# chmod 600 /swapfile
3.Run the following command to configure the file as swap space:
# mkswap /swapfile
4.Run the following command to activate the swap file:
# swapon /swapfile
5. To mount the swap partition automatically upon system startup, add an entry for the swap file to /etc/fstab.
# echo "/swapfile swap swap defaults 0 0" >>/etc/fstab
6. Run the following command to mount the swap partition:
# mount -a
How to create a swap partition in Linux ?
1. Run the following command to create a file of 1 GB, for example:
# dd if=/dev/zero of=/swapfile bs=1M count=1000
2. Run the following command to modify the file permissions :
# chmod 600 /swapfile
3.Run the following command to configure the file as swap space:
# mkswap /swapfile
4.Run the following command to activate the swap file:
# swapon /swapfile
5. To mount the swap partition automatically upon system startup, add an entry for the swap file to /etc/fstab.
# echo "/swapfile swap swap defaults 0 0" >>/etc/fstab
6. Run the following command to mount the swap partition:
# mount -a