Conversation
* ynh_add_swap helper: check if main partition is a btrfs file system before applying chattr * ynh_del_swap : check that the file is mounted as swap before trying swappoff
alexAubin
reviewed
Oct 4, 2025
alexAubin
reviewed
Oct 4, 2025
Member
|
I'm not sure it's available on debian, but we can use this for swapfile on btrfs: Because from what I saw, if there is a swapfile on a subvolume (/ for example), the snapshot fails |
zamentur
reviewed
Jan 22, 2026
| if [[ "$root_fs_type" == "btrfs" ]]; then | ||
| chattr +C "/swap_$app" | ||
| else | ||
| echo "Skipping chattr +C for swap because the root filesystem is btrfs which doesn't support this attribute" |
Member
There was a problem hiding this comment.
Suggested change
| echo "Skipping chattr +C for swap because the root filesystem is btrfs which doesn't support this attribute" | |
| echo "Skipping chattr +C for swap because the root filesystem is '$root_fs_type' which doesn't support this "no copy-on-write" attribute" |
zamentur
reviewed
Jan 22, 2026
| # try to set the No_COW attribute on the swapfile with chattr (depending of the filesystem type) | ||
| chattr +C "/swap_$app" 2> /dev/null | ||
| local root_fs_type=$(cat /proc/mounts | awk '{ if ($2 == var) print $3 }' var="/") | ||
| if [[ "$root_fs_type" == "btrfs" ]]; then |
Member
There was a problem hiding this comment.
I suggest to add f2fs https://elixir.bootlin.com/linux/v6.18.6/A/ident/FS_NOCOW_FL
Suggested change
| if [[ "$root_fs_type" == "btrfs" ]]; then | |
| if [[ "$root_fs_type" == "btrfs" || "$root_fs_type" == "f2fs" ]]; then |
Member
In my ynh-dev container (using btrfs) it's available @kay0u could you say if the snapshot fail with chattr +C or without ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Related to YunoHost/issues#2670
Solution
PR Status
...
How to test
...