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

Re: Error on wiki page for swap



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?

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"...In the UNIX world, people tend to interpret `non-technical user'
 as meaning someone who's only ever written one device driver." -- Daniel Pead


Reply to: