Re: Swap partition and fdisk
Hmm...you might also want to start making a swapfile and see if you use it. (they're easy and convenient, and if you never [rarely] swap, there's no performance hit). Running 16 Mbytes with X and software development will cause swap, figure about 16 Mbytes of swap. If you have space on your system, I run swap in extended partitions and use this swap space for both win95 and linux...(I need to right up what I'm doing). The last time I ran out of VM was with 1.1* and it caused nasty things to happen...make sure you don't run out of space (don't know how we error recover any more). Of course, ram is so cheap now, you can get another 16 Mbyte for about $120 tops. -- marty [EMAIL PROTECTED] Member of the League for Programming Freedom
Re: Swap partition and fdisk
My simple formula swap needed = total memory need - physical memory size works much better than the twice physical memory one. Questionable. Aside from not being computable (everyone can easily tell what their physical memory size is, but few people know how much their total memory need is going to be when they're installing Linux) and vaguely defined (the unqualified term memory should almost never be used to mean anything but physical memory), it's not really accurate if by total memory need, you mean total VM space needed. The kernel takes up a chunk of wired memory for its own needs, and if less than, say, 10% of physical memory is available for buffering files on top of that, your performance is going to go through the floor. There's another, insidious problem with many VM systems (I don't honestly know if Linux's is included) that affects the above computation. Let's say I have 32MB of physical memory and 24MB of swap, and let's pretend that a constant 8MB of my physical memory is consumed by disk buffers and kernel overhead. Okay, you say, now I have 48MB of virtual memory to play with. Now let's say that all of the running processes on my system are long-running processes, and they consume a total of 25MB of virtual memory. Obviously, at any given time, a minimum of 1MB of that data has been paged out. Let's say that at some time we have 24MB of the pages resident and 1MB of swap space allocated to hold the 1MB of data that's been paged out. Now say that that 1MB needs to be paged back in. The system needs to page out another 1MB of data, so it allocates another 1MB of swap space and pages it out. (Obviously, this all happens one page at a time.) Now, here's the catch: under most VM systems, the old 1MB of swap space remains allocated for the old data in order to save time if those pages need to be swapped out again and haven't been dirtied by writes. So now we have 24MB resident and 2MB of swap space allocated. We can keep going this way, paging in the data that was just paged out, until finally the last 1MB of data needs to be paged out and all of the swap space has been allocated. At this point, a clever VM system will deallocate swap pages which aren't strictly needed in order to make room. But the VM systems I have experience with will simply fail catastrophically. So with only 25MB of data, we can swamp what was theoretically a 48MB playground. Even if the VM system is clever, your performance may (depending on your applications) go through the floor if your total amount of data exceeds the amount of swap space on disk, because it reduces your ability to leave paged-in data on disk and forces you to write pages out to disk which you would otherwise not need to write. My conclusion: allocate as much swap space as you believe your virtual memory needs will be. For most applications, twice your physical memory size is about the upper limit you can use without thrashing.
Re: Swap partition and fdisk
I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. The terse form of the formula is: swap needed = total memory need - physical memory size (Forget everything about twice physical size. That is an evil prank that people play on the uneducated rich who have bouth 512 MB of RAM.) While it may be untrue that you *need* twice the physical memory size, I believe it's true that twice the physical memory size is about the limit of what you can effectively use if you need it. That is, if you have 4 MB of RAM, a 128 MB swap is pretty much a waste. If you ever do anything in that scenario that needed much more than about 12 MB total memory, your system would become so slow as to be unusable. Similarly, if you had 32 MB RAM, 64 MB swap may be usable if you ever needed it. For a single user system, this would probably never be the case. But for a system with many users, it is quite possible. Therefore, if disk space is plentiful on your system, I always would allocate around 1.5 to 2 times the amount of physical RAM for a swap just in case you need it some day. Gerry
Re: Swap partition and fdisk
Hi all, I might not be a UNIX (Linux) guru yet (if ever), but I do know a thing or two about OS handling. As someone (sorry I dumped the mail so I can't use your name) pointed out correctly: Swap partition=Total memory requirements - Available memory Now if anyone can tell me the correct value for Total memory requirements I would be very pleased because I also need to know the length of a piece of string. For quite a few systems, the recommended size of the swap partition (AKA virtual memory) is 1.5 - 2 times the available memory. This is not because of some magical relationship between the amount of memory required and the amount of money spent on memory, but rather due to 2 basic concepts: 1) If you have an active system and you need a large amount of virtual memory, then the probability that the memory required being swapped out is fairly high. This means that the time that the system spends swapping can become more that the time spent on useful processing (all depending on the access speed on the swap device, transfer rates, etc.). When this becomes acute the system starts thrashing at which time, for all intents and purposes, the system is unavailable and must be rebooted. If the virtual memory is capped then the system will just say no way before a dangerous swap level is reached. Given the typical physical constraints on low end devices such as those we find in a UNIX, Windoze, DOS box 2 is about good enough a ratio to use for the swap partition. 2) Whatever people say Apple, IBM, etc. employ some pretty clever people. Originally Apple said we only needed about 64 KB memory, IBM said 640 KB (Why back in the good old days I worked on a DEC System-10 which served about 80 users with 128KB RAM, but fast swap devices). If these people can get it wrong, I'm not even going to try. Now given the cost of a hard disk (1GB=US$500 I suppose, which means about 1.5 cents per 32 KB swap partition) and the cost of bringing down a server to repartition and reinstall (say about an hour of a systems administrator, plus an hour for everyone who cannot access the server...) and I think people will agree that it may be a good idea to install a swap partition, even though I don't think I need it, because tomorrow... Sorry I got so long winded but I think that this is a very important subject and I have fairly flame-retardant skin. Simon Martin[EMAIL PROTECTED] Old software engineers never die, they just fail to boot Any Trademarks used in this document are recognized as Registered Trademarks of their respective owners.
Re: Swap partition and fdisk
Gerry Jensen: While it may be untrue that you *need* twice the physical memory size, I believe it's true that twice the physical memory size is about the limit of what you can effectively use if you need it. It depends on what you do. Operating system theory has a concept called working set, which is the group of virtual memory pages that are actually used at the moment. In addition, there may other pages not in the working set that are not used. If the size of the working set is much bigger than physical memory, there will be heavy swapping and the system will perform poorly. However, it does not matter if there are lots of pages not in the working set, because they can be swapped out and won't be swapped in (at least not in the near future). For many people, the rule of twice physical size approximates the size of the working set fairly well: half of the pages are used at any one moment. For many others, it does not. It all depends on what you do. For example, if you have a getty running for six virtual consoles, but you never log in more than once, the pages of the other five gettys do not belong in the working set. They can be swapped out. In addition, if you have a sendmail daemon running, but never send any mail, then it will also be swapped out. If each getty uses 1 MB of non-shared memory, and sendmail uses 10 MB, you have now used 15 MB of swap. Assume you have 4 MB of physical memory (and that whatever you do via the one log in uses only 1 MB of memory). Your system is not swapping madly. It works splendidly. No problems at all. Even if you have used about four times as much swap as you have physical memory. These numbers are completely wrong (getty does not use that much memory), but they are good enough to show the point. The logic is sound, I just invented numbers that are easy to follow. My simple formula swap needed = total memory need - physical memory size works much better than the twice physical memory one. It does not mention working sets, mostly because then things get complicated; but I guess I should explain about it in the SAG, where there is more space. -- Please read http://www.iki.fi/liw/mail-to-lasu.html before mailing me. Please don't Cc: me when replying to my message on a mailing list. pgpiOpmRDVEI2.pgp Description: PGP signature
Re: Swap partition and fdisk
Boris Beletsky: YES! u always need a swap - no metter how much ram u have. I would say, create a 32swap part. - that would be the best. If you never use more than 16 MB of memory, and you have 512 MB of physical memory, you most definitely do not need swap. swap needed = total memory need - physical memory size It's really very simple... -- Please read http://www.iki.fi/liw/mail-to-lasu.html before mailing me. Please don't Cc: me when replying to my message on a mailing list. pgpuWALwuimhH.pgp Description: PGP signature
Re: Swap partition and fdisk
Hi -- You said: Currently, I have a DOS partition that takes up 25% of the total disk space and the rest is empty. My concern was if I would lose any data on the DOS partition if I create two Linux partitions using Linux fdisk on the empty disk space. I suppose the installation notes are conservative because cfdisk is not too forgiving if you incorrectly set your disk partition table and then write the new table to disk. But note that you have to do two things wrong in order to mess yourself up with cfdisk. First you have to set up a bad partition table, then you have to write that to disk. It sounds like you have one entry in your disk partition table now. It probably looks something like this: /dev/hda1 Boot PrimaryDOS 16-bit =32Mb 200.52 Just move your cursor down one line (so that it is NOT highlighting the line where DOS is), then select the option [New] by pressing your right arrow key until [New] is highlighted. Hit CR. Then specify how much space you want for your new partition. When you are asked whether you want to put that partition at the beginning (meaning, at the beginning of the existing unpartitioned space), just say yes. The revised partition table will then be presented to you. It should show DOS in the same place it was. Do the same thing for 1 more partition. Then change the type of that partition to a Linux swap by using the right arrow key again to highlight the word [Type], then answering the prompt by giving the number 82, which is the value for a linux swap partition. Again, you'll see the revised partition table. Still, nothing has happened to your disk. Only if and when you use the right arrow key to highlight the [Write] button, and then hit the [ENTER] key, will you have written your new partition table to disk. One thing you might do before starting (and this is a good idea anyway) is to keep a record of your existing disk partition. You can do this with this command: cfdisk /dev/hda -P t part_hda.tbl or, if you want to keep a record of the partition table using the sector format, use: cfdisk /dev/hda -P s part_hda.sec (I'm assuming the disk you're working on is the master on your primary IDE controller. If not, adjust hda to the appropriate value.) HTH, Susan Kleinmann
Re: Swap partition and fdisk
In reply to Lars Wirzenius's message: A R Abid: I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. The terse form of the formula is: swap needed = total memory need - physical memory size (Forget everything about twice physical size. That is an evil prank that people play on the uneducated rich who have bouth 512 MB of RAM.) Thank you for finally getting that right! Actually the 'twice physical memory' formula is about right for some Unix systems, HP-UX in particular. HP-UX pre-allocates swap space for physical memory, and then pre-allocates swap space for every job when it starts or malloc memory. Your formula is definitely the right one for Linux, though. First you need to estimate your total memory need. This depends very heavily on what you do and what programs you run at the same time. I need about 30-40 MB to run a mailer, Mosaic, xpat2, up to a dozen or so xterms and editors, a HTTP server, a news server, a mail server, compilers, makes, the X server, window manager, a clock, xload, desktop pager, window list, and a few other niceties. Gcc also needs several megabytes for compiling, and I recently discovered the Java compiler needs 8-10 megabytes to compile a program. On the other hand, if you are only using virtual consoles with simple programs, then 8 MB total *might* be enough. If the original person is going to be running X11, then he probably wants to add at least 8-16 MB of swap. For a somewhat more detailed explanation, read the memory management chapter in the System Administrators' Guide. The current version is 0.3, but 0.4 is imminent (I need to see how it looks on paper, but if there aren't any big problems with the that, I will release it in a couple of days). Thanks, glad to hear that.
RE: Swap partition and fdisk
-- From: A R Abid[SMTP:[EMAIL PROTECTED] Sent: Wednesday, September 18, 1996 3:45 AM To: debian-user@lists.debian.org Subject:Swap partition and fdisk I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. Also, would Linux fdisk wipe out my DOS partition even if I only want to create one Linux partition w/ Linux fdisk and not mess up w/ DOS partition using Linux fdisk. Thanks. A. R. ABID [EMAIL PROTECTED] Well...in my opinion 16 Meg is not enough to justify nuking your swap, but then I tend to run some fairly memory intensive stuff (X with xv, povray, and NExS). I've just upgraded to 64 Meg from 32, and I'm tempted to try running with no swap now, but I don't think I'd feel fully comfortable unless I had 128 Meg or more. Then again, maybe I'm just a whiner. :-) Back when I had 16 Meg, 'top' would show me using anywhere from 4 to 20 Meg of swap while running X and all the goodies. With 16 Meg you don't actually NEED a swap partition, but given my druthers I would say, give yourself about 32 Meg of swap, check out your usage with 'top' on a regular basis, and if you find you're not using it, back up your drive ,re-partition without a swap file, and then restore. Of course, that is a lot of work, but as Hicks said in Aliens 'it's the only way to be sure.' Regarding fdisk, so long as you don't actually DO anything to your DOS partitions, (ie: just make some new partitions on another drive, or on the free space of your boot drive), you shouldn't have any problems. I dual boot Win95 and Linux all the time with never a problem. This is just my $0.02 Hope it helps. Rik Ling Network Administrator Peterborough Internet Pipeline. http://www.pipcom.com/~rling (under construction, as always)
Re: Swap partition and fdisk
Hi -- You asked: I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. If you will be using memory-hungry applications (like X or httpd), then you'll definitely need some swap space. A few tens of MBytes would be a safe bet. Also, would Linux fdisk wipe out my DOS partition even if I only want to create one Linux partition w/ Linux fdisk and not mess up w/ DOS partition using Linux fdisk. Thanks. I'm not quite sure what you mean here. If your disk already has 1 partition on it that uses the entire disk, then the only way to wedge a Linux partition onto it is to use a utility like FIPS (in the tools directory at any Debian mirror) to make your DOS parition smaller. Then you can repartition whatever is left over into 3 primary partitions (or more if you want to use extended and logical partitons). One of those partitions could be your swap space. Good luck, Susan Kleinmann
Re: Swap partition and fdisk
Thank you all for replying. I was not very clear about my second question. Currently, I have a DOS partition that takes up 25% of the total disk space and the rest is empty. My concern was if I would lose any data on the DOS partition if I create two Linux partitions using Linux fdisk on the empty disk space. The installation notes say that it is POSSIBLE to wipe out any existing data while trying to create Linux partitions: Here's your first chance to wipe out all of the data on your disks, and your last chance to save your old system. My question is if it is a POSSIBILITY or a CERTAINTY to lose your existing DOS partition if you don't mess up w/ it and only make Linux partitions on the empty diskspace. Thanks. A. R. ABID [EMAIL PROTECTED] Excerpts from mail: 18-Sep-96 RE: Swap partition and fdisk by Rik [EMAIL PROTECTED] 'it's the only way to be sure.' Regarding fdisk, so long as you don't actually DO anything to your DOS = partitions, (ie: just make some new partitions on another drive, or on = the free space of your boot drive), you shouldn't have any problems. I = dual boot Win95 and Linux all the time with never a problem.
Re: Swap partition and fdisk
-BEGIN PGP SIGNED MESSAGE- On Wed, 18 Sep 1996, A R Abid wrote: aa2g+I have got 16MB of RAM on my machine. Could someone tell me if it would aa2g+still be necessary for me to create a Linux swap partition. YES! u always need a swap - no metter how much ram u have. I would say, create a 32swap part. - that would be the best. aa2g+Also, would aa2g+Linux fdisk wipe out my DOS partition even if I only want to create one aa2g+Linux partition w/ Linux fdisk and not mess up w/ DOS partition using aa2g+Linux fdisk. Thanks. no ___ Boris Beletsky [EMAIL PROTECTED] For pgp public key, e-mail me with subject get pgp-key. ___ In Linux veritas -BEGIN PGP SIGNATURE- Version: 2.6.3ia+ Charset: latin1 Comment: Boris Beletsky [EMAIL PROTECTED] iQCVAwUBMkBd/gz8DjY6pgpxAQG2FgP+LVMm7vrPKfrD6KBHGXq5/f4+ap1GkQs8 RKN9aJKsozZTrJhJquTiJQPW17Pc24x+2lshD+RVqra8tz+WZVpKJFHIHudAY/t5 UgWi84X82qs2QhaZfILl41kskD4aos76q0YQJH3QvB2LqnvTWEN4VXiBjqTGh0Ae pdmoXooGbqU= =QbyX -END PGP SIGNATURE-
Re: Swap partition and fdisk
A R Abid ([EMAIL PROTECTED]) wrote: : I have got 16MB of RAM on my machine. Could someone tell me if it would : still be necessary for me to create a Linux swap partition. If you want to run X and some apps I highly recommend that you use some swap space (at least 32MB). How much you really need depends on how you use the system. (If you run xemacs+latex+ghostview+netscape+20xterms like I frequently do, then you'll probably need more than 32MB swap and you'd want to upgrade your RAM to 32MB in order to reduce paging activities) : Also, would : Linux fdisk wipe out my DOS partition even if I only want to create one : Linux partition w/ Linux fdisk and not mess up w/ DOS partition using : Linux fdisk. Nope, if you don't mess with the DOS partitions they should remain intact. At least it always worked for me. But making a backup isn't a bad idea anyway... BTW, if you want to shrink a DOS partition, you should take a look at fips. --Chris -- Christian Linhart [EMAIL PROTECTED], [EMAIL PROTECTED] Software Development * Internetworking * LinuxGNU Support snail-mail: Wagingerstra_e 12/6, A-5020 Salzburg, AUSTRIA/EUROPE
Re: Swap partition and fdisk
A R Abid: I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. The terse form of the formula is: swap needed = total memory need - physical memory size (Forget everything about twice physical size. That is an evil prank that people play on the uneducated rich who have bouth 512 MB of RAM.) First you need to estimate your total memory need. This depends very heavily on what you do and what programs you run at the same time. I need about 30-40 MB to run a mailer, Mosaic, xpat2, up to a dozen or so xterms and editors, a HTTP server, a news server, a mail server, compilers, makes, the X server, window manager, a clock, xload, desktop pager, window list, and a few other niceties. For a somewhat more detailed explanation, read the memory management chapter in the System Administrators' Guide. The current version is 0.3, but 0.4 is imminent (I need to see how it looks on paper, but if there aren't any big problems with the that, I will release it in a couple of days). Also, would Linux fdisk wipe out my DOS partition even if I only want to create one Linux partition w/ Linux fdisk and not mess up w/ DOS partition using Linux fdisk. Thanks. If you have unpartitioned disk space at the end of the disk, there should be no problem. If not, you need to backup and reinstall everything. -- Please read http://www.iki.fi/liw/mail-to-lasu.html before mailing me. Please don't Cc: me when replying to my message on a mailing list. pgpcztrko6zsv.pgp Description: PGP signature
Re: Swap partition and fdisk
On Wed, 18 Sep 1996, A R Abid wrote: [SNIP] My question is if it is a POSSIBILITY or a CERTAINTY to lose your existing DOS partition if you don't mess up w/ it and only make Linux partitions on the empty diskspace. Thanks. It is a possibility. I've done it a dozen times without losing the primary DOS partition. Syrus. -- Syrus Nemat-Nasser [EMAIL PROTECTED]UCSD Physics Dept.
Swap partition and fdisk
I have got 16MB of RAM on my machine. Could someone tell me if it would still be necessary for me to create a Linux swap partition. Also, would Linux fdisk wipe out my DOS partition even if I only want to create one Linux partition w/ Linux fdisk and not mess up w/ DOS partition using Linux fdisk. Thanks. A. R. ABID [EMAIL PROTECTED]