TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: DENNIS LEE BIEBER
from: MARTIN GREGORIE
date: 2020-01-27 22:38:00
subject: Re: Question about ever g

On Mon, 27 Jan 2020 16:22:21 -0500, Dennis Lee Bieber wrote:

> Everything I've found in Google implies that one first allocates
> a file of known size (cf:
> https://help.ubuntu.com/community/SwapFaq#How_do_I_add_a_swap_file.3F )
> which sort of indicates that it does not grow dynamically.
>
I did say that I don't use swapfiles apart from the default one set up by
noobs on my RPi !

man 8 swapon   has just about all you need to know, including how to
create a swapfile (using dd and /dev/zero - use dd to copy from /dev/zero,
specifying the size with something like

dd if=/dev/zero of=/swapfile  bs=512 count=3906250

should create a 2GB swapfile called 'swapfile' in the root directory.
'count' is the required file size in bytes divided by the block size
specified with the 'bs' parameter 512 bytes is the default blocksize
given on the 'dd manpage.


> That sounds more like Windows behavior, where swap files are
> given an initial size, and a maximum size (I think I normally make
> Windows swap a fixed size since the OS can allocate a contiguous chunk
> of disk, rather than risk a "split" swap).
>
Could well be: as I said, I've never had to set up a swapfile because all
my non-RPIs boxes use swap partitions.

> And that brings up the biggest problem with a Linux swap file --
> it is
> likely not going to be contiguous even on disk AND if on an SD card (or
> other flash media -- even an SSD can be killed by a system that is
> swapping heavily)... Flash memory behavior means that it is likely every
> page swap to SD card will trigger a new allocation unit erase/write
> cycle and wear leveling means nothing is contiguous.
>

man 8 swapon

is your friend.

And a reminder to those newer to Linux: running "apropos xxxxxx"
gives you a list with single line descriptions of every manpage with
"xxxxxx" in the manpage's initial NAME section. It has the format:

name(s) - one line summary description

Find one that looks interesting and then use the command "man progname"
to see the manpage for that program or subject.

The command "man man" shows you the manpage describing 'man'. Read it to
understand the significance of the '8' in my example of reading the
swapon manpage.


--
Martin    | martin at
Gregorie  | gregorie dot org

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.