Code Monkey home page Code Monkey logo

btrfs-map-physical's Introduction

btrfs-map-physical

Tool to calculate resume_offset for btrfs

Copied from osandov-linux without the rest of the scripts I don't need

Instructions for hibernation

  1. Compile with make all
  2. run ./btrfs_map_physical /path/to/swapfile

Example output:

FILE OFFSET  EXTENT TYPE  LOGICAL SIZE  LOGICAL OFFSET  PHYSICAL SIZE  DEVID  PHYSICAL OFFSET
0            regular      4096          2927632384      268435456      1      4009762816
4096         prealloc     268431360     2927636480      268431360      1      4009766912
268435456    prealloc     268435456     3251634176      268435456      1      4333764608
536870912    prealloc     268435456     3520069632      268435456      1      4602200064
805306368    prealloc     268435456     3788505088      268435456      1      4870635520
1073741824   prealloc     268435456     4056940544      268435456      1      5139070976
1342177280   prealloc     268435456     4325376000      268435456      1      5407506432
1610612736   prealloc     268435456     4593811456      268435456      1      5675941888
  1. Note the first physical offset returned by this tool. In this example, we use 4009762816
  2. Get the pagesize with getconf PAGESIZE
  3. To compute the resume_offset value, divide the physical offset by the pagesize. In this example, it is 4009762816 / 4096 = 978946
  4. Set the resume=swap_device and resume_offset=swap_file_offset kernel parameters. For example, for grub: Add GRUB_CMDLINE_LINUX="resume=UUID=ROOT_UUID resume_offset=RESUME_OFFSET" in /etc/default/grub and then regenerate the grub configuration.

See Arch Wiki for more information

btrfs-map-physical's People

Contributors

simonhughxyz avatar

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.