You are not logged in.
So here is my situation. I have an Arch machine on my home network. I want it to have access to two shares on another machine on the network, so I have added two entries to fstab:
//Vault-13/2T_Digital_Dump /media/mnt1 cifs users,noauto,noatime,username=blahblah,password=blahblah,workgroup=WORKGROUP,ip=192.168.1.4 0 0
//Vault-13/Temp /media/mnt2 cifs users,noauto,noatime,username=blahblah,password=blahblah,workgroup=WORKGROUP,ip=192.168.1.4 0 0
I use the 'noauto' flag because there are times when this machine is booted before the machine with the shares is, and I don't want the boot process to hang. Right now I'm using a simple bash script to mount the shares, which I have set XFCE up to start with each session:
The script file is ~/.mount
#!/bin/bash
mount /media/mnt1
mount /media/mnt2
Now, this is working fine, as once the user logs in the commands are executed properly. I'm just wondering if there isn't a better way to do this. I'd like to have this bash script run at user login regardless of what DE I'm using, and right now this relies on Xfce to start. I'm thinking that ~/.bash_profile might be the way to go, but am unsure. If I use that method, is it just a matter of invoking the script with something like: $HOME/.mount?
Thanks for taking the time to read this, and any advice you might offer.
Last edited by Beelzebud (2011-05-13 18:21:52)
Offline
This might be too much of a leap for you, but systemd has a really neat automount function that only mounts your drives when you actually access them.
Wiki: https://wiki.archlinux.org/index.php/Systemd
Forum: https://bbs.archlinux.org/viewtopic.php?id=96316
ᶘ ᵒᴥᵒᶅ
Offline
That does look like an interesting system, but I'm not sure I'm quite ready to reinvent the wheel just yet. I'll read over the wiki more carefully later this evening. For now though, I'd like to keep this a little more simple. Invoking a scirpt at login, seems like a simpler solution that installing an entirely new init system.
Offline
With your current setup, i think you can also place a "mount -a" in your .xinitrc or your .bashrc
ᶘ ᵒᴥᵒᶅ
Offline
What do you mean hang? I have network shares too and when booting without the other one powered on, it doesn't hang, it just keeps on normaly. Here's my fstab:
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
devpts /dev/pts devpts defaults 0 0
shm /dev/shm tmpfs nodev,nosuid 0 0
# Failsafe mounts
#/dev/sda3 /boot ext4 defaults 0 2
#/dev/sda5 /home ext4 defaults 0 2
#/dev/sda6 / ext4 defaults 0 1
#/dev/sda7 swap swap defaults 0 0
#/dev/sda8 /usr ext4 defaults 0 2
#/dev/sda9 /var ext4 defaults 0 2
#/dev/sda10 /tmp ext4 defaults 0 0
# Normal mounts
/dev/disk/by-uuid/3361fe68-ea82-43b3-8849-ef28cda1f8f1 / ext4 defaults,nobarrier 0 1
/dev/disk/by-uuid/3062ba2c-e7b0-4a05-b750-4749bb19e711 /boot ext4 defaults,noatime,nodev,noexec,nobarrier 0 2
/dev/disk/by-uuid/ae8f00ac-31e3-4857-a5ab-857490fade97 swap swap defaults 0 0
/dev/disk/by-uuid/25ada1e8-af12-45ba-b794-138bf800187b /tmp ext4 defaults,noatime,nodev,nosuid,nobarrier 0 0
/dev/disk/by-uuid/34491d86-4ab9-49c3-87b9-6a84fac121e2 /var ext4 defaults,nodev,nobarrier 0 2
/dev/disk/by-uuid/8161e114-cd19-49f6-a2bc-86ba4e0ae8ef /usr ext4 defaults,noatime,nodev,nobarrier 0 2
/dev/disk/by-uuid/95e4cd07-ad37-4516-8780-f27bb8795c1d /home ext4 defaults,nodev,nobarrier 0 2
# Windows shares
/dev/disk/by-uuid/01CAD01BC1C1ABF0 /mnt/shr/csys ntfs-3g defaults 0 0
/dev/disk/by-uuid/01CB839E4EDB2FD0 /mnt/shr/dstrg ntfs-3g defaults 0 0
# Network shares
//192.168.0.1/(C)\040System /mnt/shr/vkscsys cifs defaults,noperm,username=###,password=### 0 0
//192.168.0.1/(D)\040Storage /mnt/shr/vksdstrg cifs defaults,noperm,username=###,password=### 0 0
# User mounts
/dev/sdc /mnt/mobile vfat defaults,noauto,user,umask=077 0 0
/dev/cdrom /mnt/cdrom iso9660 defaults,noauto,user 0 0
Last edited by hauzer (2011-05-13 17:56:42)
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
Hmm when I tried booting last night without noauto, and the machine with the shares offline, it got stuck on the boot process looking for the share. Perhaps it's the noperm parameter I need. At any rate, thanks for posting a confirmed working fstab entry. It differs from mine in a few cases, and while mine works, it sounds like yours is handling things properly. I'm going to try yours and see how it goes.
Last edited by Beelzebud (2011-05-13 18:09:23)
Offline
Hey that seemed to do the trick! I tried the other format, and it's working fine. Thanks for the help guys. Marking as solved.
Last edited by Beelzebud (2011-05-13 18:22:54)
Offline
I'm not sure why noperm solved it, it just voids any permissions and gives unlimited access. Maybe the problem lies in the ip option, as workgroup doesn't exist[1]. It says in the manpage: "Sets the destination IP address. This option is set automatically if the server name portion of the requested UNC name can be resolved so rarely needs to be specified by the user." Maybe the IP cannot be resolved at boot and that's the cause of the hang?
[1] man mount.cifs | grep -n5 -e workgroup
Last edited by hauzer (2011-05-13 18:47:47)
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Offline
Two other possible solutions:
a) use a few lines of bash in your /etc/rc.local to establish if you're connected to the (inter-)net and then mount the shares. for an example see post #103 in this thread.
b) use a hook of netcfg/wicd or other network manager that support POSTUP hooks. See here for some information on POSTUP with netcfg.
With both a) and b) you'd keep your fstab entries but use the option noauto.
Regards,
demian
Last edited by demian (2011-05-13 19:39:10)
no place like /home
github
Offline
Ok tonight I got a chance to think over this more, and realized my problem wasn't solved. If the machine with the remote shares was down, when I shut down the linux machine, it would hang with a "busy" status while trying to unmount the share. I looked back to the archlinux wiki, and at the bottom, I found a reference to the "nofail" flag.... I knew it would be something obvious! LOL It's all working 100% fine now, so anyone else having this problem, and viewing this thread, try the nofail parameter!
Problem now truly solved.
Offline
Another option if you're not opposed to gvfs is to use gigolo... Someone else on the forums pointed it out to me recently for my move from Gnome to Xfce. It rocks. As the creator says on the homepage: "It mounts what it is told to."
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
b) use a hook of netcfg/wicd or other network manager that support POSTUP hooks
I confirm this to be working on my laptop: I made a dispatcher-script in /etc/Networkmanager/dispatcher.d/ to start nfs-common and mount my NFS-shares everytime I'm connected to my wireless home-LAN.
That way I'm not starting NFS whenever I'm not connected to my home-LAN, (tin foil hat) and I'm not sending any authentication information out in limbo, where it might be vulnerable to exploits (/tin foil hat)
Offline