Swap resize

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
slab

Swap resize

Post by slab »

what should I modify here to make the swap changes permanent and I won't have to type "swapon /extraswap" every time I start my machine ?
http://img193.imageshack.us/img193/8004 ... hotqdu.png
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
seeley

Re: Swap resize

Post by seeley »

Hi!
You first should read my help (link1 below) and post some relevant outputs, because we need some more information.
If you have installed LMDE, please read my HOWTO.
I suppose there is a wrong UUID.
seeley
oobetimer

Re: Swap resize

Post by oobetimer »

slab wrote:what should I modify here to make the swap changes permanent and I won't have to type "swapon /extraswap" every time I start my machine ?
http://img193.imageshack.us/img193/8004 ... hotqdu.png
Swap file

http://translate.google.fi/translate?js ... n_luominen

Original text

http://linux.fi/wiki/Swap-tiedoston_luominen
slab

Re: Swap resize

Post by slab »

you see ... I did this : http://www.linux.com/archive/feature/113956
but I don't know how to change the file and where to type the things written in the site
DrHu

Re: Swap resize

Post by DrHu »

In windows a swap file is called a page file
http://www.petri.co.il/pagefile_optimization.htm
--whether it is Linux, Apple OSX or Windows, the first step is to have enough resources for normal activities, including (and especially in Linux enough RAM), then the OS will function well

First question do you even need swap or extraswap, since if you are that low on system resources, you can't expect a good experience with Linux or indeed any OS, that would need to swap RAM (system memory) for hard drive space (swap or paging)


http://www.linux.com/archive/feature/113956
But it is a lot of trouble, especially if you don't even need (are using any swap space currently)
  • df in a terminal will tell you if any swap space is being used
    --or you could install htopm, and run that, it keeps a dynamic oyunt of file activity including any swapping (swap space being used)
    htop would be the command in a terminal
Second, the explanation is clear enough step-by-step, if you really want to follow it
  • dd if=/dev/zero of=/extraswap bs=1M count=512
    replacing 512 with the number of megabytes you want in your auxiliary swap file. if= and of= are short for infile and outfile. The /dev/zero device file will give us zeroes to be written to the output file. If you want this file on a different partition, say your /var partition, you would replace /extraswap with /var/extraswap.
    Now we have a file the size we want on disk, and we can prepare it for use as a swap partition. We'll use the mkswap command to make our file swap-consumable for the Linux kernel. Again as root, carefully type:
    mkswap /extraswap
    To turn on our swap file, we run swapon /extraswap. Now when we run swapon -s we should see our existing swap partition and our new swapfile. Also, the free command should show an increase in total swap space.
    But we're still not done yet. If we reboot our machine now, our new swapfile won't be active, and we'll have to run swapon /extraswap again. In order to make things more permanent, we'll need to edit our /etc/fstab file.
Last edited by DrHu on Mon Jan 31, 2011 5:55 pm, edited 2 times in total.
debian_bugsbunny

Re: Swap resize

Post by debian_bugsbunny »

Which part of the following is hard to comprehend?
we'll need to edit our /etc/fstab file.
First, make a copy of the file. (You'll see why shortly.) Something like this should do the trick:

cp /etc/fstab /etc/fstab.mybackup

Now open /etc/fstab in your favorite text editor and find a line about your swapfile that looks something like this:

/dev/hda2 none swap sw 0 0

You'll need another line like that underneath it pointing to your new swap file. Replace the first column with the location of your new swap file. For our example, the new line should look like this:

/extraswap none swap sw 0 0

Save the file.
In your case the new line should look exactly like the sample they give:

Code: Select all

/extraswap   none   swap   sw   0   0
just add it to the end of /etc/fstab

Aside from that I echo DrHu's comments about do you really need extra swap? My guess is you don't (or at least it's highly unlikely). If you're only doing this to learn how that's fine though.
slab

Re: Swap resize

Post by slab »

I have 1gb of RAM and 92 MB swap ... do I need more swap what do you think ? the LMDE did it automatically and I have no idea why it chose 92 mb for swap size ...
slab

Re: Swap resize

Post by slab »

proxima_centauri

Re: Swap resize

Post by proxima_centauri »

slab wrote:soo should it look like this ?
http://img6.imageshack.us/img6/9295/screenshotwfv.png
Assuming you created the swapfile in /extraswap, yes.
slab

Re: Swap resize

Post by slab »

haha it works :D thanks a lot :D
Locked

Return to “Beginner Questions”