How to Create Swap Partition in Linux

April 5th, 2016 by usage | Filed under Linux/Unix

How to Create Swap Partition in Linux

# dd if=/dev/zero of=/swap.dat bs=1024 count=512K
# mkswap /swap.dat
# swapon /swap.dat

524288+0 records in524288+0 records out
536870912 bytes (537 MB) copied, 3.17728 s, 169 MB/s

Edit the /etc/fstab, and the following entry.

/swap.dat      none    swap    sw      0       0


count= was supposed to be K, but in the article it's in MB


You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a comment.

To leave a comment, please fill in the fields below.