Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 08:27 PM
Google Mike
 
Posts: n/a
Default Newbie Question About Swap Partition

I have standard RH9 Linux with standard ext3 filesystem.

I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
RAM chip. My swap partition is set to approximately double the RAM
size.

1. Do I need to type some command after adding RAM to manually
increase the size of the swap partition?

2. Will the swap partition automatically increase and I won't need to
type a command manually?

3. Can I increase it without risk to whatever else is on the disk, if
I have available space?

4. What size should it be? Should it be RAM x2 + 64MB, or is there a
more preferrable setting?

Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 08:27 PM
Alex Harsch
 
Posts: n/a
Default Re: Newbie Question About Swap Partition

Google Mike wrote:

> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>
> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition?

If yout want to increase your swap space, you have to add a partition or
increase the size. parted is a tool, that can be pretty helpfull in this
context.
>
> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?
>

Nope.
> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?
>

Depends on your partitioning tool. But, I think changing paritions is always
somewhat scary.
> 4. What size should it be? Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?

I think about twice the ram size is the defacto standard. But on the other
hand, take top to take a look on the usage of swap. Mine is almost always
hardly used.
>
> Thank you.


With kind regards, Alex

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 08:27 PM
Andreas Janssen
 
Posts: n/a
Default Re: Newbie Question About Swap Partition

Hello

Google Mike (<googlemike@hotpop.com>) wrote:

> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>
> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition?


The "double size of RAM" rule only applied to some early versions of the
2.4 kernel, as far as I know. If you don't use one of those kernels
(and you probably don't), there is no need to increase the amount of
swap space at all, if you only want to do it so it will be twice the
amount of RAM you have.

> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?


The swap partition will remain the same size, unless you repartition
manually.

> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?


Manipulating partitions never is without risk. If there is empty space
behind the swap partition, and you only want to increase the swap
partition's size, the risk is quite low.

> 4. What size should it be? Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?


As I already wrote, you probably don't need to change the swap size to
3GB (are swap partitions > 2 GB even supported?), unless the services
you run require 4.5 GB of RAM and SWAP. If the machine worked reliably
with 512 MB RAM and 1 GB swap, then it should also work with 1.5 GB of
RAM and 1 GB of swap.

best regards
Andreas Janssen

--
Andreas Janssen <andreas.janssen@bigfoot.com>
PGP-Key-ID: 0xDC801674 ICQ #17079270
Registered Linux User #267976
http://www.andreas-janssen.de/debian-tipps.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 08:27 PM
P.T. Breuer
 
Posts: n/a
Default Re: Newbie Question About Swap Partition

Google Mike <googlemike@hotpop.com> wrote:
> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>
> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition?


Yep, if you want to. But why do you want to? Don't you have enough swap
now?

> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?


No, your partitions will not magically change size underneath you,
thank goodnes.

> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?


Only if you have space to increase it into. Why not add another swap
partition instead? But why add anything at all?

> 4. What size should it be?


Whatever you need. How mmuch do you need?

> Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?


Yes - whatever you prefer.

Peter
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 08:27 PM
Michael Black
 
Posts: n/a
Default Re: Newbie Question About Swap Partition


Google Mike (googlemike@hotpop.com) writes:
> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>

You should have been watching how your swap gets used. If it barely gets
used, then it won't need increasing with more ram. If is getting used
significantly, the fact that you are doubling your RAM should help
the situation.

Swap is used to make good use of RAM. It keeps things that aren't being
used at the moment handy, so you don't have to manually keep reloading things.
If you've got a little bit of RAM, the swap partition will get a lot of use,
because the operating system and the applications need more RAM space than
you have. So the unused bits get swapped out when not being used, and
swapped in when needed. If you've got enough RAM, as much as possible will
be kept in RAM, since it's faster than using the hard disk. Hence, swap
space will be less used as you increase your ram. Unless, of course, you
are doing things that use up the available RAM pretty fast.

Note that it is useage that really specifies the size of the swap partition,
not some absolute value. I gather much of the "swap should be two times
the RAM" dates from memory was relatively limited, so you would find
that swap was needed often. But that was some time ago.

I first installed Linux four years ago, in a very limited system, so limited
that I didn't go very far with it. I went and bought a used Pentium with
32megs of RAM, and decided to make swap equal to three times the RAM. I
did that because I anticipated getting more ram, and I had the hard disk
space to spare. I went to 64megs, and then 96megs, and using free I
rarely saw much use of the swap partition. Admittedly I am underusing
the system, but it points out that swap plus RAM needs to be large only
depending on what you are doing with the system.

When I moved to this computer in January, I just made swap equal to RAM,
because I know I don't use enough for swap to be used that much. If I'd
had limited hard drive space, I might have considered less swap. Not only
is much of my RAM free, but swap barely gets used.

This might change if what I used the computer for changed. But it's fine
right now, and unless you see excessive use of swap, then you shouldn't
have to worry about increasing swap.

Note that you can use swap files rather than partitions. Since I don't
need them, I've not paid full attention to how to do it, but it is a solution
if one comes upon something that suddenly requires more swap. If it's a
temporary matter, then there's no sense fiddling with the swap partition.

Michael

> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition? >
> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?
>
> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?
>
> 4. What size should it be? Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?
>
> Thank you.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-17-2008, 08:27 PM
mjt
 
Posts: n/a
Default Re: Newbie Question About Swap Partition

Google Mike wrote:

> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.


.... you wont need to follow this rule-of-thumb with 1gig RAM
..
--
<< http://michaeljtobler.homelinux.com/ >>
If you wish to live wisely, ignore sayings -- including this one.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-17-2008, 08:27 PM
David Breakey
 
Posts: n/a
Default Re: Newbie Question About Swap Partition

On Tue, 2004-08-24 at 12:33 -0700, Google Mike wrote:
> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>
> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition?


The swap partition will never, ever just change size automatically; you
will always need to manually trigger any changes to it.

> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?


No, it will not increase, or decrease; see above.

> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?


That depends on exactly how your disk is laid out; if you're at all
unsure, I'd say no. Otherwise, find a local guru and ask them to show
you (not 'do it for you'). Changing the size of the swap partition
generally involves pulling out a partitioning tool, backing up your
entire disk, and repartitioning the drive; unless you really need to, I
wouldn't bother. It sounds like you already have a swap partition that
is easily big enough for anything you'd probably need to do.

> 4. What size should it be? Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?


The magic formula used to be 'RAMx2', but that's not really a good way
of judging it. The real question you want to ask now is, "Do I need more
than 2GB of memory?", because that's what you've got with 1GB RAM and
1GB swap. Remember, though, that accessing swap is many, many times
slower than RAM. Chances are good you could probably reduce your swap
partition and nothing would even notice, even now before you add the
extra 512MB. Think of swap as 'emergency memory' which the system can
use when it runs out of RAM so that it doesn't completely flake out.

Assuming typical desktop use, an average Linux system, today, generally
requires at least 256MB of total memory (that's both RAM and swap
combined), with at least half of that being real RAM instead of swap;
real RAM is always better than swap, when it can be afforded. With 512MB
or more of RAM, you probably won't ever need more than 256MB of swap.
However, this all depends on exactly what you do.

If you run a lot of applications at once, or applications that consume a
lot of RAM (eg: GIMP, editing a 4000x4000x32bit image), you'll want to
set up a relatively large swap partition, to ensure that the system has
plenty of combined memory for those times that it needs it.

As a general rule, however, don't ever set up a swap partition that is
more than double your available RAM; it's not that it will hurt
anything, but it is pointless. If you have 1GB of RAM, and (therefore,
following the swap=RAMx2 rule) set up a 2GB swap, you have a combined
total of 3GB of memory. Before your system comes anywhere near consuming
that 3GB, it's performance will have slowed to a crawl, as it spends
most of its time paging memory in and out of the swap partition
(remember, swap is hundreds, if not thousands of times slower than RAM).
In fact, chances are good that by the time your hypothetical system has
consumed a mere 1GB of its swap space, it will have slowed down to
unusability, perhaps even acting like it has frozen.

The general rule of thumb I'm seeing today is: set your swap partition
to be equal to your RAM, assuming you have 512MB or more; also, don't
ever bother making your swap partition larger than 1GB, especially if
you have more than 1GB of RAM. And this is only if you're a hard-core
power user who runs applications that consume memory like water. If not,
a swap partition no larger than 512MB is probably more than sufficient.

If you have less than 512MB, the old RAMx2 formula is probably good
enough for most uses.

Personally, I've got my swap set to 1GB, but that's because hard drive
space is dirt cheap nowadays, so it doesn't really hurt. With 1GB of
RAM, though, I've rarely seen it use more than 200Kb of my swap space.
Ever. Even when I *was* editing those huge 4000x4000 images in the GIMP
(to be fair, though, GIMP 2 does a pretty good job of paging itself out
to disk without relying on the swap partition, so this may not be a good
example).

Remember though, real RAM is *always* better than swap, when you can
afford it.

Finally, I'd recommend using swap partitions over swap files, but that's
just me. Swap files just strike me as being too easy to screw with,
although that might just be my Windows bias seeping through.

>
> Thank you.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770