btrfs 上の file を swap file として利用しようとすると,以下のように kernel に怒られる.
[1646778.804931] BTRFS warning (device nvme0n1): swapfile must not be copy-on-write
これを回避するには以下のようにして copy-on-write (CoW) の機能を off にしたファイルを作成して swapon
する(要 Linux 5.0以降).
% sudo touch swap
% sudo lsattr swap
-------------------- swap
% sudo chattr +C swap
% sudo lsattr swap
---------------C---- swap
% sudo fallocate -l 2g swap
% sudo chmod 600 swap
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=(snip)
% sudo swapon swap
touch
してから fallocate
する必要があるので注意.See man chattr
.
A file with the ‘C’ attribute set will not be subject to copy-on-write updates. This flag is only supported on file systems which perform copy-on-write. (Note: For btrfs, the ‘C’ flag should be set on new or empty files. If it is set on a file which already has data blocks, it is undefined when the blocks assigned to the file will be fully stable. If the ‘C’ flag is set on a directory, it will have no effect on the directory, but new files created in that directory will have the No_COW attribute set.)
Related articles
- 2020/09/11 20:24 / Linux 5.9-rc4
- 2020/07/12 16:42 / Linux 5.8-rc4
- 2020/05/01 21:21 / Linux 5.7-rc1
- 2020/04/03 22:18 / Linux 5.6.x fs/cachefiles/rdwr.c bug
- 2020/02/22 19:33 / Linux 5.6-rc2
- 2020/01/11 20:50 / Linux 5.5-rc5
- 2019/11/25 14:45 / nvidia-kernel-dkms 418.74-1 with Linux 5.4
- 2019/10/02 00:03 / Linux 5.3.1 -> 5.4-rc1
- 2019/09/20 14:45 / nvidia-kernel-dkms 418.74-1 with Linux 5.3
- 2019/07/22 19:13 / Linux 5.2.2 -> 5.3-rc1
- 2019/06/28 20:38 / GeForce GT 430 with nvidia-legacy-390xx-kernel-dkms 390.116-1~bpo9+1
- 2019/06/12 16:10 / Linux 5.1.8 -> 5.2-rc4
- 2019/05/07 19:43 / Linux 5.0.9 -> 5.1.0
- 2019/03/07 22:16 / Linux 4.20.13 -> 5.0.0
- 2018/11/06 11:30 / Linux 4.19.0 -> 4.20-rc1
- 2018/08/29 11:06 / Linux 4.18.5 -> 4.19-rc1
- 2018/06/20 17:06 / Linux 4.17.2 -> 4.18-rc1
- 2018/04/19 15:25 / Linux 4.16.2 -> 4.17-rc1
- 2018/02/12 17:23 / Linux 4.15.3 -> 4.16-rc1
- 2018/01/29 11:08 / Linux 4.14.15 -> 4.15
- 2017/11/28 12:42 / Linux 4.14.2 -> 4.15-rc1
- 2017/11/15 15:56 / Linux ORC unwinder と objtool (CONFIG_STACK_VALIDATION needs tools/objtool/objtool along headers)
- 2017/11/15 15:41 / Linux 4.13.12 -> 4.14.0
- 2017/09/18 07:04 / Linux 4.13.1 -> 4.14-rc1
- 2017/09/05 04:14 / Linux 4.12.10 -> 4.13
- 2017/07/16 23:56 / Linux 4.12.0 -> 4.13-rc1
- 2017/05/15 14:04 / Linux 4.11.0 -> 4.12-rc1
- 2017/05/03 00:24 / Linux 4.10.13 -> 4.11.0
- 2017/03/06 09:51 / Linux 4.10.1 -> 4.11-rc1
- 2017/02/20 10:31 / Linux 4.9.X -> 4.10
- 2016/12/30 21:28 / Linux 4.9 -> 4.10-rc1
- 2016/12/14 23:00 / Linux 4.8 -> 4.9