We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2018-10-26 02:15:56 +0200

olf gravatar image

[Improvement] Enhanced mounting scripts for SD-cards

Dear Sailors,

please consider improving SailfisOS' mounting of SD-cards in order to prevent data loss (e.g. by not unmounting cleanly) and enhance usability.
Provided are the following enhancements compared to the original version (as of SailfishOS 2.2.x) in descending importance:

  1. Start mounting (partitions on) SD-card via udisks at the earliest sensible time: Right after udisks2.service has started. Also unmount before udisks2.service begins stopping, hence achieving a clean unmount.
    Suggested changes for employing point 1:

    $ diff /lib/systemd/system/mount-sd\@.service /etc/systemd/system/mount-sd\@.service.patched
    2,4c2,4
    < Description=Handle udisks sd mount
    < After=dev-%i.device
    < BindsTo=dev-%i.device
    ---
    > Description=Handle udisks mount of SD-card %i
    > After=udisks2.service dev-%i.device
    > BindsTo=udisks2.service dev-%i.device
    12c12
    < ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
    ---
    > ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
    $

  2. Ensure, that AlienDalvik begins starting after mounting succeeded. Even more importantly this also ensures, that unmounting occurs only after AlienDalvik is completely stopped. Nevertheless, this still is also applicable to devices without AlienDalvik installed.
    Suggested changes for employing point 2:

    $ diff /etc/systemd/system/mount-sd\@.service.patched /etc/systemd/system/mount-sd\@.service.patched2
    5a6
    > Before=alien-service-manager.service

  3. Do not try to mount block devices without a filesystem recognised by the kernel / udev.
    Suggested change for employing point 3:

    $ diff /lib/udev/rules.d/80-udisks2.rules /etc/udev/rules.d/80-udisks2.rules.patched
    47c47
    < KERNEL=="mmcblk1|sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    ---
    > KERNEL=="mmcblk1
    |sd[a-z][0-9]", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"

  4. Create a "compatibility symlink" to allow older apps seamlessly accessing (partitions on) SD-cards at their new (since SailfishOS 2.2.0) mount point.
    For the suggested changes to employ point 4, please see mount-sdcard's systemd services.

For users, who want to enjoy these enhancements right away, an installable RPM is available at OpenRepos.

HTH & happy sailing

[Improvement] Enhanced mounting scripts for SD-cards

Dear Sailors,

please consider improving SailfisOS' mounting of SD-cards in order to prevent data loss (e.g. by not unmounting cleanly) and enhance usability.
Provided are the following enhancements compared to the original version (as of SailfishOS 2.2.x) in descending importance:

  1. Start mounting (partitions on) SD-card via udisks at the earliest sensible time: Right after udisks2.service has started. Also unmount before udisks2.service begins stopping, hence achieving a clean unmount.
    Suggested changes for employing point 1:

    $ diff /lib/systemd/system/mount-sd\@.service /etc/systemd/system/mount-sd\@.service.patched
    2,4c2,4
    < Description=Handle udisks sd mount
    < After=dev-%i.device
    < BindsTo=dev-%i.device
    ---
    > Description=Handle udisks mount of SD-card %i
    > After=udisks2.service dev-%i.device
    > BindsTo=udisks2.service dev-%i.device
    12c12
    < ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
    ---
    > ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
    $

  2. Ensure, that AlienDalvik begins starting after mounting succeeded. Even more importantly this also ensures, that unmounting occurs only after AlienDalvik is completely stopped. Nevertheless, this still is also applicable to devices without AlienDalvik installed.
    Suggested changes change for employing point 2:

    $ diff /etc/systemd/system/mount-sd\@.service.patched /etc/systemd/system/mount-sd\@.service.patched2
    5a6
    > Before=alien-service-manager.service

  3. Do not try to mount block devices without a filesystem recognised by the kernel / udev.
    Suggested change for employing point 3:

    $ diff /lib/udev/rules.d/80-udisks2.rules /etc/udev/rules.d/80-udisks2.rules.patched
    47c47
    < KERNEL=="mmcblk1|sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    ---
    > KERNEL=="mmcblk1
    |sd[a-z][0-9]", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"

  4. Create a "compatibility symlink" to allow older apps seamlessly accessing (partitions on) SD-cards at their new (since SailfishOS 2.2.0) mount point.
    For the suggested changes to employ point 4, please see mount-sdcard's systemd services.

For users, who want to enjoy these enhancements right away, an installable RPM is available at OpenRepos.

HTH & happy sailing

[Improvement] Enhanced mounting scripts for SD-cards

Dear Sailors,

please consider improving SailfisOS' mounting of SD-cards in order to prevent data loss (e.g. by not unmounting cleanly) and enhance usability.
Provided are the following enhancements compared to the original version (as of SailfishOS 2.2.x) in descending importance:

  1. Start mounting (partitions on) SD-card via udisks at the earliest sensible time: Right after udisks2.service has started. Also unmount before udisks2.service begins stopping, hence achieving a clean unmount.
    Suggested changes for employing point 1:

    $ diff /lib/systemd/system/mount-sd\@.service /etc/systemd/system/mount-sd\@.service.patched
    2,4c2,4
    < Description=Handle udisks sd mount
    < After=dev-%i.device
    < BindsTo=dev-%i.device
    ---
    > Description=Handle udisks mount of SD-card %i
    > After=udisks2.service dev-%i.device
    > BindsTo=udisks2.service dev-%i.device
    12c12
    < ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
    ---
    > ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
    $

  2. Ensure, that AlienDalvik begins starting after mounting succeeded. Even more importantly this also ensures, that unmounting occurs only after AlienDalvik is completely stopped. Nevertheless, this still is also applicable to devices without AlienDalvik installed.
    Suggested change for employing point 2:

    $ diff /etc/systemd/system/mount-sd\@.service.patched /etc/systemd/system/mount-sd\@.service.patched2
    5a6
    > Before=alien-service-manager.service

  3. Do not try to mount block devices without a filesystem recognised by the kernel / udev.
    Suggested change for employing point 3:

    $ diff /lib/udev/rules.d/80-udisks2.rules /etc/udev/rules.d/80-udisks2.rules.patched
    47c47
    < KERNEL=="mmcblk1|sd[a-z][0-9]", KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    ---
    > KERNEL=="mmcblk1
    |sd[a-z][0-9]", KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"

  4. Create a "compatibility symlink" to allow older apps seamlessly accessing (partitions on) SD-cards at their new (since SailfishOS 2.2.0) mount point.
    For the suggested changes to employ point 4, please see mount-sdcard's systemd services.

For users, who want to enjoy these enhancements right away, an installable RPM is available at OpenRepos.

HTH & happy sailing

[Improvement] Enhanced mounting scripts for SD-cards

Dear Sailors,

please consider improving SailfisOS' mounting of SD-cards in order to prevent data loss (e.g. by not unmounting cleanly) and enhance usability.
Provided are the following enhancements compared to the original version (as of SailfishOS 2.2.x) in descending importance:

  1. Start mounting (partitions on) SD-card via udisks at the earliest sensible time: Right after udisks2.service has started. Also unmount before udisks2.service begins stopping, hence achieving a clean unmount.
    Suggested changes for employing point 1:

    $ diff /lib/systemd/system/mount-sd\@.service /etc/systemd/system/mount-sd\@.service.patched
    2,4c2,4
    < Description=Handle udisks sd mount
    < After=dev-%i.device
    < BindsTo=dev-%i.device
    ---
    > Description=Handle udisks mount of SD-card %i
    > After=udisks2.service dev-%i.device
    > BindsTo=udisks2.service dev-%i.device
    12c12
    < ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
    ---
    > ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
    $

  2. Ensure, that AlienDalvik begins starting after mounting succeeded. Even more importantly this also ensures, that unmounting occurs only after AlienDalvik is completely stopped. Nevertheless, this still is also applicable to devices without AlienDalvik installed.
    Suggested change for employing point 2:

    $ diff /etc/systemd/system/mount-sd\@.service.patched /etc/systemd/system/mount-sd\@.service.patched2
    5a6
    > Before=alien-service-manager.serviceBefore=alien-service-manager.service $

  3. Do not try to mount block devices without a filesystem recognised by the kernel / udev.
    Suggested change for employing point 3:

    $ diff /lib/udev/rules.d/80-udisks2.rules /etc/udev/rules.d/80-udisks2.rules.patched
    47c47
    < KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    ---
    > KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"ENV{SYSTEMD_WANTS}="mount-sd@%k.service" $

  4. Create a "compatibility symlink" to allow older apps seamlessly accessing (partitions on) SD-cards at their new (since SailfishOS 2.2.0) mount point.
    For the suggested changes to employ point 4, please see mount-sdcard's systemd services.

For users, who want to enjoy these enhancements right away, an installable RPM is available at OpenRepos.

HTH & happy sailing

[Improvement] Enhanced mounting scripts for SD-cards

Dear Sailors,

please consider improving SailfisOS' mounting of SD-cards in order to prevent data loss (e.g. by not unmounting cleanly) and enhance usability.
Provided are the following enhancements compared to the original version (as of SailfishOS 2.2.x) in descending importance:

  1. Start mounting (partitions on) SD-card via udisks at the earliest sensible time: Right after udisks2.service has started. Also unmount before udisks2.service begins stopping, hence achieving a clean unmount.
    Suggested changes for employing point 1:

    $ diff /lib/systemd/system/mount-sd\@.service /etc/systemd/system/mount-sd\@.service.patched
    2,4c2,4
    < Description=Handle udisks sd mount
    < After=dev-%i.device
    < BindsTo=dev-%i.device
    ---
    > Description=Handle udisks mount of SD-card %i
    > After=udisks2.service dev-%i.device
    > BindsTo=udisks2.service dev-%i.device
    12c12
    < ExecStop=-/usr/bin/udisksctl unmount -b /dev/%i
    ---
    > ExecStop=/usr/bin/udisksctl unmount -b /dev/%i
    $

  2. Ensure, that AlienDalvik begins starting after mounting succeeded. Even more importantly this also ensures, that unmounting occurs only after AlienDalvik is completely stopped. Nevertheless, this still is also applicable to devices without AlienDalvik installed.
    Suggested change for employing point 2:

    $ diff /etc/systemd/system/mount-sd\@.service.patched /etc/systemd/system/mount-sd\@.service.patched2
    5a6
    > Before=alien-service-manager.service Before=alien-service-manager.service
    $

  3. Do not try to mount block devices without a filesystem recognised by the kernel / udev.
    Suggested change for employing point 3:

    $ diff /lib/udev/rules.d/80-udisks2.rules /etc/udev/rules.d/80-udisks2.rules.patched
    47c47
    < KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    ---
    > KERNEL=="mmcblk1*|sd[a-z][0-9]", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", ACTION=="add", MODE="0660", TAG+="systemd", ENV{SYSTEMD_WANTS}="mount-sd@%k.service" ENV{SYSTEMD_WANTS}="mount-sd@%k.service"
    $

  4. Create a "compatibility symlink" to allow older apps seamlessly accessing (partitions on) SD-cards at their new (since SailfishOS 2.2.0) mount point.
    For the suggested changes to employ point 4, please see mount-sdcard's systemd services.

For users, who want to enjoy these enhancements right away, an installable RPM is available at OpenRepos.

HTH & happy sailing