You are not logged in.

#1 2013-10-27 21:00:01

Skitter
Member
Registered: 2013-09-28
Posts: 36

[SOLVED] Systemd has problems with ntfs-3g

Hi!

I created a custom daemon.
It's very simple.

[Unit]
Description=Mounting partitions if Im at home

[Service]
Type=simple
ExecStart=/home/skitter/homemount.sh

[Install]
WantedBy=multi-user.target

And the content of a script:

#!/bin/bash

device0="/dev/disk/by-uuid/e2b0e86b-d377-4699-9407-48d56eb439d0"
if [ -b "$device0" ]
then
  mount UUID=01CECC33AEE58980 /mnt/WINDOWS
  mount UUID=ff2d44b5-bdd0-4524-89bf-6ac3bc005887 /mnt/Other
  mount UUID=599D77CD384A8B00 /mnt/Files
fi

Unfortunately for some reason the ntfs partitions are being automatically unmounted.
The ext4 partition is not causing any problems.

$sudo systemctl status homemount
homemount.service - Mounting disk if Im at home
   Loaded: loaded (/usr/lib/systemd/system/homemount.service; enabled)
   Active: inactive (dead) since Sun 2013-10-27 21:56:23 CET; 1s ago
  Process: 3202 ExecStart=/home/skitter/homemount.sh (code=exited, status=0/SUCCESS)
 Main PID: 3202 (code=exited, status=0/SUCCESS)

Oct 27 21:56:22 archer ntfs-3g[3206]: Mounted /dev/sdb1 (Read-Write, label "", NTFS 3.1)
Oct 27 21:56:22 archer ntfs-3g[3206]: Cmdline options: rw
Oct 27 21:56:22 archer ntfs-3g[3206]: Mount options: rw,allow_other,nonempty,relatime,fsname=/dev/sdb1,blkdev,blksize=4096
Oct 27 21:56:22 archer ntfs-3g[3206]: Ownership and permissions disabled, configuration type 7
Oct 27 21:56:23 archer ntfs-3g[3213]: Version 2013.1.13 external FUSE 29
Oct 27 21:56:23 archer ntfs-3g[3213]: Mounted /dev/sda1 (Read-Write, label "Files", NTFS 3.1)
Oct 27 21:56:23 archer ntfs-3g[3213]: Cmdline options: rw
Oct 27 21:56:23 archer ntfs-3g[3213]: Mount options: rw,allow_other,nonempty,relatime,fsname=/dev/sda1,blkdev,blksize=4096
Oct 27 21:56:23 archer ntfs-3g[3213]: Ownership and permissions disabled, configuration type 7
Oct 27 21:56:23 archer ntfs-3g[3206]: Unmounting /dev/sdb1 ()

Last edited by Skitter (2013-10-27 21:43:32)

Offline

#2 2013-10-27 21:20:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Systemd has problems with ntfs-3g

I think this is because the mount command exits, so the daemon is then considered dead (or completed).  But I am not entirely sure about this.

A better solution would be to simply make an entry in your fstab with the noauto,x-systemd.automount,nofail options.  This would essentially achieve what you are after I think.  You could also make actualy systemd.mount and systemd.automount units as well, though these would automagically be generated by an entry in your fstab.

If you are unsure of what exactly to put in native systemd units, you can always see what systemd does in /run/systemd/generators.  In fact, if you put a fstab entry for this ntfs-3g mount, let it generate (ie reboot, or run the generator) then check out that directory, you can simply pull those units out of there, give them an [Install] section, and enable them.

Offline

#3 2013-10-27 21:43:18

Skitter
Member
Registered: 2013-09-28
Posts: 36

Re: [SOLVED] Systemd has problems with ntfs-3g

Thank you very much WonderWoofy.
Solved by adding {noauto,x-systemd.automount,nofail} options to fstab entries.
I will check  /run/systemd/generator, it will be a new lesson for me.

Last edited by Skitter (2013-10-27 21:45:21)

Offline

#4 2013-10-27 21:53:38

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Systemd has problems with ntfs-3g

Neato!  Glad I was able to lead you in the right direction.

Offline

Board footer

Powered by FluxBB