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

Error on wiki page for swap



  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.

  dd is a very bad piece of software to issue a wrong command with, and people may not think twice before copying it to a terminal since it is from the official debian wiki.

I apologize for taking your time with this instead of correcting it myself, but I tried registering and registration is disabled. I intended to add a section for creating swapfiles on btrfs (what I originally was looking for,) and submit a correction to the dd section such as this;
 
dd if=/dev/zero of=/PATH/FILENAME bs=1MiB count=TIMESBS
...
...and TIMESBS is the size you wish your swap file to be in megabytes (for example 1024 will result in 1 gigabyte).

Thank you,
Anthony.

PS. Apologies for any awkward use of the english language, same as many others it is my second one.

Reply to: