Swap Files (If the ram is not enough)
- Stefan
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 20
- Thank you received: 0
12 years 2 weeks ago #6811
by Stefan
Swap Files (If the ram is not enough) was created by Stefan
I guess many know this already, but it recently helped me with a lot of problems,
and I guess there are many who don't know how to work with swap on Linux.
So I give a short Howto on Swap-Files
Do the following steps in a terminal:
Thats it. For further reading i Refer to my source in the Arch Linux Wiki
Hope that helps some people!
and I guess there are many who don't know how to work with swap on Linux.
So I give a short Howto on Swap-Files
- What is Swap?Swap is a special filesystem in Linux systems which provides the system an alternative memory space if the RAM is full.
- For what can I use it: If your Programs (e.g. Code_Aster) run out of Memory, you can create Virtual RAM for your Programs
- How can I create Swap 2 Possibilities: Create a Swap Partition is the standard way, but what if you only need swap temporarily or simply don't have the user rights? Then you can create a Swapfile.
Do the following steps in a terminal:
- Work as root-user:
sudo -i
- Create an empty file with zeros (here we create swapfile in the root directory with 512 Megabiyte (M) ):Explaination: dd makes a file full with zeros in the file swapfile (or what name and location you wish to give; you could also create one in your user directory with of=/home/username/myswapfile) ; bs=1M gives the blocksize. You could also use e.g. 1G for one Gigabyte instead. Count is the number of Blocks. In this case we have 512 blocks with 1 Megabyte, i.e. 512 MB
dd if=/dev/zero of=/swapfile bs=1M count=512
- Set the right user rights (not necessary but highly recommended for security reasons):
chmod 600 /swapfile
- Activate Swapfile:
swapon /swapfile
- Set entry in(optional) if you want to keep the file if you reboot the machine:
/etc/fstab
/swapfile none swap defaults 0 0
- To safely remove the swapfile:to turn it off an then
swapoff -a
rm -rf /swapfile
Thats it. For further reading i Refer to my source in the Arch Linux Wiki
Hope that helps some people!
Moderators: catux
Time to create page: 0.114 seconds