From the course: Linux System Engineer: Advanced Disk Systems and System Backup

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create temporary swap files

Create temporary swap files

From the course: Linux System Engineer: Advanced Disk Systems and System Backup

Start my 1-month free trial

Create temporary swap files

- [Male Instructor] A Windows style swap file is possible in Linux, although not always desirable. Accessing a swap file takes longer than accessing a raw partition, making it slower. The reason we may want to create a swap file is flexibility. We may not have any free space on our drive to create a new partition for swap. In this case, we would create a new logical volume and make it swap. If that's not possible, then creating a swap file is our only choice. Due to the slower speed, a swap file should always have a lower priority than a swap partition. Let's check to see how much free space we have on our root drive. In a Terminal, type in "df -H" and hit Enter. It looks like we have about 1.8 gigabytes of free space Let's create a 500 megabyte swap file. We'll create this using DD. Type in "Clear" and then type in "sudo dd if=/dev/zero" as our input file. Space "of=/swapfile" is the name of the swap file. Space "count=1 bs=500MiB". This is the block size. And hit Enter. Type in your…

Contents