Skip to main content

Ubuntu: Create swap partition

A swap file allows an operating system to use hard disk space to simulate extra memory.

$ sudo fallocate -l 2G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
Create swap file
Create swap file
Make swapfile permanent
Adjust the swappiness property
Adjust the swappiness property

Make swap partition on Debian 10 VM micro.f1 running on GCP

tuyen@gcpfreetier-vm1:~$ sudo fallocate -l 1G /swapfile
tuyen@gcpfreetier-vm1:~$ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
tuyen@gcpfreetier-vm1:~$ sudo chmod 600 /swapfile 
tuyen@gcpfreetier-vm1:~$ sudo mkswap /swapfile 
tuyen@gcpfreetier-vm1:~$ sudo swapon /swapfile 

Then edit /etc/fstab file: add to the end of file

...
/swapfile swap swap defaults 0 0

Finally, run sudo mount -a

Popular posts from this blog

Powershell: Get-ChildItem

List, search/find files and directories with Get-ChildItem cmdlet.

Linux command: Check Current Shell

What is your current shell ?

Java: Free Online Courses

The Java™ Tutorials by Oracle The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails". https://docs.oracle.com/javase/tutorial/ Learn to Program in Java at edX.ogr Get started on the path to becoming a software engineer by learning core coding skills in Java—one of the most popular programming languages. https://www.edx.org/course/learn-to-program-in-java-0 Java Tutorial by javapoint.com https://www.javatpoint.com/java-tutorial Java Tutorial by SoloLearn.com I love SoloLearn because I can learn Java - and other popular programming languages - anywhere, any time on your mobile devices. https://www.sololearn.com/Course/Java/ Java on Azure https://docs.microsoft.com/en-us/learn/paths/java-on-azure/