0

Preface (my 1st attempt ended badly): Fstab adding data=journal crashed my Linux' ext4 upon boot, how to fix?


I can't find some reliable step-by-step instructions on How to enable data=journal ext4 fs mode? (It is my root file system.)

Can anyone help? Thank you!

OS: Linux Mint 21.1 Cinnamon


Here is the tune2fs dump:

$ sudo tune2fs -l /dev/nvme0n1p2
[sudo] password for vlastimil:                
tune2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          f1fc7345-be7a-4c6b-9559-fc6e2d445bfa
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              122093568
Block count:              488354304
Reserved block count:     20068825
Free blocks:              387437462
Free inodes:              121112327
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      817
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sat Jun 16 11:26:24 2018
Last mount time:          Sun Jul  2 17:28:19 2023
Last write time:          Sun Jul  2 17:28:11 2023
Mount count:              1
Maximum mount count:      1
Last checked:             Sun Jul  2 17:28:11 2023
Check interval:           1 (0:00:01)
Next check after:         Sun Jul  2 17:28:12 2023
Lifetime writes:          39 TB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
First orphan inode:       132249
Default directory hash:   half_md4
Directory Hash Seed:      48360d76-0cfb-4aed-892e-a8f3a30dd794
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xe1a6cb12

1 Answer 1

1

Since this is your root filesystem, adding the mount option in /etc/fstab would pose a bit of a chicken-vs-egg problem: the system would need to know the mount option before starting to mount the root filesystem, but the /etc/fstab file cannot be read until the root filesystem is already mounted.

That's why there is a separate way for specifying mount options for your root filesystem: the rootflags= kernel boot option.

Within GRUB boot menu, you can press E to edit the selected boot entry (non-persistently, for the current boot only!), find the line that starts with the linux or linuxefi keyword, and add rootflags=data=journal to the end of that line. Then follow the on-screen instructions to boot with the modified entry.

If this results in a successful boot, you can add the boot option to /etc/default/grub file (to the GRUB_CMDLINE_LINUX variable) and then run sudo update-grub to make it persistent.

If the initial boot attempt with the rootflags=data=journal fails, you can simply boot again to return to previous state, as the changes made in GRUB boot menu will not be stored on disk.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .