Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
F2FS discard or nodiscard?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
MickKi
Veteran
Veteran


Joined: 08 Feb 2004
Posts: 1173

PostPosted: Fri Mar 22, 2024 7:12 pm    Post subject: F2FS discard or nodiscard? Reply with quote

Hi All,

I created 2 partitions and formatted them with f2fs. Looking at mount options I see the / partition is mounted with discard and the /home is mounted with nodiscard:
Code:
~ # findmnt | grep discard
/                             /dev/nvme0n1p2      f2fs        rw,noatime,lazytime,background_gc=on,nogc_merge,discard,discard_unit=block,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,barrier,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,checkpoint_merge,fsync_mode=posix,compress_algorithm=lz4:5,compress_log_size=2,compress_mode=fs,memory=normal,errors=continue
├─/home                       /dev/mapper/newhome f2fs        rw,noatime,lazytime,background_gc=on,nogc_merge,nodiscard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,barrier,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,checkpoint_merge,fsync_mode=posix,compress_algorithm=lz4:5,compress_log_size=2,compress_mode=fs,memory=normal,errors=continue


I'm trying to understand why this is the case when both have the same mount options in fstab:
Code:
defaults,compress_algorithm=lz4:5,noatime   0 0


If I try to run discard on /home I get:
Code:
 ~ # fstrim -v /home
fstrim: /home: the discard operation is not supported


Should I force discard or nodiscard on either of these partitions?

What are the recommended fstab mount options for F2FS?
_________________
Regards,
Mick
Back to top
View user's profile Send private message
MickKi
Veteran
Veteran


Joined: 08 Feb 2004
Posts: 1173

PostPosted: Fri Mar 22, 2024 7:31 pm    Post subject: Reply with quote

Oh! I found this, but I don't know if it is still the case:
Quote:
So in summary for others happening across
this, discard/trim is disabled on LUKS by default; be sure to read the
Arch Wiki page I linked a few replies ago for details and for ways you
can enable it if you understand the security risks of doing so.

Quoted from the f2fs mailing list.
_________________
Regards,
Mick
Back to top
View user's profile Send private message
CooSee
Veteran
Veteran


Joined: 20 Nov 2004
Posts: 1441
Location: Earth

PostPosted: Fri Mar 22, 2024 7:31 pm    Post subject: Reply with quote

look at https://wiki.archlinux.org/title/F2FS
Quote:
Implementation of discard
By default, F2FS is mounted using a hybrid TRIM mode which behaves as continuous TRIM. This implementation creates asynchronous discard threads to alleviate long discarding latency among RW IOs.
It keeps candidates in memory, and the thread issues them in idle time [7]. As a result of this, users wanting periodic TRIM will need to implicitly set the nodiscard mount option in /etc/fstab or pass it to mount if mounting manually.

Quote:
What are the recommended fstab mount options for F2FS?

you can also try with sys-fs/genfstab <<< make a backup of your current fstab before !

f2fs is not very stable, imho - be careful :!:

i hope this helps

8)
_________________
" Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier "
Back to top
View user's profile Send private message
MickKi
Veteran
Veteran


Joined: 08 Feb 2004
Posts: 1173

PostPosted: Sat Mar 23, 2024 9:25 am    Post subject: Reply with quote

From what I found discard is disabled by default when using dm-crypt LUKS mode, to avoid revealing which sectors are zeroed (discarded) and which are not, so this explains what I observed in the encrypted partition.
_________________
Regards,
Mick
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum