Ext4

From wikinotes

Ext4 is a journaled filesystem, used by default by most linux distros.

Documentation

man ext4 https://www.man7.org/linux/man-pages/man5/ext4.5.html#MOUNT_OPTIONS


Creation

Basics

Create Filesystem

mkfs -t ext4 /dev/sda1

Kernel Options

casefold (case-insensitivity)

If a partition was formatted with casefold, you can assign empty directories to be treated case-insensitively.

Create/Verify filesystem

cat /sys/fs/ext4/features/casefold      # must be 'supported'
mkfs -t ext4 -O casefold /dev/sda1      # format partition
dumpe2fs -h /dev/sda1 | grep 'casefold' # ensure casefold under 'Filesystem features:'
sudo mount /dev/sda1 /mnt/foo           # mount

Create Case-Insensitive Directory

mkdir games
chattr +F games  # make directory case-insensitive
lsattr games     # show extended attributes, including casefold

Mount

FreeBSD

See http://blog.ataboydesign.com/2014/04/23/freebsd-10-mounting-usb-drive-with-ext4-filesystem

# requires package: fusefs-ext2
# NOTE: there is a port sysutils/fusefs-ext4fs but it is deprecated
#       in favour of fusefs-ext2
mount -t ext2fs /dev/ad1s1 /mnt


Linux

You cannot set the uid/gid for ext4 mounts.
Instead, set the permissions of the files on the mounted-mount itself, and they will be preserved.

sudo mount /dev/sdb1 /mnt/usb