We recently started work on a pair of bugs which reported that systems installed by curtin (including subiquity) do not fsck their filesystems on boot by default (because the “fs_passno” field of the fstab file is written as “0”). The question arose as to whether this is something we want to do: in the age of journalling filesystems, is it still desirable to run fsck?
Some filesystems do not support fsck in any meaningful way, for example xfs, zfs, btrfs. There are fsck.$fstype binaries for these filesystems but they do nothing.
ext2, ext3 and ext4 do have a non-trivial fsck, although for journalled ext3 and ext4 systems all it usually does is replay the journal, the same as the kernel driver would do on mount. But there are situations where it does more, and unjournalled filesystems (which aiui are usually either ext2 or filesystems that were created as ext2 and then upgraded, so not something that we need to worry about too much in a modern installer) should be fscked.
One thing that came up in this investigation is that nothing in modern Ubuntu cares about the historical distinction between 1 and 2 for the passno field talked about in the fstab man page.
It also seems wise to fsck the /boot/efi partition, if any.
I did a quick survey of other installers.
- anaconda (used by fedora, centos and rhel) writes passno as 1 or 2 for certain filesystem types (ext?, /boot/eft, the ones with _check = True in https://github.com/storaged-project/blivet/blob/3.4-devel/blivet/formats/fs.py) and 0 otherwise
- calamares writes passno as 1 or 2 for all filesystems apart from swap partitions
- partman (and so both d-i based installers and ubiquity) writes 1 or 2 for ext?, fat32, btrfs, /boot/efi, and writes 0 for xfs and ntfs
- the arch fstab generator writes passno 1 or 2 for any filesystem type that ships a fsck.$fstype binary and 0 otherwise
- fedora cloud images have an ext4 / and have passno 1 in their fstab
My takeaway from this is that we should certainly write passno=1 for a ext-family filesystem and for /boot/efi. Whether we want to be smart about writing passno=0 for e.g. xfs, I don’t know. It doesn’t make much difference either way.