RE: [opensuse] Creating a swap file
On Thursday 11 January 2007 16:12, James D. Parra wrote:
...
Okay, this is interesting.
#dd if=/dev/zero of=/extra-swap bs=2GB count=1K dd: memory exhausted
You're asking dd to allocate a single, contiguous 2 gigabyte block of primary storage (a.k.a. RAM) to use as the buffer for transferring the data from the input to the output. And as Patrick pointed out, if this did succeed, you'd need a file system with space available to hold a 2 terabyte file, since you're trying to write those 2 gigabytes to the file 1024 times. Try this: % dd if=/dev/zero of=/extra-swap bs=2M count=1K ~~~ Okay, I got it. I now see what this is doing and how it is being done. Everything is working. Thank you all for your illuminating responses. ~James -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
James D. Parra wrote:
On Thursday 11 January 2007 16:12, James D. Parra wrote:
...
Okay, this is interesting.
#dd if=/dev/zero of=/extra-swap bs=2GB count=1K dd: memory exhausted
You're asking dd to allocate a single, contiguous 2 gigabyte block of primary storage (a.k.a. RAM) to use as the buffer for transferring the data from the input to the output.
And as Patrick pointed out, if this did succeed, you'd need a file system with space available to hold a 2 terabyte file, since you're trying to write those 2 gigabytes to the file 1024 times.
Try this:
% dd if=/dev/zero of=/extra-swap bs=2M count=1K
~~~
Okay, I got it. I now see what this is doing and how it is being done.
Everything is working. Thank you all for your illuminating responses.
~James
Everything very useful in this topic but... Do you really need a swap file bigger than 1GB? Remember that, as a rule of thumb, swap file should be the double of your RAM size but anyway not useful bigger than 1GB. Regards, Jan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* jan kalcic
Everything very useful in this topic but... Do you really need a swap file bigger than 1GB? Remember that, as a rule of thumb, swap file should be the double of your RAM size but anyway not useful bigger than 1GB.
I have 4gb ram and .5gb swap and after 45 days up, only 26mb swap is used. htop reports 277 total tasks with 15 running atm. -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2 OpenSUSE Linux http://en.opensuse.org/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
* jan kalcic
[01-11-07 21:39]: [...] Everything very useful in this topic but... Do you really need a swap file bigger than 1GB? Remember that, as a rule of thumb, swap file should be the double of your RAM size but anyway not useful bigger than 1GB.
I have 4gb ram and .5gb swap and after 45 days up, only 26mb swap is used.
htop reports 277 total tasks with 15 running atm.
That's what meant. You don't need 5gb of swap file at all. Regards, Jan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* jan kalcic
Patrick Shanahan wrote:
I have 4gb ram and .5gb swap and after 45 days up, only 26mb swap is used.
htop reports 277 total tasks with 15 running atm.
That's what meant. You don't need 5gb of swap file at all.
that's .5, point five, not 5gb -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2 OpenSUSE Linux http://en.opensuse.org/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2007-01-11 22:00, Patrick Shanahan wrote:
<snip>
that's .5, point five, not 5gb
With 4G system memory, you could probably get away with point-oh-five of swap space :-) -- The best way to accelerate a computer running Windows is at 9.81 m/s² -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
I have 4gb ram and .5gb swap and after 45 days up, only 26mb swap is used.
htop reports 277 total tasks with 15 running atm.
I have always thought that the larger the real memory the smaller the swap space required. There are exceptions of course. In general, if your system uses a large swap space then you need to add more memory. Terry -- openSUSE 10.2 (i586) -- 2.6.18.2-34-default -- Thu 01/11/07 9:00pm up 10 days 3:15, 5 users, load average: 0.21, 0.71, 0.70 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Terry Eck wrote:
Patrick Shanahan wrote:
I have 4gb ram and .5gb swap and after 45 days up, only 26mb swap is used.
htop reports 277 total tasks with 15 running atm.
I have always thought that the larger the real memory the smaller the swap space required. There are exceptions of course. In general, if your system uses a large swap space then you need to add more memory.
Terry
You've always thought great! I'd not say 26mb is a lot! :) Regards, Jan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 11 January 2007 19:04, Terry Eck wrote:
...
I have always thought that the larger the real memory the smaller the swap space required. There are exceptions of course. In general, if your system uses a large swap space then you need to add more memory.
There's no fixed relationship and its never strictly necessary to have any swap space at all. Rules of thumb are just that: rough, generic guidelines that may be suitable for some non-negligible fraction of installations, but which cannot possibly be optimum for all but a few particular installations. The only thing you can say for sure is that whenever the system's overall working set size exceeds the available RAM, you'll be thrashing (if swap space is available at all). And if the total RAM required exceeds available physical RAM plus swap, then the unlucky process that tries to exceed that limit will simply not be able to get the RAM allocation it requests. If it cannot explicitly handle that condition, it will be terminated.
Terry
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Thursday 11 January 2007 19:04, Terry Eck wrote:
...
I have always thought that the larger the real memory the smaller the swap space required. There are exceptions of course. In general, if your system uses a large swap space then you need to add more memory.
There's no fixed relationship and its never strictly necessary to have any swap space at all. Rules of thumb are just that: rough, generic guidelines that may be suitable for some non-negligible fraction of installations, but which cannot possibly be optimum for all but a few particular installations.
That's true, there's no fixed relationship but there's a rule of thumb. And rule of thumb is very usefull for almost everybody. Think of partitioning during installation. You'll never know how much virtual memory you need so you follow a rule of thumb. Then, you can tune it if you really need it, right. But I don't think this is the case as the guy posted here said he added swap just because he's added RAM. Regards, Jan
The only thing you can say for sure is that whenever the system's overall working set size exceeds the available RAM, you'll be thrashing (if swap space is available at all). And if the total RAM required exceeds available physical RAM plus swap, then the unlucky process that tries to exceed that limit will simply not be able to get the RAM allocation it requests. If it cannot explicitly handle that condition, it will be terminated.
Terry
Randall Schulz
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 11 January 2007 19:46, jan kalcic wrote:
Randall R Schulz wrote:
...
There's no fixed relationship and its never strictly necessary to have any swap space at all. Rules of thumb are just that: rough, generic guidelines that may be suitable for some non-negligible fraction of installations, but which cannot possibly be optimum for all but a few particular installations.
That's true, there's no fixed relationship but there's a rule of thumb. And rule of thumb is very usefull for almost everybody.
Almost everybody? Unlikely. If there's a useful rule of thumb, then it would not take the form X * physical memory for some arbitrary constant X. Rather, it would be something more like: P - (K + B + U) where: - P is the physical RAM - K is the minimal kernel requirements - B is the baseline memory requirements defined by the ordinary operating configuration, including things like fixed system services, server processes (Apache, NFS servers, Tomcat, SSH daemon, etc.) selected by the configuring user, the GUI subsystem requirements and other programs that must run just to get the expected user base logged in and running - U is the amount of memory required to run the set of concurrently running programs that characterize the typical users' application mix. It will be the rare system for which this equals 2 * P (or any other fixed multiple of P).
...
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 11 January 2007 20:45, Randall R Schulz wrote:
...
Rather, it would be something more like:
P - (K + B + U)
By which I mean this, of course: (K + B + U) - P
....
RRS -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
The only thing you can say for sure is that whenever the system's overall working set size exceeds the available RAM, you'll be thrashing (if swap space is available at all). And if the total RAM required exceeds available physical RAM plus swap, then the unlucky process that tries to exceed that limit will simply not be able to get the RAM allocation it requests. If it cannot explicitly handle that condition, it will be terminated.
...By the way, all this discussion has been about swap _files_, which for a long time were not possible under linux. Until fairly recently, swapping had to be to and from partitions. I set my linux systems up that way, and never bothered to look at swap files at all after they became available. Are there any advantages to one arrangement over the other? It seems there would be some advantage to having the possibility of building a new swap file if you're short on swap space. Not that I expect to ever have the issue. I have a 2G partition which has never had more than a couple of hundred MB in use, and that only because I keep several large programs running all the time so I don't have to wait for them to start up. -- John Perry -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 11 January 2007 20:50, John E. Perry wrote:
...
...By the way, all this discussion has been about swap _files_, ...
Are there any advantages to one arrangement over the other? It seems there would be some advantage to having the possibility of building a new swap file if you're short on swap space.
The only time I've used a swap file is when I needed to increase available swap and repartitioning was inconvenient. And when is repartitioning convenient?
...
John Perry
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
...By the way, all this discussion has been about swap _files_, which for a long time were not possible under linux. Until fairly recently, swapping had to be to and from partitions. Fairly recently, in geological terms, you mean? ISTR setting up a linux swap file in 1993 or so, sort of an "oops I needed a bigger swap
John E. Perry wrote: partition" kind of thing. Joe -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
J Sloan wrote:
...By the way, all this discussion has been about swap _files_, which for a long time were not possible under linux. Until fairly recently, swapping had to be to and from partitions. Fairly recently, in geological terms, you mean? ISTR setting up a linux swap file in 1993 or so, sort of an "oops I needed a bigger swap
John E. Perry wrote: partition" kind of thing.
Geez, has it really been that long? I didn't buy 5.0 until 1996 or so, and I distinctly remember being in terror at the prospect of killing a disk by changing all that partitioning. Or maybe it was even earlier when I tried unsuccessfully to make Slackware work? -- John Perry -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
jan kalcic wrote:
Everything very useful in this topic but... Do you really need a swap file bigger than 1GB? Remember that, as a rule of thumb, swap file should be the double of your RAM size but anyway not useful bigger than 1GB.
This depends on your usage. I have 2 GB main memory, and several VMwares instances at the same time. But mostly only one of them is active. (The one that I use for current tests.) Swapping the unused is OK, as long as one can wait for the disk thrashing when one re-activates it. It's faster and more convenient than VMware suspend, if one uses a different VMware every 15 minutes or so. Using only 1GB swap spaces would be counterproductive since they fill up so fast if VMwares are swapped out... :-) Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (9)
-
Darryl Gregorash
-
J Sloan
-
James D. Parra
-
jan kalcic
-
Joachim Schrod
-
John E. Perry
-
Patrick Shanahan
-
Randall R Schulz
-
Terry Eck