Automatically fix mount on systemd unit failure due to bad mount

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
For quite some time, I've been fighting a problem with my Raspberry Pi having difficulty to maintain a connection to my external HDD. Sometimes it just randomly throws I/O error, and when that happens, my rtorrent service unit fails with it. Now I tried many things, this is the solution that I have now:
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStartPre=/home/pi/mount_media.sh
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/pi
Restart=on-failure
[Install]
WantedBy=default.target
Where mount_media.sh simply remounts the directory.
Stuff I also tried but didn't work:
- OnFailure start different unit which remounts the directory
- Start the unit with a script, which remounts the drive and then starts rtorrent
Right now, this approach has left me with "cannot access 'Media': Transport endpoint is not connected"
Forgot to add: /media/Media is my mount point
So how should I take care of a moot point randomly disconnecting?
mount systemd rtorrent
add a comment |Â
up vote
1
down vote
favorite
For quite some time, I've been fighting a problem with my Raspberry Pi having difficulty to maintain a connection to my external HDD. Sometimes it just randomly throws I/O error, and when that happens, my rtorrent service unit fails with it. Now I tried many things, this is the solution that I have now:
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStartPre=/home/pi/mount_media.sh
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/pi
Restart=on-failure
[Install]
WantedBy=default.target
Where mount_media.sh simply remounts the directory.
Stuff I also tried but didn't work:
- OnFailure start different unit which remounts the directory
- Start the unit with a script, which remounts the drive and then starts rtorrent
Right now, this approach has left me with "cannot access 'Media': Transport endpoint is not connected"
Forgot to add: /media/Media is my mount point
So how should I take care of a moot point randomly disconnecting?
mount systemd rtorrent
1
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
For quite some time, I've been fighting a problem with my Raspberry Pi having difficulty to maintain a connection to my external HDD. Sometimes it just randomly throws I/O error, and when that happens, my rtorrent service unit fails with it. Now I tried many things, this is the solution that I have now:
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStartPre=/home/pi/mount_media.sh
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/pi
Restart=on-failure
[Install]
WantedBy=default.target
Where mount_media.sh simply remounts the directory.
Stuff I also tried but didn't work:
- OnFailure start different unit which remounts the directory
- Start the unit with a script, which remounts the drive and then starts rtorrent
Right now, this approach has left me with "cannot access 'Media': Transport endpoint is not connected"
Forgot to add: /media/Media is my mount point
So how should I take care of a moot point randomly disconnecting?
mount systemd rtorrent
For quite some time, I've been fighting a problem with my Raspberry Pi having difficulty to maintain a connection to my external HDD. Sometimes it just randomly throws I/O error, and when that happens, my rtorrent service unit fails with it. Now I tried many things, this is the solution that I have now:
[Unit]
Description=rTorrent
After=network.target
[Service]
User=root
Type=forking
KillMode=none
ExecStartPre=/home/pi/mount_media.sh
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/pi
Restart=on-failure
[Install]
WantedBy=default.target
Where mount_media.sh simply remounts the directory.
Stuff I also tried but didn't work:
- OnFailure start different unit which remounts the directory
- Start the unit with a script, which remounts the drive and then starts rtorrent
Right now, this approach has left me with "cannot access 'Media': Transport endpoint is not connected"
Forgot to add: /media/Media is my mount point
So how should I take care of a moot point randomly disconnecting?
mount systemd rtorrent
asked Feb 18 at 18:33
Meowxiik
61
61
1
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35
add a comment |Â
1
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35
1
1
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f425003%2fautomatically-fix-mount-on-systemd-unit-failure-due-to-bad-mount%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Have you got a strong enough transformer to keep up with an HDD?
â Rui F Ribeiro
Feb 18 at 18:36
I think so, I connect it through USB hub, which is power by a 5V, 2A adapter.
â Meowxiik
Feb 18 at 19:01
Also no other device is connected to the hub so the 5V, 2A are going directly to the HDD
â Meowxiik
Feb 18 at 19:35