Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just built a new computer and installed SUSE on it. I currntly have 512MB of ram on it and want to upgrade it. When I do how do I change the size of the SWAP partition?
If your swap is already 1GB, you probably don't need to. Otherwise, you can create a 1GB partition at the end of the drive, format it as swap space, and then change your /etc/fstab file to use the new partition.
You probably don't need to change your swap - after all, the only time swap gets used is if the system pushes RAM past capacity, and the system is forced to write out memory pages to disk. The more RAM you have, the less likely that becomes, and if you're running a typical desktop and have at least 256Mg or 512Mg of swap, most likely that will be plenty. If you are running a massively loaded server you would need more, but at least for my own personal home PC's, 256Mg is all I ever give it.
As an aside, the "swap should equal twice RAM" rule was important back in the day, where having 16 or 32Mg of RAM was bleeding edge, and it was not all that difficult for the system load to max out physical memory. These days however, where 256Mg, 512Mg, or even 1G of RAM is becoming common, the importance of swap is diminishing. It won't hurt to create a larger swap space, but it probably isn't necessary, and it wastes disk space
Changing the size of the swap partition takes a while because you have to backup the data on other partitions and then change the partition table. Linux gives you another way to add more swap by using a file instead from a partition.
I set 256 MB for swap and I have a gigabyte of RAM. The only time Linux goes to the swap is when I play games or leave it on for two days. When I leave it on for two days, Linux only eats a few kilobytes, but that is only if I leave foldingathome running.
To setup a file for a swap that is going to be about 512 MB in size.
1) dd if=/dev/zero of=/tmp/swapfile bs=1048576 count=512
2) mkswap /tmp/swapfile
3) swapon /tmp/swapfile
You can place the line below in /etc/fstab but its optional.
/tmp/swapfile swap swap defaults 0 0
You should see more swap space if you type free or type cat /proc/swaps
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.