Jump to content

Swap space activation [solved]


Dustpuppy
 Share

Recommended Posts

I've re-installed 2006 on desktop 1 and now have a problem with the swap space. On boot, I get the following a few lines apart in the startup sequence:

 

activating swap partitions [OK]

enabling swap space [failed, device or resource busy]

 

I previously installed FC5 to see what it was like, and that set up the spare space on my first harddrive (20GB) and the whole of the second drive (40MB) as a logical volume. I kept this and told Mandriva to auto-allocate and then format it, which it did into 5.9 GB root, 1 GB swap and the rest home.

 

Is the swap space enabled or not? Is there any way I can tell? It doesn't seem that slow, but I haven't run anything very big on it.

Edited by Dustpuppy
Link to comment
Share on other sites

I would do this:

 

free

 

at a console prompt, and you can see if swap is active. Here is an example of how it looks active with 1GB swap:

 

[ian@europa ~]$ free
		 total	   used	   free	 shared	buffers	 cached
Mem:		515304	 506632	   8672		  0	  36816	 301684
-/+ buffers/cache:	 168132	 347172
Swap:	   996020	   2604	 993416

 

If not, what you can do is this:

 

fdisk -l

 

one of the partitions will be listed as type "82" which is Linux swap, it should also say this against it. What you can now do is:

 

mkswap /dev/xxxxx

 

where xxxxx is your device that corresponds to swap. You can then turn it on without rebooting using:

 

swapon /dev/xxxxx

 

again where xxxxx is your device that corresponds to swap.

Link to comment
Share on other sites

Ok... I tried gnome system monitor, and it came up with zero out of 1GB swap used. It also doesn't list swap in the devices: it lists /dev/hda1 (/mnt/windows), /dev/mapper/VolGroup00-1 (/) and /dev/mapper/VolGroup00-3 (/home).

 

Doing "free" lists 1GB swap with 0 used. I then tried to make /dev/mapper/VolGroup00-2 into swap, but when I turned it on it said "device or resource busy". fdisk -l gives

 

Disk /dev/hda: 61.4 GB, 61492838400 bytes
255 heads, 63 sectors/track, 7476 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/hda1   *		   1		4472	35921308+   7  HPFS/NTFS
/dev/hda3			4486		7476	24025207+  8e  Linux LVM

Disk /dev/hdb: 40.9 GB, 40982151168 bytes
255 heads, 63 sectors/track, 4982 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot	  Start		 End	  Blocks   Id  System
/dev/hdb1   *		   1		4982	40017883+  8e  Linux LVM

 

:unsure:

Link to comment
Share on other sites

As far as I know, swap is automatically activated i.e., mounted, and does not need to be manually mounted or dealt with in any way.

When you open Kde Control Centre and look at Information then Memory you will see it shown there together with your other memory and how much is being used and what is available.

I think you are concerning yourself with a non issue here. If it set up 1Gb for swap then it is twice what is realistically needed anyhow and if you already have hard memory in excess of 512Mb then it is hardly ever going to use swap.

I have 1Gb of memory and 512Mb of swap and swap is never touched. Some people with 1Gb or more have done away with swap altogether.

Try not to see Linux as any more complicated than it actually is and you will enjoy it a heck of a lot more.

Cheers. John.

Link to comment
Share on other sites

It seems you've used LVM when partitioning your disks. Have you done this so that it looks like one large partition across the two disks?

 

This will be why no swap partition exists when you use fdisk -l. Can you post your /etc/fstab, and also the results of the free command, and I'll check it out.

Link to comment
Share on other sites

I have 1Gb of memory and 512Mb of swap and swap is never touched. Some people with 1Gb or more have done away with swap altogether.

That's interesting - so swap is only used when the physical memory is all being used?

Try not to see Linux as any more complicated than it actually is and you will enjoy it a heck of a lot more.

:D

But making it complicated is all the fun! I had a perfectly working 2006 installation, and decided that as I'd evidently mastered the basics (wow, that only took me three years!) then I should start tinkering... So I trashed my system by trying to install KDE3.5 without reading the instructions. I then installed FC5 and ended up with a LVM which I'd never seen before. So then I re-installed 2006 to find my swap space couldn't activate (or maybe could...). So you see, I'm learning more now!

 

Ian - thanks for your help on this. Yes, I'm using the LVM that the FC5 installation set up, which uses 20GB from the first disk and all of the second, and appeared as a separate tab on the partitioning setup of the mandy installer.

 

/etc/fstab reads

# This file is edited by fstab-sync - see 'man fstab-sync' for details

/dev/VolGroup00/1 / ext3 defaults 1 1

/dev/VolGroup00/3 /home ext3 defaults 1 2

/dev/hdc /mnt/cdrom auto umask=0022,user,iocharset=iso8859-15,codepage=850,noauto,ro,exec,users 0 0

/dev/hdd /mnt/cdrom2 auto umask=0022,user,iocharset=iso8859-15,codepage=850,noauto,ro,exec,users 0 0

none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0022,iocharset=iso8859-15,sync,codepage=850 0 0

/dev/hda1 /mnt/windows ntfs umask=0022,nls=iso8859-15,ro 0 0

none /proc proc defaults 0 0

/dev/VolGroup00/2 swap swap defaults 0 0

and free gives

			 total	   used	   free	 shared	buffers	 cached
Mem:		514924	 404588	 110336		  0	  18488	 199692
-/+ buffers/cache:	 186408	 328516
Swap:	  1146872		  0	1146872

Link to comment
Share on other sites

Yes, you've got swap. It's within the LVM, which is why a standard fdisk -l doesn't report normal partitioning.

 

Another alternative to LVM is using Raid0, which I tend to use, as it seems to work much faster. Or at least when I tried it on a system with Red Hat.

 

So looks like you're OK anyhow.

Link to comment
Share on other sites

I have 1Gb of memory and 512Mb of swap and swap is never touched. Some people with 1Gb or more have done away with swap altogether.

That's interesting - so swap is only used when the physical memory is all being used?

 

With a console window opened and also running the SeaMonkey suite, this is what "free" shows currently (with 512 Mb memory installed):

 

bash-3.00$ free
		 total	   used	   free	 shared	buffers	 cached
Mem:		515708	 484092	  31616		  0	  64080	 268496
-/+ buffers/cache:	 151516	 364192
Swap:	  1028152	   2596	1025556

 

Interesting to note that it shows over 31 Mb free, yet it found it necessary to use 2.6 Mb of the swap partition.

 

On my slower computer (Intel Pentium/MMX 166 MHz, 196 Mb RAM), also with a Konsole window open and running SeaMonkey with swap turned on, "free" shows this:

 

bash-3.00$ free
		 total	   used	   free	 shared	buffers	 cached
Mem:		191216	 187716	   3500		  0	  15596	  74276
-/+ buffers/cache:	  97844	  93372
Swap:	   449780	   2588	 447192

 

With swap turned off, it shows:

 

# free
		 total	   used	   free	 shared	buffers	 cached
Mem:		191216	 187272	   3944		  0	  14868	  73652
-/+ buffers/cache:	  98752	  92464
Swap:			0		  0		  0

Edited by edwardp
Link to comment
Share on other sites

Obviously if swap is available then the system can decide to use it.

If there is no swap then the system works around it. Quite normal I would have thought, for a superior system like Linux. :D

 

Cheers. John.

Link to comment
Share on other sites

Whats the value for swappiness? Type this to find out?

 

cat /proc/sys/vm/swappiness

 

By default it's 60, I change it to 10, as it's supposed to help with using swap less than it should.

Link to comment
Share on other sites

Whats the value for swappiness? Type this to find out?

 

cat /proc/sys/vm/swappiness

 

By default it's 60, I change it to 10, as it's supposed to help with using swap less than it should.

 

Not sure if this was directed to me, but...

 

it shows 60.

Link to comment
Share on other sites

OK, try this next. Edit /etc/sysctl.conf and at the bottom of the file add:

 

vm.swappiness = 10

 

and reboot, or alternatively, do this to test it and also save a reboot:

 

echo 10 > /proc/sys/vm/swappiness

 

and then repeat the cat command above to verify it's now changed to 10.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...