Difference between revisions of "Greyhole"

From ArchWiki
Jump to: navigation, search
(Created page with "Category:Networking (English) {{i18n|Greyhole}} {{Article summary start|Summary}} {{Article summary text|Installing and configuring Greyhole}} {{Article summary heading|Relat...")
 
Line 12: Line 12:
 
Currently there is no package available for install either in the Arch package repository or in AUR so Greyhole must be installed manually.
 
Currently there is no package available for install either in the Arch package repository or in AUR so Greyhole must be installed manually.
  
# Install the required packages
+
1. Install the required packages
 
<pre># pacman -S mysql php php-pear samba base-devel rsync</pre>
 
<pre># pacman -S mysql php php-pear samba base-devel rsync</pre>
  
# Go to [http://www.greyhole.net/download/ here] and download the latest source package.
+
2. Go to [http://www.greyhole.net/download/ here] and download the latest source package.
  
# Extract the Greyhole files
+
3. Extract the Greyhole files
 
<pre>
 
<pre>
 
# tar zxvf greyhole-*.tar.gz
 
# tar zxvf greyhole-*.tar.gz
Line 24: Line 24:
 
</pre>
 
</pre>
  
# Create work directory for Greyhole
+
4. Create work directory for Greyhole
 
<pre>
 
<pre>
 
# mkdir -p /var/spool/greyhole
 
# mkdir -p /var/spool/greyhole
Line 30: Line 30:
 
</pre>
 
</pre>
  
# Install Greyhole files
+
5. Install Greyhole files
 
<pre>
 
<pre>
 
# install -m 0755 -D -p greyhole /usr/bin
 
# install -m 0755 -D -p greyhole /usr/bin
Line 42: Line 42:
 
</pre>
 
</pre>
  
# 2 files required for php-pear don't seem to be supplied with archive so grab them from Github and move them into the required location
+
6. 2 files required for php-pear don't seem to be supplied with archive so grab them from Github and move them into the required location
 
<pre>
 
<pre>
 
# wget https://raw.github.com/gboudreau/Greyhole/master/includes/common.php
 
# wget https://raw.github.com/gboudreau/Greyhole/master/includes/common.php
Line 53: Line 53:
 
When setting the include_path if PHP complains about the timezone then set your timezone in the /etc/php/php.ini file.
 
When setting the include_path if PHP complains about the timezone then set your timezone in the /etc/php/php.ini file.
  
# Install the Samba VFS module
+
7. Install the Samba VFS module
 
Find out what version of Samba you are running
 
Find out what version of Samba you are running
 
<pre># smbd --version</pre>
 
<pre># smbd --version</pre>
Line 80: Line 80:
 
<pre># if [ -x /usr/lib64/samba/vfs/ ]; then cp bin/greyhole.so /usr/lib64/samba/vfs/greyhole.so; else cp bin/greyhole.so /usr/lib/samba/vfs/greyhole.so; fi</pre>
 
<pre># if [ -x /usr/lib64/samba/vfs/ ]; then cp bin/greyhole.so /usr/lib64/samba/vfs/greyhole.so; else cp bin/greyhole.so /usr/lib/samba/vfs/greyhole.so; fi</pre>
  
# Now (re)start Samba
+
8. Now (re)start Samba
 
<pre># rc.d start samba</pre>
 
<pre># rc.d start samba</pre>
 
or
 
or
 
<pre># rc.d restart samba</pre>
 
<pre># rc.d restart samba</pre>
  
# Next we need to install the Greyhole init script however this will have to follow at a later date as I have not yet made one. A generic linux example init script is supplied with the Greyhole source and is called "initd_script.sh"
+
9. Next we need to install the Greyhole init script however this will have to follow at a later date as I have not yet made one. A generic linux example init script is supplied with the Greyhole source and is called "initd_script.sh"
  
# Finally we need to work around problems with the CIFS client
+
10. Finally we need to work around problems with the CIFS client
 
<pre>
 
<pre>
 
# modprobe cifs
 
# modprobe cifs
Line 94: Line 94:
 
==Configuration==
 
==Configuration==
 
{{Note|This process is taken from the USAGE file that is supplied with Greyhole.}}
 
{{Note|This process is taken from the USAGE file that is supplied with Greyhole.}}
# Setup Samba
+
1. Setup Samba
 
Edit "/etc/samba/smb.conf" and add the following 2 lines to the [global] section
 
Edit "/etc/samba/smb.conf" and add the following 2 lines to the [global] section
 
<pre>
 
<pre>
Line 122: Line 122:
 
</pre>
 
</pre>
  
# Setup the database
+
2. Setup the database
 
If using MySQL:
 
If using MySQL:
 
Ensure MySQL is running
 
Ensure MySQL is running
Line 131: Line 131:
 
</pre>
 
</pre>
  
# Customize the greyhole configuration at "/etc/greyhole.conf"
+
3. Customize the greyhole configuration at "/etc/greyhole.conf"
  
# 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:
+
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:
 
<pre># touch <dir>/.greyhole_uses_this</pre>
 
<pre># touch <dir>/.greyhole_uses_this</pre>
 
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!
 
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!
  
# Start the Greyhole service
+
5. Start the Greyhole service
 
<pre># rc.d start greyhole</pre>
 
<pre># rc.d start greyhole</pre>

Revision as of 11:19, 3 September 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Summary help replacing me
Installing and configuring Greyhole
Related
Samba

Greyhole is an application that uses Samba to create a storage pool of all your available hard drives (whatever their size, however they're connected), and allows you to create redundant copies of the files you store, in order to prevent data loss when part of your hardware fails.

Installation

Currently there is no package available for install either in the Arch package repository or in AUR so Greyhole must be installed manually.

1. Install the required packages

# pacman -S mysql php php-pear samba base-devel rsync

2. Go to here and download the latest source package.

3. Extract the Greyhole files

# tar zxvf greyhole-*.tar.gz
# cd greyhole-*
# GREYHOLE_INSTALL_DIR=`pwd`

4. Create work directory for Greyhole

# mkdir -p /var/spool/greyhole
# chmod 777 /var/spool/greyhole

5. Install Greyhole files

# install -m 0755 -D -p greyhole /usr/bin
# install -m 0755 -D -p greyhole-dfree /usr/bin
# install -m 0750 -D -p greyhole-config-update /usr/bin
# install -m 0644 -D -p logrotate.greyhole /etc/logrotate.d/greyhole
# install -m 0644 -D -p greyhole.cron.d /etc/cron.d/greyhole
# install -m 0644 -D -p greyhole.example.conf /etc/greyhole.conf
# install -m 0755 -D -p greyhole.cron.weekly /etc/cron.weekly/greyhole
# install -m 0755 -D -p greyhole.cron.daily /etc/cron.daily/greyhole

6. 2 files required for php-pear don't seem to be supplied with archive so grab them from Github and move them into the required location

# wget https://raw.github.com/gboudreau/Greyhole/master/includes/common.php
# wget https://raw.github.com/gboudreau/Greyhole/master/includes/sql.php
# include_path=`php -i | grep include_path | awk -F':' '{print $NF}'`
# mkdir "$include_path/includes"
# install -m 0644 -D -p includes/common.php "$include_path/includes"
# install -m 0644 -D -p includes/sql.php "$include_path/includes"

When setting the include_path if PHP complains about the timezone then set your timezone in the /etc/php/php.ini file.

7. Install the Samba VFS module Find out what version of Samba you are running

# smbd --version

If you are running Samba 3.4

# if [ -x /usr/lib64/samba/vfs/ ]; then cp samba-module/bin/greyhole-x86_64.so /usr/lib64/samba/vfs/greyhole.so; else cp samba-module/bin/greyhole-i386.so /usr/lib/samba/vfs/greyhole.so; fi

If you are running Samba 3.5

# if [ -x /usr/lib64/samba/vfs/ ]; then cp samba-module/bin/3.5/greyhole-x86_64.so /usr/lib64/samba/vfs/greyhole.so; else cp samba-module/bin/3.5/greyhole-i386.so /usr/lib/samba/vfs/greyhole.so; fi

If you are running Samba 3.6 then you will need to compile the module manually

# SAMBA_VERSION=`smbd --version | awk '{print $2}'`
# wget http://samba.org/samba/ftp/stable/samba-${SAMBA_VERSION}.tar.gz
# tar zxf samba-${SAMBA_VERSION}.tar.gz && rm samba-${SAMBA_VERSION}.tar.gz
# cd samba-${SAMBA_VERSION}/source3
# ./configure

Before building the module we need to fix a few files to work with Samba 3.6. Firstly download the following file into your current directory and run the patch command File:Greyhole-Samba-3.6.patch

# patch -p1 < Greyhole-Samba-3.6.patch

Next download the following file into the "modules" directory File:Vfs greyhole.c. Now we can build Samba

# make

This step may take a long time depending on how powerful your machine is. Once the process has finished you can copy the Greyhole module to the correct directory

# if [ -x /usr/lib64/samba/vfs/ ]; then cp bin/greyhole.so /usr/lib64/samba/vfs/greyhole.so; else cp bin/greyhole.so /usr/lib/samba/vfs/greyhole.so; fi

8. Now (re)start Samba

# rc.d start samba

or

# rc.d restart samba

9. Next we need to install the Greyhole init script however this will have to follow at a later date as I have not yet made one. A generic linux example init script is supplied with the Greyhole source and is called "initd_script.sh"

10. Finally we need to work around problems with the CIFS client

# modprobe cifs
# echo 0 > /proc/fs/cifs/OplockEnabled

==Configuration==
{{Note|This process is taken from the USAGE file that is supplied with Greyhole.}}
1. Setup Samba
Edit "/etc/samba/smb.conf" and add the following 2 lines to the [global] section
<pre>
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

Restart Samba

# rc.d restart samba

2. Setup the database If using MySQL: Ensure MySQL is running

# rc.d start mysqld
# 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. Customize the greyhole configuration at "/etc/greyhole.conf"

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

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

# rc.d start greyhole