Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 21 Oct 2014, 16:04
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Network Storage Appliance With DebianDog and OpenMediaVault
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
step

Joined: 04 May 2012
Posts: 196

PostPosted: Mon 11 Aug 2014, 11:24    Post_subject:  Network Storage Appliance With DebianDog and OpenMediaVault
Sub_title: How To Make A NAS Appliance With DebianDog and OpenMediaVault
 

How To Make A Network Storage NAS Appliance With DebianDog and OpenMediaVault

OpenMediaVault is an open source linux server distribution that implements an excellent, self-contained Network Attached Storage (NAS) distribution. It can be installed on a spare PC in almost no time. So why bothering to combine OMV with DebianDog and to write this guide?

  • DebianDog provides methods to easily back up the complete OMV system. OMV alone - at least through its version 0.5 - does not offer a simple way to back up OMV to a point where the system can be completely restored with ease.
  • The NAS appliance presented here is embodied in a USB stick that you can move to different hardware at will.
  • The stick provides a familiar Puppy environment, so you can add your own tools and pets.
  • We make it because we can!


Credits

This How-To builds upon How To Make A DebianDog-QuirkyTahr Multiboot USB Stick, which describes making the pre-requisite USB stick with DebianDog and Blue Pup on it.

OpenMediaVault (OMV) is a fully-installed Debian server OS (not a live distro). Since DebianDog (DD) is essentially Debian + Puppy as a live distro, combining OMV and DD is easy and yields a live-boot OMV appliance. As of early August 2014, Debian-Squeeze-based OMV 0.5 is stable and end-of-life, while the release of Debian-Wheezy-based OMV 0.6 kralizec is expected any day soon. This guide combines DD with OMV kralizec.

OpenMediaVault Links

Other Links

Pre-Requisites

  • Some familiarity with the linux command line.
  • An 8 GB USB stick pre-installed with DebianDog (DD) and Blue Pup as detailed in the pre-requisite How-To (first link in section Other Links above).
  • A working wired network connection to the Internet. This guide is not designed for a wifi connection.
  • Turn off your laptop wifi interface. Ensure that DD can connect to the internet; type ping www.cisco.com and watch Cisco's reply network packets. Press Ctrl+C to stop the listing.


Let's Get Started
Create your USB stick following the pre-requisite How-To. Then verify which partitions are in your USB stick.
Note: /dev/sdb refers to the USB stick on my PC. On your PC you might need to change /dev/sdb to /dev/sdX where X represents a letter that identifies your USB stick on your PC. Make sure to replace X with the letter that correctly identifies your USB stick in all instructions.
Code:

# blkid | sed -n '/sdb/{s/UUID[^ ]* //p}'
/dev/sdb1: SEC_TYPE="msdos" LABEL="BLUE PUP V4" TYPE="vfat"
/dev/sdb3: LABEL="OMV" TYPE="ext4"
/dev/sdb5: LABEL="persistence" TYPE="ext2"
/dev/sdb6: LABEL="SWAP" TYPE="swap"

Above sdb2 and sdb4 are not displayed because sdb2 carries a F2FS filesystem, and sdb4 is an extended partition.
Note that I have changed the label of sdb3 from "DEBIANDOG" to "OMV" with respect to the pre-requisite How-To. sdb3 is a 2GB ext4 partition carrying DD, and sdb5 is a 1GB ext2 partition carrying persistence data. "persistence" holds the incremental state of the OMV system.

Essentially we are going to add Debian packages and modify configuration files in the "OMV" partition. We will also change the syslinux boot menu as necessary. The table below shows USB stick usage at the completion of this guide for my laptop, an Intel Mobile CPU with 2GB RAM. I left partition sizes at their default sizes.
Code:

           Label        Type  Capacity     Available   Used
/dev/sdb1  BLUE PUP V4  vfat  16MB         n/a         n/a
/dev/sdb3  OMV          ext4  1.97 GiB     1.75 GiB    117.33 MiB
/dev/sdb5  persistence  ext2  1007.90 MiB  210.81 MiB  745.88 MiB


A. Taking/Restoring A Snapshot
You may want to take a snapshot of your pristine DD system. If you are short on time you can skip this step, but I recommend to take it. The advantage of saving a snapshot is that should anything go wrong after this section, you won't need to start from scratch again. You will be able to start from the snapshot. I recommend keeping a snapshot folder in your hard disk drive or a network drive or external USB/SD memory, but not in the "OMV" or "persistence" partitions! Partition "BLUE PUP V4" is also OK, although you might quickly run out of space.

Any time you want to take a snapshot do:

  • Shutdown DD and reboot into Blue Pup.
  • Press Alt+F1 and select cascading entries "Utility" > "XArchive archiver". Click toolbar icon New, navigate to your snapshots folder on your HDD, network drive, etc. - not on the USB stick we are working on! Name the new snapshot file, and press "Open" to create the new archive. Now XArchive displays a file/folder selection window; leave it open for a moment.
  • Click once the icon labelled "sdb5" on the desktop to mount and open the persistence partition in ROX filer. Select all files and folders by pressing Ctrl+A, then deselect folder "lost+found" and file "persistence.conf" by pressing Ctrl while clicking once on their respective icons.
  • Now click and drag all selected icons to the XArchive selection window. Drop the selection and press OK. Let XArchive create the named .tar.gz file, which is the DD+OMV snapshot.
  • Now you can shut down Blue Pup and reboot into DD.

Any time you want to restore a snapshot do:

  • Shutdown DD and reboot into Blue Pup.
  • Click the icon labelled "sdb5" on the desktop to mount and open the persistence partition in ROX filer. Select all files and folders by pressing Ctrl+A, then deselect folder "lost+found" and file "persistence.conf" by pressing Ctrl while clicking once on their respective icons.
  • Press Ctrl+X to delete all selected files but "lost+found" and "persistence.conf".
  • In a new ROX filer window locate the snapshot file you want to restore. Drag and drop it into the sdb5 ROX filer window. Click once the snapshot file in sdb5 to open it in XArchive, maximize the window and click the Extract toolbar icon. Click Yes to confirm expanding the archive in the current directory, which is the root of sdb5.
  • Now you can shut down Blue Pup and reboot into DD.


B. Preparing DebianDog for OMV

  • Boot DD from your USB stick.
  • Open ROX-Terminal from its desktop icon.
  • Run the following commands and answer Yes to all prompts:
    Code:

    # apt-get update
    # apt-get upgrade # get latest Debian Wheezy system and security upgrades
    # apt-get install locales # OMV assumes that package locales is installed
    # apt-get install vbetool # switch physical monitor on/off from command line

  • We need to change the way networking starts. DD uses Frisbee or SNS but those do not play well with OMV's setup. So let's install a more standard networking combo. Note: We will lose our network connection temporarily, and restore it manually. If restoring fails you will need to go back to the last snapshot.
    Code:

    # apt-get purge frisbee # disrupts network
    # /usr/lib/klibc/bin/ipconfig -t 15 eth0 # restore eth0

    IP-Config: eth0 hardware address xx:xx:xx:xx:xx:xx mtu 1500 DHCP RARP
    IP-Config: eth0 complete (dhcp from 192.168.0.1):
     address: 192.168.0.5      broadcast: 192.168.0.255    netmask: 255.255.255.0
     gateway: 192.168.0.1      dns0: 192.168.0.1           dns1: 0.0.0.0

  • The table above shows ipconfig output for my PC on my LAN. My eth0 is configured through DHCP. Another option is static IP configuration. In either case write down all values, especially dns0. We will need all values in this section and in the next one. Let's set up a DNS nameserver address:
    Code:

    # echo nameserver 192.168.0.1 >> /etc/resolv.conf # replace with IP address of your dns0
    # service networking restart # ignore warning
    # /usr/lib/klibc/bin/ipconfig -t 15 eth0 # this should get DNS working now
    # ping www.cisco.com # Cisco must reply or you will need to restore the last snapshot

  • Install a more standard networking combo:
    Code:

    # apt-get install dhcpcd resolvconf isc-dhcp-client isc-dhcp-common

  • Change the hostname ("Debian" is the default value). For instance, to set the hostname to "nas.local":
    Code:

    # echo nas > /etc/hostname
    # echo -e "127.0.0.1\\tnas.local nas localhost" >> /etc/hosts
    # /etc/init.d/hostname.sh

  • If your network address is configured through DHCP you may shut down and reboot into DD, then run hostname ; ping www.cisco.com in a ROX-Terminal window to verify that you successfully completed this section. Then you may take a snapshot. But if you set a static IP address do not reboot yet, and proceed through sections C and D. Section D explains why.


C. Installing OMV Kralizec
We are going to adapt the general istructions given in the forum thread linked in section OpenMediaVault Links. According to that thread, you will get exactly the same that you would get in the OMV kralizec standard ISO image. However, do realize that the underlying DD Debian Wheezy OS differs from the Debian netinstall image that the OMV ISO includes. That is one reason for writing this guide.

  • First some preliminary steps to keep the openmediavault package installation from failing in the DD live environment.
    Code:

    # rm /usr/sbin/anacron
    # apt-get install collectd ; /etc/init.d/collectd stop
    # apt-get install tftpd-hpa

    /usr/sbin/anacron is a symlink to /bin/true, which would make OMV boot fail in /etc/init.d/live-config. package OMV will install the real anacron. The apt-get commands pre-install some packages that package openmediavault does include in its dependencies, but that misteriously fail if installed with the main package.
  • Install package "openmediavault" 1.
    Code:

    # echo "deb http://packages.openmediavault.org/public kralizec main" > /etc/apt/sources.list.d/openmediavault.list
    # apt-get update # ignore warning about package signatures # install without verification
    # apt-get install openmediavault-keyring postfix # see notes below

    Upon installing postfix select "Internet Site" and enter "nas.local" as your system mail name.
    Upon installing libssl1 you could be prompted to choose how to restart services. I entered "Yes" to restart services automatically.
  • Install package "openmediavault" 2.
    Code:

    # apt-get update
    # apt-get install openmediavault # see notes below. About 209 MB, it takes some time...

    Upon installing mdadm I entered "none" for MD arrays needed for root filesystem, and "Yes" to start MD arrays automatically. You may need to answer differently according to your disk hardware setup.
    Upon installing proftpd I entered "standalone". In an earlier test build I had entered "inetd" but later on there were some issues.
  • initialize OMV: type omv-initsystem. OMV will take some time to do its thing. No output means OK.
  • A defect in the soon-to-be-released OMV kralizec configuration causes massive collectd error messages in /var/log/syslog. A patch is described in this page:
    https://github.com/svn2github/unofficial_openmediavault_mirror/commit/186c9a452ded40e272c85afc46e6724f5ca4cfd0
    Edit /usr/share/openmediavault/mkconf/collectd.d/df and apply the patch described in the link above.
    Essentially you need to change this line:
    Code:

    -o " MountPoint \"/\"" -n \

    with this one
    Code:

    -o " Device \"/dev/root\"" -n \

    And stop the daemons - collectd then restarts on its own.
    Code:

    # /etc/init.d/rrdcached stop # stop error messages
    # /etc/init.d/collectd stop # stop error messages
    # omv-mkconf collectd



D. Persistent Network Configuration
Debian live-config overwrites network interface configuration at each reboot. It assumes a DHCP server is available. That is why section B advises not to reboot if your network does not have a DHCP server. Now we are ready to change live-config so that OMV's configuration can persist, including static IP addresses.

  • In a ROX-Terminal window type omv-firstaid then configure the eth0 network interface with the addresses that you jotted down in section B. After this step type cat /etc/network/interfaces and verify the soundness of the eth0 settings. Below is an example for my PC. I commented out the eth0 section for an inactive DHCP configuration, and left uncommented the eth0 section that sets static IP addresses. Comment out one or the other and replace with addresses for your network. Make sure to include dns-nameservers for static addressing (dns-nameservers accepts multiple addresses).
    Code:

    # The loopback network interface
    auto lo
    iface lo inet loopback
    iface lo inet6 loopback

    # eth0 network interface
    auto eth0
    allow-hotplug eth0

    #iface eth0 inet dhcp

    iface eth0 inet static
        address 192.168.0.5
        gateway 192.168.0.1
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        dns-nameservers 192.168.0.1

    iface eth0 inet6 manual
        pre-down ip -6 addr flush dev eth0

  • Make network addresses persistent. Click once the "sdb1" icon on the desktop. When ROX filer opens, navigate to file "syslinux.cfg" under folder "boot", edit the file and append ip=frommedia to the list of live boot options that starts with "append root". Change "menu label DebianDog Wheezy..." to "menu label OMV on DebianDog Wheezy...". Save the file. Close Geany and ROX filer and unmount sdb1.
  • Shutdown DD and reboot DD. Networking should be configured without further ado. Try pinging Cisco...
  • Now is a good time to take another snapshot.


E. Persistent fstab Configuration
Debian live-config overwrites fstab configuration at each reboot but we want fstab to persist and reflect OMV configuration. So let's add a boot-time hook:
Code:

# cat << 'EOF' > /lib/live/config/9980-omv-fstab
#!/bin/sh

## live-config(7) - System Configuration Scripts
## Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.


echo -n " omv-fstab: refreshing fstab from OMV config.xml"
   /usr/sbin/omv-mkconf fstab
EOF

# chmod 755 /lib/live/config/9980-omv-fstab
# /lib/live/config/9980-omv-fstab

More information on customizing live-boot: http://live.debian.net/manual/current/html/live-manual/customizing-contents.en.html#514.

F. Skipping The Graphical Interface
Our NAS appliance should display the physical monitor like all servers do. We need to skip starting the graphical interface. I have also thrown in command-line tools to turn off/on the physical monitor.
Code:

# cat << 'EOF' > /opt/bin/screen-off
#!/bin/sh
# call this script without parameters in /etc/rc.local
if test "$1" = -w; then
  echo 'Blanking the monitor in 3 seconds. Press the ENTER key to turn it back on.'
  sleep 3
  sudo sh -c 'vbetool dpms off; read; vbetool dpms on'
else
  sudo sh -c 'vbetool dpms off'
fi
EOF

# chmod 755 /opt/bin/screen-off

# cat << 'EOF' > /opt/bin/screen-on
#!/bin/sh
sudo sh -c 'vbetool dpms on'
EOF

# chmod 755 /opt/bin/screen-on

Use screen-off -w and screen-on from the command line.
To skip starting X at boot time and instead blank the monitor after 10 seconds edit /etc/profile and change the last few lines that invoke startx as follows:
Code:

if [ -z "${DISPLAY}" ] && [ $(tty) = /dev/tty1 ]
then
#startx
  echo -ne "/etc/profile says:\\nBlanking the monitor in 10 seconds"
  sleep 1
  for i in {9..4}; do
   echo -n " $i"
   sleep 1
  done
  echo -e "\\n3 seconds left; press the ENTER key to turn the monitor back on."
  sleep 3
  vbetool dpms off; read ; vbetool dpms on
fi


Now when DD boots up it skips starting the graphical interface and blanks the monitor. Should you need to start X press ENTER then execute startx. To leave X press Ctrl+Alt+F1 to go back to the command line then press Ctrl+C.

Time to take another snapshot.

G. Conclusion
So you are done. Thanks for reading this far. Your new DD-OMV USB stick is ready. You can play with OpenMediaVault and set up your NAS. To interact with OMV open a web browser and visit the IP address of your NAS. Enter admin as the user, and openmediavault as the password.

Tips

  • Consider installing the Midori browser on your DD stick. It is only useful if you plan on opening OMV's web interface from the USB stick, in which case Dillo just isn't good enough. Or you may only browse your NAS from another PC, and so save space in your persistence partition. To install Midori: apt-get install midori.
  • Run omv-firstaid from ROX-Terminal and change admin GUI password.
  • Change root's password from a ROX-Terminal with passwd.
  • Enable the ssh service from the OMV web interface. Then you can ssh into your NAS.

Congratulations!

_________________
FatDog64 631|Blue Pup 4|DebianDog+OpenMediaVault stick
Back to top
View user's profile Send_private_message 
step

Joined: 04 May 2012
Posts: 196

PostPosted: Mon 11 Aug 2014, 11:25    Post_subject:  

Reserved
_________________
FatDog64 631|Blue Pup 4|DebianDog+OpenMediaVault stick
Back to top
View user's profile Send_private_message 
Volhout


Joined: 28 Dec 2008
Posts: 402

PostPosted: Fri 15 Aug 2014, 11:13    Post_subject: Fantastic....  

Hi step,

This is great, and I will try it soon.
Despite the fact that it is educating, and I will enjoy to follow your actions (and try to understand why), I wonder if it is interesting for the crowd to make this stick image available (at least the 7 Gbytes, excluding the swap partition)....?

Volhout
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1136s ][ Queries: 11 (0.0039s) ][ GZIP on ]