I ran this command sudo dd if=/dev/zero of=/swap bs=1024 count=16G but I ended up running out of space because the count did not stop how much to write to that file for some reason. It might because I have the G in front of the 16 or something? Any idea how do I insert it directly in gigabyte measurement or did I do something else wrong?
Count doesn’t tell the dd command to create a file of this size, it tells the dd command to create a file made up of that many blocks of the size specified by the bs parameter. In this case your dd command will create a swap file made up of 16G (1610241024*1024) blocks that are each 1024 bytes creating a file that is ‘count * bs’ large, or somewhere around a 16TB file in this case … which is probably not what you want.
The following dd command will create a file that shows up with a size of 17.2 GB in Nautilus…
dd if=/dev/zero of=~/swap bs=1024 count=16M
here is the listing of the created file
-rw-r--r-- 1 todd todd 17179869184 Nov 27 08:24 swap
I have yet to see my computer use any of this swapfile, nor in the past use any of the disk when I created a swap partition. I’m beginning to doubt the need for any swap at all.