Tag Archives: arch linux

Setting up a 2-node GlusterFS filesystem

This will be a quick howto on how you would set up a 2-node GlusterFS filesystem. You may look up more information at http://www.gluster.org/.

Volume types for GlusterFS

– Distributed. Distributed volumes distributes files throughout the bricks in the volume
– Replicated. Replicated volumes replicates files across bricks in the volume
– Striped. Striped volumes stripes data across bricks in the volume
– Distributed Striped. Distributed striped volumes stripe data across two or more nodes in the cluster
– Distributed Replicated. Distributed replicated volumes distributes files across replicated bricks in the volume
– Distributed Striped Replicated. Distributed striped replicated volumes distributes striped data across replicated bricks in the cluster
– Striped Replicated. Striped replicated volumes stripes data across replicated bricks in the cluster

The high level overview of how the process will be is as follows

  • Installing the required software
  • Disable or add proper firewall rules
  • Adding nodes into the cluster
  • Preparing “bricks” for use on each server
  • Creating and starting the actual GlusterFS volume
  • Mounting the GlusterFS volume
  • Installing the required software

    I will be providing examples for CentOS, Fedora, Debian and Arch Linux. The examples for CentOS will work for RHEL and Scientific Linux as well.
    The following command will install all dependencies.

    # yum install glusterfs

    The following command will install all dependencies.

    # yum install glusterfs-server

    The following command will install all dependencies.

    # apt-get install glusterfs-server

    Arch Linux
    The following command will install all dependencies.

    # pacman -S glusterfs

    Disable or add proper firewall rules

    You will need to open the following ports for GlusterFS.

    24007 – GlusterFS Daemon
    24008 – Management
    24009 - Each brick for every volume on your host requires it’s own port. For every new brick, one new port will be used starting at 24009. (For GlusterFS versions earlier than 3.4)
    49152 - Each brick for every volume on your host requires it’s own port. For every new brick, one new port will be used starting at 49152 (GlusterFS 3.4 and later)
    38465:38467 - This is required if you use the GlusterFS NFS service.

    Disabling the default firewall

    # chkconfig iptables off
    # service stop iptables


    systemctl disable firewalld
    systemctl stop firewalld

    There are no default firewall installed on Debian.
    Arch Linux
    There are no default firewall installed on Arch Linux.

    Adding nodes into the cluster

    This is incredibly easy. You may do the following command from either server. In my example I am on server1. If you don’t have a solid DNS you should add each server to each others hosts file.

    # gluster peer probe server2
    Probe successful

    Preparing “bricks” for use on each server

    Nothing fanzy, you just need to create folders. It’s also important to note that you will need to use a folder, even if you intended to use a single disk.
    Execute the following on both of your servers

    # mkdir -p /data/brick>

    Creating and starting the actual GlusterFS volume

    Creating the GlusterFS volume

    gluster volume create NEW-VOLNAME [replica COUNT] [transport [tcp | rdma | tcp,rdma]] NEW-BRICK...


    # gluster volume create test-volume replica 2 transport tcp server1:/data/brick server2:/data/brick
    Creation of test-volume has been successful
    Please start the volume to access data.

    Starting the GlusterFS volume

    # gluster volume start test-volume

    Mounting the GlusterFS volume

    It’s important to note that you will need to mount the GlusterFS to use it. WARNING: Adding files directly to a brick will not be included in a GlusterFS volume.

    # mount.glusterfs servername:volumename /mnt/mountpoint


    # mount.glusterfs server1:test-volume /mnt/glusterfs/


    # mount -t glusterfs server1:test-volume /mnt/glusterfs/



    // CrashMAG

    View information about your BIOS from Linux using dmidecode

    To get at this information we will use a utility called “dmidecode”. dmidecode is a tool for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format.

    On CentOS/RHEL/Fedora you may run the following to install it.

    # yum install dmidecode

    On Arch Linux you may run

    # pacman -S dmidecode

    The following examples will allow you to see a few important parts of information such as;

    • The manufacturer of your motherboard
    • What type of motherboard you have
    • The version of the BIOS running on your motherboard

    To view the manufacturer and what type of motherboard you have, run the following

    dmidecode --type system


    # dmidecode 2.11
    SMBIOS 2.4 present.
    Handle 0x0001, DMI type 1, 27 bytes
    System Information
            Manufacturer: Gigabyte Technology Co., Ltd.
            Product Name: GA-MA78G-DS3H
            Serial Number:
            UUID: 4E2F4100-0000-0000-0000-0000FFFFFFFF
            Wake-up Type: Power Switch
            SKU Number:
    Handle 0x0034, DMI type 32, 11 bytes
    System Boot Information
            Status: No errors detected

    To view the version of your BIOS you may run the following

    #dmidecode --type bios


    # dmidecode 2.11
    SMBIOS 2.4 present.
    Handle 0x0000, DMI type 0, 24 bytes
    BIOS Information
            Vendor: Award Software International, Inc.
            Version: FA
            Release Date: 09/19/2008
            Address: 0xE0000
            Runtime Size: 128 kB
            ROM Size: 1024 kB
                    ISA is supported
                    PCI is supported
                    PNP is supported
                    APM is supported
                    BIOS is upgradeable
                    BIOS shadowing is allowed
                    Boot from CD is supported
                    Selectable boot is supported
                    BIOS ROM is socketed
                    EDD is supported
                    5.25"/360 kB floppy services are supported (int 13h)
                    5.25"/1.2 MB floppy services are supported (int 13h)
                    3.5"/720 kB floppy services are supported (int 13h)
                    3.5"/2.88 MB floppy services are supported (int 13h)
                    Print screen service is supported (int 5h)
                    8042 keyboard services are supported (int 9h)
                    Serial services are supported (int 14h)
                    Printer services are supported (int 17h)
                    CGA/mono video services are supported (int 10h)
                    ACPI is supported
                    USB legacy is supported
                    AGP is supported
                    LS-120 boot is supported
                    ATAPI Zip drive boot is supported
                    BIOS boot specification is supported
                    Targeted content distribution is supported
    Handle 0x0029, DMI type 13, 22 bytes
    BIOS Language Information
            Language Description Format: Long
            Installable Languages: 3
            Currently Installed Language: n|US|iso8859-1

    There’s also additional options to use with dmidecode. You probably also want to try the following to get an idea of what type of information you can get your hands on.

    #dmidecode --type keyword
    Valid type keywords are:

    // CrashMAG

    Setting up and configuring the Deluge 1.3 web interface on a headless server

    This is a continuation of my previous article which goes through setting up and configuring the Deluge daemon. In my example I use Arch Linux. You may have another distribution and the commands to install the software will differ. Arch Linux separates the web interface out in a package. Your distribution may or may not. Most do however leave the Deluge web component out. See beneath for details for Debian, Ubuntu & Fedora.

    We want to set up the very slick web interface. See beneath for the screenshot.

    In addition to the software we already installed there’s more to go to get the web interface working. These are not installed by default so to do so, simply run the following.

    Arch Linux

    # pacman -S deluge


    # apt-get install deluge-webui


    # yum install deluge-web

    Install dependencies for deluge-web.

    # pacman -S python-mako

    This will also install the following dependencies

    Targets (3): python-markupsafe-0.9.2-1 python-beaker-1.5.4-1 python-mako-0.3.4-3

    Start the Deluge web client.

    # /etc/rc.d/deluge-web start

    Connect to the web client using your browser.

    http://server name or IP:8112

    NB: You will not be able to do the initial configuration using Google Chrome. But you can use the interface in general with Google Chrome.

    Configure the password.

    You can now monitor Deluge as you prefer using a web interface. If it’s set up properly you can access this from anywhere.

    // CrashMAG

    Setting up Deluge 1.3 on a headless server with Autoadd and Labels.

    Deluge has finally joined the ranks of the torrent clients able to run in an easy and efficient way on a headless box. They’ve now included the Autoadd plugin so that you can dump .torrent files into the specified directories and have Deluge add them and label them.

    In other words Deluge now handles multiple trackers very well and allows you to effectively organize your downloads.

    It’s worth mentioning that the client actually allow you to sort on trackers either way. With favicons even.

    In my example I will make use of Arch Linux. The method will in principal be the same on any distribution. Keep in mind that the biggest difference will be if your distribution has included scripts to start the daemons. Arch Linux has.

    There are primarily 2 methods that you want to make use of to remote control the Deluge daemon. Either the I’ll use the Deluge GUI client in my example. As the autoadd and labels plugins wont be possible to configure using the web client.

    1. The Deluge GUI client.
    2. The Deluge Web interface.

    From here on I’ll provide step-by-step instructions of how to get Deluge installed, running as a daemon and configured to autoadd torrents.

    Installing Deluge

    # pacman -S deluge

    This will install the following dependencies on a clean box:

    Targets (12): python-2.6.5-3 pyxdg-0.19.-1 setuptools-0.6.c11-2 boost-libs-1.43.0-1 libtorrent-rasterbar-0.15.2-1 pycrypto-2.1.0-1 zope-interface-3.5.3-1 twisted-10.0.0.-1 pyopenssl-0.10-2 xdg-utils- python-chardet-2.0.1-1 deluge-1.3.0-1

    Starting the daemon and defining the user which it will run under

    # nano /etc/conf.d/deluged

    Edit the


    and change it to your own.
    Start the daemon.

    # /etc/rc.d/deluged start

    Enable remote connections so you can administer the installation

    $ deluge-console
    $ config -s allow_remote True

    We now need to add the user information for authentication
    Edit ~/.config/deluge/auth for the user you’re running the Deluge daemon as.
    Add the following on a new line after the “localhost…” entry.



    # /etc/rc.d/deluged restart

    Now lets connect. Start your Deluge client and enter in your server information in the add host dialogue.
    NB: You need to enter Preferences -> Interface and disable the “Classic Mode” to be able to access the connection manager

    Once done open up “Preferences” and go to the plugins section. And select them as follows.

    Now navigate to the Autoadd section and configure it according to your needs.

    You repeat the last step for every tracker and/or type of torrents you want. And I must say, this setup is working very well for me.

    Further information can be found at http://dev.deluge-torrent.org/wiki/UserGuide/ThinClient

    // CrashMAG

    Nano syntax highlighting

    I wanted to share an easy way of adding syntax highlighting to your favorite editor. I’ll give you examples to use for Arch Linux, RHEL, CentOS, Fedora and Debian. This all requires you to add code to your ~/.nanorc file. Luckily, the nano packages contain what you want. You just have to add it.

    The typical format of these nanorc files that comes with the nano package is programming_language.nanorc.

    To list the available packages for each distributions please do the following

    RHEL/CentOS/Scientific Linux/Fedora

    # rpm -ql nano | grep nanorc


    # dpkg -S nano | grep nanorc

    Arch Linux

    # pacman -Ql nano

    They all reside in the /usr/share/nano/ folder on each system.

    You add languages to your ~/.nanorc the following way.

    $ cat /usr/share/nano/programming_language.nanorc >> ~/.nanorc

    The >> option will append information so you can keep using this command for each language you want to add syntax highlighting for.

    // CrashMAG