title: Linux create swap using dd: swapon failed: Invalid argument
body: <p>I have a swap file called /dev/dm-1 with 1G size, try to increase the size of the swap file to 4G using the steps below:</p>
  <ol>
  <li>Turn off swap: <code>swapoff /dev/dm-1</code></li>
  <li>Remove old swap file:
  <code>rm /dev/dm-1</code></li>
  <li>Create swap file using <code>dd</code> comand: <code>dd if=/dev/zero of=/dev/dm-1 count=4096 bs=1MiB status=progress
  </code></li>
  <li>Restrict privelages: <code>chmod 600 /dev/dm-1</code></li>
  <li>Setting up swapspace: <code>mkswap /dev/dm-1</code></li>
  <li>Start swap: <code>swapon /dev/dm-1</code></li>
  </ol>
  <p><strong>After starting up swap that show error <code>swapon failed: Invalid argument</code></strong></p>
  <p>I using <code>SMP Debian 4.19.181-1 (2021-03-19)</code> and filesystem is <code>ext4</code></p>
  <p>Can someone help?</p>