Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
I broke my swap partition [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
halak79
n00b
n00b


Joined: 01 Mar 2006
Posts: 30
Location: Arizona, USA

PostPosted: Wed Jun 14, 2006 11:36 pm    Post subject: I broke my swap partition [solved] Reply with quote

My system has 128 mb ram, and had a 500+mb swap partition on /dev/hda3
Someone suggested that I should try lowering the swap to be equal to my ram, and that it might affect applications' memory usage and preformance positively. They cited that they had a computer with 64mb ram and 64mb swap and it seemed to preform a little better then when they had 128mb swap.
Anway.. thats the background, I don't know how to resize a partition but I went ahead and tried it anyway ;)

Now I can't activate my swap. What I did was deleted the old partition and made a new one, it looks like it all went well, but if I 'swapon -a' it says Invalid Arguments.

Code:

% fdisk -l /dev/hda

Disk /dev/hda: 10.2 GB, 10245537792 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1         261     2096451    7  HPFS/NTFS
/dev/hda2   *         262         266       40162+  83  Linux
/dev/hda3             267         283      136552+  82  Linux swap / Solaris
/dev/hda4             330        1245     7357770   83  Linux


% fdisk -l /dev/hda3

Disk /dev/hda3: 139 MB, 139829760 bytes
16 heads, 63 sectors/track, 270 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

     Device Boot      Start         End      Blocks   Id  System
/dev/hda3p1               1         270      136048+  82  Linux swap / Solaris


I do want to try the smaller swap, I think that over 500M swap is excessive for a system with 128mb ram.

Could someone please explain to me what's going on and how to fix it? And maybe how to add the freed up space [safely] to my root partition?

Thanks
-Sam


Last edited by halak79 on Thu Jun 15, 2006 8:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
jmja89
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2005
Posts: 144

PostPosted: Wed Jun 14, 2006 11:44 pm    Post subject: Reply with quote

did you do
Code:
mkswap /dev/hda3
and just try doing
Code:
swapon /dev/hda3
also what does you /etc/fstab look like?
Back to top
View user's profile Send private message
prg
Tux's lil' helper
Tux's lil' helper


Joined: 14 Oct 2005
Posts: 94

PostPosted: Thu Jun 15, 2006 12:05 am    Post subject: Reply with quote

is there any reason a system with less swap should perform better than one with more?
and if you shrink one partition you need to enlarge another one to take advantage of that...
Back to top
View user's profile Send private message
Paapaa
l33t
l33t


Joined: 14 Aug 2005
Posts: 955
Location: Finland

PostPosted: Thu Jun 15, 2006 9:03 am    Post subject: Re: I broke my swap partition Reply with quote

halak79 wrote:
My system has 128 mb ram, and had a 500+mb swap partition on /dev/hda3
Someone suggested that I should try lowering the swap to be equal to my ram, and that it might affect applications' memory usage and preformance positively. They cited that they had a computer with 64mb ram and 64mb swap and it seemed to preform a little better then when they had 128mb swap.


Could you post a link to the above suggestion/message/article? Sounds very odd...
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3519
Location: Alsace (France)

PostPosted: Thu Jun 15, 2006 11:59 am    Post subject: Re: I broke my swap partition Reply with quote

halak79 wrote:

Someone suggested that I should try lowering the swap to be equal to my ram, and that it might affect applications' memory usage and preformance positively. They cited that they had a computer with 64mb ram and 64mb swap and it seemed to preform a little better then when they had 128mb swap.


:mrgreen: Please please please, there is this thing called sysctl, vm.swapiness in our case IIRC wich will tell the kernel wether he ought to kill or swap pages, so even if you seem to have probably more than needed swap, this is pointless.

Other than this, as said before it seems that you missed to run mkswap against your partition.
Back to top
View user's profile Send private message
halak79
n00b
n00b


Joined: 01 Mar 2006
Posts: 30
Location: Arizona, USA

PostPosted: Thu Jun 15, 2006 5:04 pm    Post subject: Reply with quote

Regarding the swappiness setting, I have played with that, and it does help, I've been running with it set at 15 and it certainly uses less swap and more real ram.

About changing the swap size, this wasn't from an artical, it was a first hand suggestion. I guess the reasoning behind it is that from the perspective of an application your ram is swap+ram, so apps that allocate a certain amount of memory for themselves based on how much ram you have would take up less ram with a smaller swap. I dunno if it was actually true, I just wanted to test it out. I did notice that booting with no swap did use less ram for just booting up, before starting X than when swap was on.

The mkswap was the trick :) Now it is OK, but you guys are right, I do need to figure out how to add the extra space either back to /dev/hda3, or to /dev/hda4
Back to top
View user's profile Send private message
Paapaa
l33t
l33t


Joined: 14 Aug 2005
Posts: 955
Location: Finland

PostPosted: Thu Jun 15, 2006 5:48 pm    Post subject: Reply with quote

halak79 wrote:
Regarding the swappiness setting, I have played with that, and it does help, I've been running with it set at 15 and it certainly uses less swap and more real ram.


That is not necessarily a good thing. Swap will also be used when OS thinks that some things in RAM are not needed there and the amount should be used as disk cache. In that case more swap will be used but your computer will be more responsive.
Back to top
View user's profile Send private message
halak79
n00b
n00b


Joined: 01 Mar 2006
Posts: 30
Location: Arizona, USA

PostPosted: Thu Jun 15, 2006 5:49 pm    Post subject: Reply with quote

Just as a side note, I was pretty impressed with how linux handeled having no swap. I thought I would kind of push it and see what happened when I tried to run several programs. I ran firefox with a few tabs open and browsing these forums and gmail and stuff, and plus I had aterm running top and that used up all my ram besides a couple k, then I popped in an audio CD and played it in XMMS, and the ram usage didn't change, then I opened up Inkscape and started working on an illustration and everything continued to work. but Inkscape was noticably slower without the swap space.
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Thu Jun 15, 2006 6:10 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Kernel & Hardware.
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum