Over the last several years, there have been some great discussions on how to set up a home media server with some form of drive pooling whether that be through software distributions like FreeNAS or through using tradition RAID. I am going to review two similar yet different types of drive pooling that can make the creation of your home media server easy while allowing you to scale at a reasonable rate. This functions much like WHS Drivepooling did using rsync and samba to keep track of your files.
After Microsoft decided to remove it’s form of drive pooling from Windows Home Server, users began looking for alternatives. Greyhole can be installed on most linux servers but for the purpose of this article, we will be demoing a setup of Greyhole on Ubuntu 12.04 64bit. (There are other ways to set this up – Greyhole)
The first thing that needs to be done is have your install of Ubuntu complete. I recommend any LTS release that is still under current support.
You should see something like the following on your default install.
As you can see from the above picture, only one disk (sda) is mounted and has partitions. Create partitions using fdisk.
Also be sure to create filesystems on each new partition using
sudo mkfs.ext3 /dev/sdX#
Get the UUID of each partition.
Add each of these to your fstab entries and mount the disks.
On Ubuntu, Debian and any other distribution using APT, you can use the Greyhole APT repository to install and keep Greyhole up to date.
Add the Greyhole APT repository to your APT config, import the GPG public key, then use apt-get to install or update Greyhole (the same apt-get command, install, will install and update Greyhole later):
sudo sh -c 'echo "deb http://www.greyhole.net/releases/deb stable main" > /etc/apt/sources.list.d/greyhole.list' curl -s http://www.greyhole.net/releases/deb/greyhole-debsig.asc | sudo apt-key add - sudo apt-get update sudo apt-get install greyhole
After greyhole has finished installing, we have to set up samba. Greyhole works be watchings the samba logs for activity and performs things based on the config file. For more information on how Greyhole works, click here.
Change or add the following values in the [global] section:
unix extensions = no wide links = yes
Configure your shares. Example share definition (taken from the USAGE file):
[share_name] path = /path/to/share 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 the samba service.
# 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
Customize the Greyhole configuration file, /etc/greyhole.conf, as needed.
Important: you need to either use the
date.timezone setting in your php.ini, or specify your timezone in greyhole.conf, using the
timezone config option.
You will need to specify the storage_pool_drives with minimal free space:
# storage_pool_drive = /mnt/hdd0/gh, min_free: 10gb # storage_pool_drive = /mnt/hdd1/gh, min_free: 10gb # storage_pool_drive = /mnt/hdd2/gh, min_free: 10gb # storage_pool_drive = /mnt/hdd3/gh, min_free: 10gb
Start the Greyhole service. Errors will appear in the greyhole log. You can also check this by
If everything was configured correctly, you should be able to run “greyhole -s” and have something like this appear.
In order to test the samba log functionality, mount the samba shares locally.
If Samba is configured correctly, you should have a something like this when doing a “df -h”.