Adding swap space to a running linux system
There are acouple situations where my systems memory needs have exceeded the supply. The most likely cases are running virtual machines and building cd/dvd images. Those things realistically take LOT’s of memory. I have a swap partition – I don’t recall the size right off. I have about 512 MB on the desktop and probably for what I do could use to double that. Swap space, of course, is what the operating system uses when all the physical memory (RAM) is used.
The situations I’ve seen needing more memory are this. Building a cd or dvd image… the process starts off quite well, fairly quickly. But as it progresses, let’s say to 70% or so in the cd image building the desktop responsiveness slows, the hard drive is thrashing and if you manage to look at “top” or free, you find a VERY minimal amount of memory is actually free swap or RAM. So, what to do? If you’re lucky enough to be able to get to a console you can actually add swap on the fly and return to some responsiveness. If it’s swapping too hard, you may just wind up waiting it out (or rebooting, to many people it looks like a hard system freeze.)
Linux can deal with a swap partition, or a file designated as a swapfile (or multiple files…) Here’s how to add swap space.
Create a 1GB swap file with the following
dd if=/dev/zero of=swapfile bs=1024 count=1M
Next Use the following to “format” the new swap file. Similarly for a new swap partition.
/sbin/mkswap -c swapfileNow Set swap file ownership and permissions
chown root.root swapfile; chmod 0600 swapfile
Optionally add the new swap space entry to /etc/fstab. (if swap is to be activated at each boot.)
Eg. swapfile swap swap defaults 0 0
Finally Enable the new swapspace(s) with
/sbin/swapon -a (if entry is in fstab)
or
/sbin/swapon /path/to/newswap (if this is to be temporary.)
Popularity: 1% [?]
Related Posts - Remote Tech Support with x11vnc and wrapper script So, the idea is that I wanted something "like" the Ultranvnc Single Click download, only for linux. The main idea being is that if someone is looking for a bit of desktop tech support on linux, we don't need to be giving instructions for 5 different package managers, or source......
- Some days you really want to slap someone at Microsoft.... So, I was formatting a drive the other day. It's an external hard drive that will need to be readable AND writable by both Mac and Windows XP machines. So, the only choice (without paying for MacDrive to read/write to HFS+) is really FAT32. The drive is in the 250GB-300GB......
- Remote tech support with anything - would I do it? I've tried to ask myself if I'd trust someone enough to let them run a remote session on my own desktop to solve a problem. I think the answer is "it depends". If you think about it, I do tech support for home users quite a bit and they let......
Related Websites - Create Autorun for your CD's and DVD's The compact disk drive auto play feature, common to most operating systems, is a good way to simplify user experience. Auto play is controlled by a simple text-only file called autorun.inf. While there are dozens of software utilities available that will help you create the file, all you really need......
- Dell Computer Company Pisses Me Off! [/caption] Have You Bough A Dell Computer? I don't like to talk crap on a company but my recent situation really fired me up. Let me explain what happened to me. About a month ago my Dell computer just stopped working. Yes my computer just stopped working out of......
- Benefits of Website Hosting Websites have continued to grow over the last decade, becoming more and more important in the world of business. Those who are looking to be successful need to have their own website. For some, this means a website that supplements an already booming business. For others, this means starting a......
Similar Posts
- Sleuthkit – windows and linux file recovery
- Drive images – filling free space with zeros
- Free Ext2 Ext3 driver for Windows
- More linux software raid fun
- Useful Linux Utilities