Re: Error on wiki page for swap

Steve McIntyre <[email protected]>
Newsgroups gmane.linux.debian.devel.www
Message-ID <[email protected]>
Hi!

Thanks for wanting to improve things!

On Wed, Mar 23, 2022 at 07:34:43PM +0200, Anthony-John Vikare wrote:
>  Hello,
>  the wiki on swap ( https://wiki.debian.org/Swap ) states:
>
>    dd if=/dev/zero of=/PATH/FILENAME bs=1024 count=SIZE
>    ...
>    ...and SIZE is the size you wish your swap file to be in kilobytes (for example 1048576 is 1 gigabyte).
>
> This (as stated) is incorrect and will result in dd creating a file way larger
>than intended and potentially catastrophic for the system as an attempted count
>=1GiB (very modest and as per the wiki example) times bs=1024 will result in dd
>writing 1 Terabyte (1024 GiB) of zeros; a potentially catastrophic action on
>most ssds/NVMes, especially considering an attempted 4-8GiB swap file *AND*
>that dd has to be elevated with su/sudo/doas.

However, I *don't* see an error here. The snippet you've shared looks
correct - using a value of 1048576 (1M) for count here will generate a
1G file, just as it says. Maybe you've mis-read it?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.