diff options
author | David Sterba <dsterba@suse.com> | 2023-01-09 18:22:56 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-01-25 16:19:36 +0100 |
commit | 54b90cb6e537a899728c5a9c4fe9e7220003222e (patch) | |
tree | 2b0ed0d41c7019c384dd67e161f0f90f0f53373e /Documentation | |
parent | 660d10d3fb2e87909d379b0ea3c52934543455c7 (diff) | |
download | btrfs-progs-54b90cb6e537a899728c5a9c4fe9e7220003222e.tar.gz |
btrfs-progs: fi mkswapfile: fix page count in header
Per user report on https://old.reddit.com/r/btrfs/comments/107fnw1/btrfs_filesystem_mkswapfile_results_in_an/
the swapfile header does not contain the correct number of pages that
matches the file size and the activated swapfile is only 1GiB:
# btrfs filesystem mkswapfile -s 10g swapfile
# swapon swapfile
# cat /proc/swaps
Filename Type Size Used Priority
/swap/swapfile file 1048572 0 -2
A workaround is to run 'mkswap swapfile' before activation. Proper fix
is to calculate the number of (fixed size) 4K pages available for the
swap.
Issue: #568
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/btrfs-filesystem.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Documentation/btrfs-filesystem.rst b/Documentation/btrfs-filesystem.rst index 24d7157d..bd1161ac 100644 --- a/Documentation/btrfs-filesystem.rst +++ b/Documentation/btrfs-filesystem.rst @@ -190,7 +190,7 @@ label [<device>|<mountpoint>] [<newlabel>] mkswapfile [-s size] file Create a new file that's suitable and formatted as a swapfile. Default - size is 2GiB, minimum size is 40KiB. + size is 2GiB, fixed page size 4KiB, minimum size is 40KiB. A swapfile must be created in a specific way: NOCOW and preallocated. Subvolume containing a swapfile cannot be snapshotted and blocks of an @@ -200,6 +200,10 @@ mkswapfile [-s size] file needs to be done by command ``swapon(8)``. See also command ``btrfs inspect-internal map-swapfile`` and the :doc:`Swapfile feature<Swapfile>` description. + .. note:: + The command is a simplified version of 'mkswap', if you want to set + label, page size, or other parameters please use 'mkswap' proper. + ``Options`` -s|--size SIZE |