How to Automount a CIFS share after WiFi connects on Raspbian
I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.
I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab
file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a
, it reads the rule from fstab and applies it just fine...
My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?
I looked at udev rules but I'm not sure if that's the way to go...
raspberry-pi raspbian
bumped to the homepage by Community♦ 15 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.
I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab
file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a
, it reads the rule from fstab and applies it just fine...
My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?
I looked at udev rules but I'm not sure if that's the way to go...
raspberry-pi raspbian
bumped to the homepage by Community♦ 15 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.
I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab
file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a
, it reads the rule from fstab and applies it just fine...
My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?
I looked at udev rules but I'm not sure if that's the way to go...
raspberry-pi raspbian
I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.
I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab
file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a
, it reads the rule from fstab and applies it just fine...
My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?
I looked at udev rules but I'm not sure if that's the way to go...
raspberry-pi raspbian
raspberry-pi raspbian
edited Mar 26 '15 at 5:36
slm♦
251k67528685
251k67528685
asked Mar 26 '15 at 5:26
Haytham AbuelFutuhHaytham AbuelFutuh
62
62
bumped to the homepage by Community♦ 15 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 15 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
While the NFS-specific mount binary supports a bg
option, the CIFS mount does not.
Options I can think of:
- Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
- Install and use the automounter,
autofs
.
add a comment |
You might want to take a look into "network interface configuration for ifup and ifdown" with
man interfaces
The configuration file allows several "command" options. In your case you might want to take a look into the option
post-up command
which is run after the interface is brought up.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f192568%2fhow-to-automount-a-cifs-share-after-wifi-connects-on-raspbian%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
While the NFS-specific mount binary supports a bg
option, the CIFS mount does not.
Options I can think of:
- Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
- Install and use the automounter,
autofs
.
add a comment |
While the NFS-specific mount binary supports a bg
option, the CIFS mount does not.
Options I can think of:
- Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
- Install and use the automounter,
autofs
.
add a comment |
While the NFS-specific mount binary supports a bg
option, the CIFS mount does not.
Options I can think of:
- Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
- Install and use the automounter,
autofs
.
While the NFS-specific mount binary supports a bg
option, the CIFS mount does not.
Options I can think of:
- Create a script that attempts to perform the mount, but sleeps and loops if unsuccessful. Exit if mount successful. Run as a startup script.
- Install and use the automounter,
autofs
.
answered Mar 26 '15 at 6:46
BowlOfRedBowlOfRed
2,590715
2,590715
add a comment |
add a comment |
You might want to take a look into "network interface configuration for ifup and ifdown" with
man interfaces
The configuration file allows several "command" options. In your case you might want to take a look into the option
post-up command
which is run after the interface is brought up.
add a comment |
You might want to take a look into "network interface configuration for ifup and ifdown" with
man interfaces
The configuration file allows several "command" options. In your case you might want to take a look into the option
post-up command
which is run after the interface is brought up.
add a comment |
You might want to take a look into "network interface configuration for ifup and ifdown" with
man interfaces
The configuration file allows several "command" options. In your case you might want to take a look into the option
post-up command
which is run after the interface is brought up.
You might want to take a look into "network interface configuration for ifup and ifdown" with
man interfaces
The configuration file allows several "command" options. In your case you might want to take a look into the option
post-up command
which is run after the interface is brought up.
answered Mar 26 '15 at 7:06
FloHimselfFloHimself
6,49421318
6,49421318
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f192568%2fhow-to-automount-a-cifs-share-after-wifi-connects-on-raspbian%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown