[systemd-devel] udev rule to mount ext4 with data=journal

Pascal K pascalkrauth at gmail.com
Wed Jun 14 07:30:09 UTC 2017

Hello everyone,

I am new to this list and to udev (used mdev before).

My goal: Mount a CFast card partioned with 2 partitions one FAT32 and one
EXT4, the EXT4 I would like to mount with option "data=journal"

The Problem: from the console using mount the partition can be mounted with
mount -o "data=journal" ... but not from my udev rule. My rule results in
only the FAT32 partition being mounted.

My Rule:

KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Global mount options
ACTION=="add", ENV{mount_options}="relatime"

# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs",
ACTION=="add", ENV{ID_FS_TYPE}=="ext4",

#Mount the Filesystems
ACTION=="add", RUN+="/bin/mkdir -p /media/$env{ID_FS_LABEL}",
RUN+="/bin/mount -o %E{mount_options} /dev/%k /media/$env{ID_FS_LABEL}"

# Exit

Any help is highly appreciated, so far I can only mount with "data=ordered"
since this seems to be the default option (for that the two lines matching
"ENV{ID_FS_TYPE} are removed).

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170614/dc41a651/attachment.html>

More information about the systemd-devel mailing list