Re: swap byte size?!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20:48 20 Jul 2004, kalin mintchev <kalin@xxxxxx> wrote:
| i want to add a swap file to my system. following the rule of 2 to 1 the
| file would need to be 2 gigs because the ram is a gig. but using the dd
| command what do i put for bs and count?
| i was looking around on google but couldn't exactly find it..

block size * count should equal your swap file size.
You want count to be "small". So:

	% dc
	1024 1024 *p
	1048576
	% dd if=/dev/zero count=1024 bs=1048576 of=your-swap-file
	%

In fact, you can probably do it in a single write:

	% dc
	1024 1024 1024 **p
	1073741824
	% dd if=/dev/zero count=1 bs=1073741824 of=your-swap=-file

I just did that on a machine here and it took quite a while.  That may
be because a big block size will map a chunk of memory, virtually,
and as you fill it from /dev/zero that will cycle your RAM to swap as
things fill. So probably you want a big blocksize, but not as big as
possible. One megabyte should do nicely - big enough to move a lot of
data per write, small enough that its memory footprint doesn't blow your
RAM usage.

The basic deal is that small block size and large count means lots of
write() calls, and that is inefficiency because each such call has some
overhead; to minimise that you minimise count and maximise blocksize
without getting silly.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

The problem is, every time something goes wrong, the paperwork is found
in order...     - Walker on NASA


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux