Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
1.You need a partition to expand the swap.(you can use fdisk command )
2.Let's take /dev/sda6 as example.
3.Run sudo mkswap /dev/sda6
4.Technically speaking, you’re not formatting the partition; rather,you’re writing a small amount of information to indicate to the kernel that it can be used as swap space.
You can immediately activate the new swap partition via the swapon command. This command tells the kernel it can use the specified partition as swap space.
5.Run sudo swapon /dev/sdb6
This command will complete without printing anything, but you can check dmesg for
information on what happened.
1.You need a partition to expand the swap.(you can use fdisk command )
2.Let's take /dev/sda6 as example.
3.Run sudo mkswap /dev/sda6
4.Technically speaking, you’re not formatting the partition; rather,you’re writing a small amount of information to indicate to the kernel that it can be used as swap space.
You can immediately activate the new swap partition via the swapon command. This command tells the kernel it can use the specified partition as swap space.
5.Run sudo swapon /dev/sdb6
This command will complete without printing anything, but you can check dmesg for
information on what happened.
If have created a new partition for SWAP , Is there will be two SWAP partitions in my system..
You can also create a swap file. From what I have read there is no performance difference between using a swap file and partition. So if you don't have the ability to add/resize a swap partition, but create a swap file and add that to fstab and the two should work in tandem (such has been the case for me). See https://wiki.archlinux.org/index.php/Swap
Traditionally, swapfiles have disadvantages when compared to dedicated partitions, but the big one - that the kernel has to go through an extra layer to access a file, which used to reduce performance - has been overcome in modern kernels.
You still have the potential problems of file fragmentation and not being able to choose where the file physically sits on the hard disc, though. (I'm assuming you have a traditional hard disc - SSDs are a different kettle of fish.) It's possible to place a swap partition on the outer edge of the disc, which reduces read/write times, but a file doesn't give you that luxury. On the other hand, a lot of people don't bother anyway, and as you are already using the system, the best parts of the disc might already be taken.
If you happen to have two hard discs, it's often worth having a swap partition/file on each with equal priority. The kernel alternates the swapping reads (or writes) between them, giving a significant performance boost. If your two swaps are both on the same device, then giving one of them a lower priority avoids the risk of making the disc heads 'dance' between two parts of the disc every time you swap.
Last edited by Pastychomper; 02-14-2013 at 06:36 AM.
Reason: Jinxed :)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.