Giter VIP home page Giter VIP logo

btrfs-swapon's Introduction

btrfs-swapon

From kernel 5.0+ btrfs have native swap files support, but with some limitations. Swap file - must be fully allocated as NOCOW with no compression on one device.

-- https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F

Btrfs doesn't allow to swap on a file. This script allows you do swap on a file anyway.

Keep in mind, that a copy-on-write file system is not the best choice to use a swap file. Don't expect high performance.

This script is based on http://www.spinics.net/lists/linux-btrfs/msg28533.html and https://gist.github.com/romaninsh/118952ce61643914fb00

Usage

Usage: btrfs-swapon <size> <file>
       btrfs-swapoff <file>

size:      the size of the file, like "8G"
file:      path to the swap file.

Using the systemd service

Installing

cp btrfs-swapoff btrfs-swapon /sbin/
cp btrfs-swapon.service /etc/systemd/system/

executing systemctl

systemctl start btrfs-swapon.service
systemctl stop btrfs-swapon.service

WARNNG

Don't balance your file system as long as you use this swap file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.