Creating a Swap File Step 1: Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 1024MB/1GB swap file is 1048576. Step 2: At a shell prompt as root, type the following command with count being equal to the desired block size: dd if=/dev/zero of=/swapfile bs=1024 count=1048576 Step 3: Setup the swap file wit..