Greyhole Configuration Instructions
===================================

The following are instructions on how to configure and run Greyhole.

You need Greyhole installed for those instructions to make sense. 
See https://github.com/gboudreau/Greyhole/wiki/Installing for details.

Most of the commands below require root access, so now would be a good time 
to become root, if you're not already.

1. Setup Samba:

	Edit /etc/samba/smb.conf
	Change or add the following values in the [global] section:

		unix extensions = no
		wide links = yes

	For each of your shares, add a 'dfree command' and 'vfs objects' lines, as seen below.

	Example share definition:
		[share_name]
		    path = /path/to/share_name
		    create mask = 0770
		    directory mask = 0770
		    read only = no
		    available = yes
		    browseable = yes
		    writable = yes
		    guest ok = no
		    printable = no
		    dfree command = /usr/bin/greyhole-dfree
		    vfs objects = greyhole

	Fedora: service smb restart
	Ubuntu (< 10): /etc/init.d/samba restart
	Ubuntu (10+): restart smbd
	Debian: service samba restart

2. Setup the database:

	If using MySQL:

		# Make sure your MySQL server service (mysqld) is running, and runs on boot.
		Fedora: service mysqld start; chkconfig mysqld on
		Ubuntu (< 10): /etc/init.d/mysqld start; update-rc.d mysqld defaults
		Ubuntu (10+): start mysql
		Debian: service mysql start
		
		# Remove the -p parameter if your MySQL root user doesn't require a password for local connections.
		mysql -u root -p -e "create database greyhole; grant all on greyhole.* to greyhole_user@localhost identified by '89y63jdwe';"
		mysql -u greyhole_user -p89y63jdwe greyhole < /usr/share/greyhole/schema-mysql.sql

3. Cutomize the Greyhole configuration file, /etc/greyhole.conf, as needed.

4. For each directory you defined as 'storage_pool_directories', execute the following command, to create a hidden file in the root directory of each partition:

	touch <dir>/.greyhole_uses_this

	Example: touch /mnt/hdd0/gh/.greyhole_uses_this

	Those files will be used to differentiate an empty mount from a now-gone mount.
	i.e. Greyhole will output a warning if this file is not in the root directory where it is about to try to save a file, and it won't use that directory. This will prevent Greyhole from filling the / partition when a partition is unmounted!

5. Start the Greyhole service:

	Fedora: service greyhole start
	Ubuntu (< 10): /etc/init.d/greyhole start
	Ubuntu (10+): start greyhole
	Debian: service greyhole start


Check for errors in the Greyhole log file: /var/log/greyhole.log


If you use any application that needs to use files on your shares, you'll need to mount the shares locally, and point those applications to those mounts.
You should not touch the files in your storage pool directories.
Ref: https://github.com/gboudreau/Greyhole/wiki/Mountshareslocally