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!
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
- http://www.openmediavault.org
- forum thread on manually installing OMV 0.6
- OMV new forum since August 8, 2014
- OMV old forum covering lots of kralizec topics
- How To Make A DebianDog-QuirkyTahr Multiboot USB Stick
- DebianDog forum thread
- Blue Pup forum thread
- DebianDog developers' thread for reference
- DebianDog utilities thread for reference
- DebianDog how-to thread for reference
- 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.
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: Select all
# 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"
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: Select all
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
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.
- 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.
- Boot DD from your USB stick.
- Open ROX-Terminal from its desktop icon.
- Run the following commands and answer Yes to all prompts:
Code: Select all
# 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: Select all
# 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: Select all
# 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: Select all
# 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: Select all
# 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.
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./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.
Code: Select all
# rm /usr/sbin/anacron # apt-get install collectd ; /etc/init.d/collectd stop # apt-get install tftpd-hpa
- Install package "openmediavault" 1.
Upon installing postfix select "Internet Site" and enter "nas.local" as your system mail name.
Code: Select all
# 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 libssl1 you could be prompted to choose how to restart services. I entered "Yes" to restart services automatically. - Install package "openmediavault" 2.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.
Code: Select all
# apt-get update # apt-get install openmediavault # see notes below. About 209 MB, it takes some time...
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/unofficia ... 4f5ca4cfd0
Edit /usr/share/openmediavault/mkconf/collectd.d/df and apply the patch described in the link above.
Essentially you need to change this line:with this oneCode: Select all
-o " MountPoint \"/\"" -n \
And stop the daemons - collectd then restarts on its own.Code: Select all
-o " Device \"/dev/root\"" -n \
Code: Select all
# /etc/init.d/rrdcached stop # stop error messages # /etc/init.d/collectd stop # stop error messages # omv-mkconf collectd
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: Select all
# 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.
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: Select all
# 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
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: Select all
# 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
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: Select all
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
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.