btrfs-progs: docs: how to use swapfile from fstab
This was asked on reddit, how to automatically mount a swapfile from fstab. As this is not completely obvious, document it with an example. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c266dd462b
commit
47fdb7f5da
|
@ -684,6 +684,8 @@ When there are no active swapfiles and a whole-filesystem exclusive operation
|
||||||
is running (ie. balance, device delete, shrink), the swapfiles cannot be
|
is running (ie. balance, device delete, shrink), the swapfiles cannot be
|
||||||
temporarily activated. The operation must finish first.
|
temporarily activated. The operation must finish first.
|
||||||
|
|
||||||
|
To create and activate a swapfile run the following commands:
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
# truncate -s 0 swapfile
|
# truncate -s 0 swapfile
|
||||||
# chattr +C swapfile
|
# chattr +C swapfile
|
||||||
|
@ -693,6 +695,28 @@ temporarily activated. The operation must finish first.
|
||||||
# swapon swapfile
|
# swapon swapfile
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
Please note that the UUID returned by the 'mkswap' utility identifies the swap
|
||||||
|
"filesystem" and because it's stored in a file, it's not generally visible and
|
||||||
|
usable as an identifier unlike if it was on a block device.
|
||||||
|
|
||||||
|
The file will appear in '/proc/swaps':
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
# cat /proc/swaps
|
||||||
|
Filename Type Size Used Priority
|
||||||
|
/path/swapfile file 2097152 0 -2
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The swapfile can be created as one-time operation or, once properly created,
|
||||||
|
activated on each boot by the 'swapon -a' command (usually started by the
|
||||||
|
service manager). Add the following entry to '/etc/fstab', assuming the
|
||||||
|
filesystem that provides the '/path' has been already mounted at this point.
|
||||||
|
Additional mount options relevant for the swapfile can be set too (like
|
||||||
|
priority, not the btrfs mount options).
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
/path/swapfile none swap defaults 0 0
|
||||||
|
--------------------
|
||||||
|
|
||||||
CHECKSUM ALGORITHMS
|
CHECKSUM ALGORITHMS
|
||||||
-------------------
|
-------------------
|
||||||
|
|
Loading…
Reference in New Issue