Difference between revisions of "Mount Shares Locally"

From Amahi Wiki
Jump to: navigation, search
m (typo in path to rc3.d)
Line 2: Line 2:
  
 
* As '''root:''' Install the mount_shares_locally initd script:
 
* As '''root:''' Install the mount_shares_locally initd script:
 +
<u>Fedora</u>
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll">
 
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll">
 
  curl -o /etc/init.d/mount_shares_locally http://dl.dropbox.com/u/3022105/Amahi/mount_shares_locally
 
  curl -o /etc/init.d/mount_shares_locally http://dl.dropbox.com/u/3022105/Amahi/mount_shares_locally
Line 7: Line 8:
 
  chkconfig --add mount_shares_locally
 
  chkconfig --add mount_shares_locally
 
</div>
 
</div>
 +
 +
<u>Ubuntu</u>
 +
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px; overflow: scroll">
 +
sudo apt-get install cifs-utils curl
 +
sudo curl -o /etc/init.d/mount_shares_locally https://raw.github.com/gist/1099419/mount_shares_locally
 +
sudo chmod +x /etc/init.d/mount_shares_locally
 +
update-rc.d mount_shares_locally defaults
 +
</div>
 +
  
 
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username="amahi"'''
 
* Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace ''your_username'' (on line 12) with your username. Example '''username="amahi"'''

Revision as of 19:36, 24 June 2012

Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.

  • As root: Install the mount_shares_locally initd script:

Fedora

curl -o /etc/init.d/mount_shares_locally http://dl.dropbox.com/u/3022105/Amahi/mount_shares_locally
chmod +x /etc/init.d/mount_shares_locally
chkconfig --add mount_shares_locally

Ubuntu

sudo apt-get install cifs-utils curl
sudo curl -o /etc/init.d/mount_shares_locally https://raw.github.com/gist/1099419/mount_shares_locally
sudo chmod +x /etc/init.d/mount_shares_locally
update-rc.d mount_shares_locally defaults


  • Edit /etc/init.d/mount_shares_locally (as user root) in a text editor, and replace your_username (on line 12) with your username. Example username="amahi"
bash code
​nano /etc/init.d/mount_shares_locally​
  • Create the /home/your_username/.smb_credentials file. This is a simple text file (use your favorite text editor).
bash code
​nano /home/YourHDA_username/.smb_credentials​
  • Enter the following:
username=your_username
password=your_password
domain=HOME

NOTE: your_username and your_password in the .smb_credentials file needs to be the original username and password you created when you installed fedora.

  • To test your new mounts, you can execute service mount_shares_locally start

You will find the mounted shares in /mnt/samba/*
service mount_shares_locally stop will unmount the local shares.

Note: if you used /etc/rc.local and /etc/fstab to mount shares locally in the past, you can remove what you added in those files now. The above initd script replaces all this.


Unable to mount localy after upgrading to Amahi6

If you try to run mount using this script after you upgraded to Amahi6 you might get greeted by this type of error.

[root@localhost ~]# /etc/init.d/mount_shares_locally start
Mounting Samba shares locally: /etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
/etc/init.d/mount_shares_locally: line 27: /sbin/mount.cifs: No such file or directory
                                                          [  OK  ]

It's easily fixed by installing the missing dependency.

bash code
​yum install cifs-utils​


Now it should work fine to run

bash code
​/etc/init.d/mount_shares_locally start​


MySQL Problems With Newer Versions of Greyhole

Since Greyhole moved from SQL Lite to MySQL, you may hit a problem where Greyhole and the mount_shares_locally script both attempt to start before MySQL in bootup, leading to the services not starting properly. If this happens, you can try this to fix it:

bash code
​ls /etc/rc.d/rc3.d/​
  • Look for any entries marked S-1. If there are any, they need to be removed. Run the following as root:
bash code
​rm S-1*​