Setting Up A Standalone Storage Server With GlusterFS And Samba On Debian Squeeze

Version 1.0
Author: Piotr Opara < piotr [dot] opara [at] gmail [dot] com >

This tutorial shows how to set up a standalone storage server on Debian 6.0, using GlusterFS and SAMBA, and custom scripts and settings to make life easier ;)

I do not issue any guarantee that this will work for you!

I do not issue any guarantee that you will understand my poor english ;)

 

1 Preliminary Note

Tutorial is based on Falko Timme article.

Linux Distribution:

I?m using the Debian 6.0 (Squeeze) distribution. The installation of the Debian is very simple, so I?m not going to explain it. Just remember that you'll need to have a disk or partition exclusive to data.

Network:

In this tutorial I use three systems, a two storage nodes and a windows client:

  • node1.example.com: IP address 192.168.20.106
  • node2.example.com: IP address 192.168.20.107
  • MS Windows client: IP address 192.168.20.7


2 Preparing The Nodes

We have to make sure, that both nodes are up to date and have installed SSH and other software that we like or need.

node1/node2

apt-get update
apt-get install mc ssh

We need to be sure, that both nodes should be able to resolve the other system's hostname:

node1/node2

vi /etc/hosts
127.0.0.1    localhost
192.168.20.106    node1.example.com    node1
192.168.20.107    node2.example.com    node2

 

Checking All Settings

node1

ping -c 1 node2

PING node2.example.com (192.168.20.107) 56(84) bytes of data.
64 bytes from node2.example.com (192.168.20.107): icmp_req=1 ttl=64 time=0.818 ms

--- node2.example.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.818/0.818/0.818/0.000 ms

node2

ping -c 1 node1

PING node1.example.com (192.168.20.106) 56(84) bytes of data.
64 bytes from node1.example.com (192.168.20.106): icmp_req=1 ttl=64 time=0.802 ms

--- node1.example.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.802/0.802/0.802/0.000 ms

 

3 Setting Up The Data Disks

On both nodes we have exclusive disk, we need to set them up:

node1/node2

fdisk /dev/sdb 

Command (m for help): <-- n
Command action
  e   extended
  p   primary partition (1-4) <-- p
Partition number (1-4, default 1): <-- 1
First sector (1-1305, default 1): <-- ENTER
Using default value 1 Last sector, +sectors or +size{K,M,G} (1-1305, default 1305): <-- ENTER
Using default value 1305

Command (m for help): <-- t
Selected partition 1
Hex code (type L to list codes): <-- 83
Command (m for help): <-- w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Now run

 fdisk -l

and you should find /dev/sdb1 in the output on both nodes:

Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux

Now we create a filesystem on /dev/sdb1, and mount the /dev/sdb1 to /data directory

node1/node2

mkfs.ext3 /dev/sdb1
mkdir /data/
vi /etc/fstab

... 
/dev/sdb1 /data ext3 defaults 0 0
...

Now run

mount -a

After that, you should find the share in the outputs of

df -h
/dev/sdb1             9,9G  151M  9,2G   2% /data
mount
/dev/sdb1 on /data type ext3 (rw)
Share this page:

1 Comment(s)