Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Swap Partition
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
cjohnsoia
n00b
n00b


Joined: 17 Jan 2007
Posts: 26

PostPosted: Wed Jan 17, 2007 1:14 am    Post subject: Swap Partition Reply with quote

Previosly posted in "Other things Gentoo" realizing that it should probably go here.

Hi All,

I have a dive patitioned such:

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 257 1959930 82 Linux swap / Solaris
/dev/hda3 258 3738 27961132+ 83 Linux

Where /dev/hda3 is only 19% utilized.

Question:

Can anyone suggest the best way (tool, etc) that could be used to increase the size of the swap patition and reduce hda3 without loss of data?

Any suggestions greatly appreciated.

Thanks
Back to top
View user's profile Send private message
bLUEbYTE84
Guru
Guru


Joined: 21 Jul 2006
Posts: 566
Location: universe.tar.gz, src/earth.h, struct homo_sapiens_table

PostPosted: Wed Jan 17, 2007 1:23 am    Post subject: Reply with quote

Whoa, 2 GB swap partition is more than enough I think, it is redundant unless the role of your PC is really exotic.
For the record, in my desktop PC (Gaming, music stuff) I don't even have a swap partition at all, without any problems (1 GB real ram).

With that said, there are tools to resize partitions, but I won't go into details since I have no experience with them. But know that they are filesystem-type specific. Therefore if you really will do this (which I see ridiculous), state your FS type so others may provide help :)
Back to top
View user's profile Send private message
no_hope
Guru
Guru


Joined: 23 Jun 2003
Posts: 482

PostPosted: Wed Jan 17, 2007 1:38 am    Post subject: Reply with quote

without using any tools you could tar your / copy it to /dev/hda2, delete hda3, make new swap, make new root, extract old root to new root...
Let me know if you are interested and I'll post more coherent instructions.

Also, bLUEbYTE84 is right. swap is for wussies. Real men just buy more RAM (unless your are using suspend2 or something) :)
Back to top
View user's profile Send private message
alkan
Guru
Guru


Joined: 06 Aug 2004
Posts: 385
Location: kasimlar yaylasi

PostPosted: Wed Jan 17, 2007 1:49 am    Post subject: Reply with quote

without resizing any partition, you can also increase your swap:
Code:

dd if=/dev/zero of=/var/.swap count=<the size you wish for extra swap>
mkswap /var/.swap
swapon /var/.swap (or add it to fstab)
Back to top
View user's profile Send private message
cjohnsoia
n00b
n00b


Joined: 17 Jan 2007
Posts: 26

PostPosted: Wed Jan 17, 2007 1:49 am    Post subject: Thanks Reply with quote

Thanks for the info,

Have you heard of 'parted'? Think this may work - giving it a try - I want the very large prioritized swap partitions...
Back to top
View user's profile Send private message
no_hope
Guru
Guru


Joined: 23 Jun 2003
Posts: 482

PostPosted: Wed Jan 17, 2007 1:56 am    Post subject: Re: Thanks Reply with quote

cjohnsoia wrote:
I want the very large prioritized swap partitions...


may I ask what software requires this? I get the feeling we are not talking desktops.
Back to top
View user's profile Send private message
cjohnsoia
n00b
n00b


Joined: 17 Jan 2007
Posts: 26

PostPosted: Wed Jan 17, 2007 2:15 am    Post subject: Reply with quote

I want to run three instances of WMware all running 2003 server's as DB, file and app servers
Back to top
View user's profile Send private message
rmh3093
Advocate
Advocate


Joined: 06 Aug 2003
Posts: 2138
Location: Albany, NY

PostPosted: Wed Jan 17, 2007 3:54 am    Post subject: Reply with quote

you could always make swap files... use dd to create a 0 filled file as big as you want your swap file to be... then run mkswap on it and then configure fstab to use it as a swap
_________________
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.
Back to top
View user's profile Send private message
Kaste
Guru
Guru


Joined: 21 Dec 2005
Posts: 546
Location: /home Sweet /home

PostPosted: Wed Jan 17, 2007 6:02 am    Post subject: Reply with quote

The most comfortable way I have found is this: http://gparted.sourceforge.net/livecd.php

Just pop in the cd and you get a nice gui that helps you use parted and thereby resizes your partitions.

Out of curiosity, how much RAM have/will you put in that system to run three 2003 servers?
_________________
I'm a membar of Mesnar and me scull contains wakky secrets!
Back to top
View user's profile Send private message
kienjakenobi
n00b
n00b


Joined: 25 Dec 2007
Posts: 28

PostPosted: Sat Dec 29, 2007 3:52 pm    Post subject: Swap size: >=2*RAM Reply with quote

In the Gentoo Wiki on Software RAID the partitioning scheme shows that the size of the swap partition should be ">=2*RAM." I read that to say greater than or equal to two times the amount of RAM. Is that a recommendation specific to having a RAID setup? 8 GB of swap would be massive! On my desktop with 2 GB of RAM and 2 GB of swap I have never seen the swap used more than 5%, though it has only one hard disk.
_________________
Avatar: Background = Adobe stock photo Tux = Vector by Anja Gerwinski (http://ngc224.gerwinski.de/~anja/gnuart/penguin/)
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Sat Dec 29, 2007 4:05 pm    Post subject: Reply with quote

merged above post here.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
Lomion
n00b
n00b


Joined: 18 Dec 2007
Posts: 25
Location: Milano, Italy

PostPosted: Sat Dec 29, 2007 11:15 pm    Post subject: Re: Swap size: >=2*RAM Reply with quote

kienjakenobi wrote:
In the Gentoo Wiki on Software RAID the partitioning scheme shows that the size of the swap partition should be ">=2*RAM." I read that to say greater than or equal to two times the amount of RAM. Is that a recommendation specific to having a RAID setup? 8 GB of swap would be massive! On my desktop with 2 GB of RAM and 2 GB of swap I have never seen the swap used more than 5%, though it has only one hard disk.


I have 4 Gigs of DDR2 and a 4 gigs swap partition for suspend, but in normal use (and a 3000MB tmpfs for /var/tmp/portage mounted on demand) a so large swap partition is useless.
I think that when you have more than 2 GB of ram, you could simply fix you swap to 2 GB unless you don't run specific programs, virtualize a lot or suspend your system to disk in swap.
Back to top
View user's profile Send private message
kienjakenobi
n00b
n00b


Joined: 25 Dec 2007
Posts: 28

PostPosted: Sun Dec 30, 2007 11:28 am    Post subject: Reply with quote

I suppose the recommendation on the Software RAID Wiki is for systems with smaller amounts of RAM or very special cases. On a laptop with 4GB of RAM I think I will have 4GB of swap so I can easily suspend to disk and virtualize Windows.
_________________
Avatar: Background = Adobe stock photo Tux = Vector by Anja Gerwinski (http://ngc224.gerwinski.de/~anja/gnuart/penguin/)
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10308
Location: Córdoba (Spain)

PostPosted: Sun Dec 30, 2007 11:45 am    Post subject: Reply with quote

Just a note about swap on loopback files:

1.- they doesn't perform the same than real partition/disks
2.- they are subject to filesystem penalties, which real swap partitions are not, i.e. fragmentation
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Lomion
n00b
n00b


Joined: 18 Dec 2007
Posts: 25
Location: Milano, Italy

PostPosted: Sun Dec 30, 2007 12:51 pm    Post subject: Re: Swap size: >=2*RAM Reply with quote

Lomion wrote:

I have 4 Gigs of DDR2 and a 4 gigs swap partition for suspend, but in normal use (and a 3000MB tmpfs for /var/tmp/portage mounted on demand) a so large swap partition is useless.
I think that when you have more than 2 GB of ram, you could simply fix you swap to 2 GB unless you don't run specific programs, virtualize a lot or suspend your system to disk in swap.


Forgot to say I've a pair of Hitachi Deskstar disks in RAID 0 (except for /boot in RAID1) ;)
Back to top
View user's profile Send private message
kienjakenobi
n00b
n00b


Joined: 25 Dec 2007
Posts: 28

PostPosted: Mon Dec 31, 2007 11:08 pm    Post subject: Reply with quote

Ah! So RAID tends to use the swap partition? It sounds like you have a software RAID setup, but would a hardware RAID setup use the swap? I suppose RAID of any type is not different from any other type of file processing in this aspect: RAID probably use the swap whenever it needs to temporarily put information somewhere, just as any program does.
_________________
Avatar: Background = Adobe stock photo Tux = Vector by Anja Gerwinski (http://ngc224.gerwinski.de/~anja/gnuart/penguin/)
Back to top
View user's profile Send private message
Lomion
n00b
n00b


Joined: 18 Dec 2007
Posts: 25
Location: Milano, Italy

PostPosted: Tue Jan 01, 2008 11:14 am    Post subject: Reply with quote

kienjakenobi wrote:
Ah! So RAID tends to use the swap partition? It sounds like you have a software RAID setup, but would a hardware RAID setup use the swap? I suppose RAID of any type is not different from any other type of file processing in this aspect: RAID probably use the swap whenever it needs to temporarily put information somewhere, just as any program does.


There's no difference in swap usage between RAID and non-RAID systems.
Swap will be used only on-demand when your ram is full, according to the "swappiness" of your box.

The only difference is that having a RAID Swap partition makes the swapping a little faster, although the difference isn't noticeable.

The reason because I have such a large swap partition is suspend to disk the system.



Anyway, happy new year everyone! :D
Back to top
View user's profile Send private message
zeek
Guru
Guru


Joined: 16 Nov 2002
Posts: 480
Location: Bantayan Island

PostPosted: Wed Jan 02, 2008 7:08 am    Post subject: Reply with quote

Don't bother with swap partitions these days. Swap files have 0 performance penalty and can be resized easily without playing with low level tools.

Quote:
The kernel generates a map of swap offset -> disk blocks at
swapon time and from then on uses that map to perform swap I/O directly
against the underlying disk queue, bypassing all caching, metadata and
filesystem code.


http://lkml.org/lkml/2005/7/7/326
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