Debian RAID NAS on VIA EPIA HOWTO

From ThisBlueWiki

(Redirected from Datacube install)
Jump to: navigation, search

How to make a lunchbox-sized, quiet, low-power file server with RAID 1 or RAID 0

This guide will become obsolete with the release of Debian 4.0 'etch'. I've since upgraded my server to a RAID 5 configuration booting from Compact Flash and running Debian etch. For that guide, see Debian 4.0 'etch' RAID NAS on VIA EPIA HOWTO. --MagicHour 02:24, 8 March 2007 (PST)

If you're reading this, you've probably got a file server on your network at home, probably running on an old machine. These installations take up a lot of space, are often noisy and hot, and waste electricity. How about a stable, quiet, cool-running system that can serve files to Macs and Windows PCs, and can either use RAID 1, for maximum reliability when you just can't afford to lose valuable data, or RAID 0, to create huge shares up to a terabyte in size (using 2 500GB drives) at the cost of redundancy?

Now you can have it, for under $600 (as of September 2005) for a system with dual 300GB Seagate Barracuda hard drives. Mirrored, that's nearly 300GB of fail-safe storage; Striped, close to 600GB! Best of all, the system draws well under 100 watts (probably closer to 60) and has one, count 'em, ONE quiet fan. The 600MHz VIA CPU draws about 7 watts peak, and doesn't even need a fan.

For a system with a single 300GB Barracuda, in which case you'd skip most of these instructions because you don't need RAID, that price drops to about $435 at the time of writing. The beauty of it is that you only have to invest in the case and motherboard bundle once. Just keep swapping out hard drives and reinstalling as your storage needs grow. When EIDE (PATA) dies as a standard, get a SATA card supported by linux, drop it in the single PCI slot, and keep on upgrading year after year.

Even better, with the recommended case, this system even looks cool. It's a brushed-aluminum lunchbox sized case with bright, nicely-colored indicator LEDs. Be warned, however, I had to cover the power LED with some tape with black marker on it because it is very bright with a color similar to the green LEDs being used in new traffic signals, and was disturbing my sleep due to where it was placed in my room.

Note: this guide cribs heavily from Stan Kaufman's RAID1 on Debian Sarge guide; if you want to build a RAID fileserver but don't want to use the VIA hardware referenced in this guide, you can skip the appropriate sections here and also use his guide for reference.

Contents

Installation notes

These instructions are based on Debian sarge, which was the 'stable' release of Debian as of September 2005. Given Debian's track record, sarge is likely to remain the stable release for the next couple of years. Debian is the right choice for this installation because it is not bloated and therefore does not waste disk space which you could use to store data, it is extremely stable, and it has excellent package management and security update features.

This system will not have a GUI, and you will have to interact with the Linux command line. Once it is installed you can use 'swat' to manage your file shares from a web browser, which is pretty easy. The goal of this system is that you have to mess with it as little as possible once it's set up, so unless you are a truly novice user don't let this dissuade you. Just be aware.

Ingredients

  • 1 ITX-PC Aluminum 200W Silent Cube case and power supply
  • 1 VIA EPIA M 6000E, 600MHz Fanless motherboard with 600MHz VIA CPU and 128MB RAM (trust me, this will be plenty of CPU and RAM for a file server sitting on 100bT)
  • 2 large, quiet, cool-running EIDE (PATA or Parallel ATA) hard drives with low power consumption, preferably 5400rpm
  • 2 round (not flat!) single-device IDE cables, 12" long
  • 1 spare 2-device IDE cable
  • 1 spare CD-ROM drive
  • 1 3.5" to 5.25" set of drive mounting brackets
  • 1 drive power connector splitter or 1 mini to full-size power connector adapter (optional but highly recommended)
  • 1 i386 "netinst" CD image of Debian stable, burned to CD

Note on hard drives

Remember, the goal here is cool, quiet, and power-saving. Good 5400rpm drives almost always make less noise and less waste heat and use less power than their 7200rpm siblings. You shouldn't be concerned about speed, since the theoretical maximum transfer rate over a 100bT network is 10MB/sec, and modern 5400rpm drives can outdo that in their sleep. Maxtor's Maxline II series is great, but may be going out of production. 7200rpm Seagate Barracuda 7200.8s will also do. Remember, the goal is mimimal noise and wattage.

Some sources claim that Seagate has had to disable AAM (Automatic Acoustic Management) on all their drives due to a patent lawsuit, and that the newer Barracudas are noisier than old Seagates when seeking. This would appear true with my 7200.8s, though the seek is still very quiet. Samsung has been consistently cited as a manufacturer of quiet drives, notably the Spinpoint line.

Users may be able to activate/deactivate AAM on capable drives using hdparm; Do 'man hdparm' and read about the -M option, including the warnings.

Avoiding problems with RAID

Drives should be of the same make and model, though mismatched drives MAY work as long as the smaller one is the initial install disk.

Installing hardware

Install the hard drives (with jumpers set to master) with the primary hard drive going up top with the mounting brackets and the secondary underneath with the special mounting "hood"-like thing. Connect the temporary 2-device IDE cable to the primary IDE interface (the one closer to the CPU), and one of the round cables to the secondary interface. Connect the 2-device cable to the primary drive and the round cable to the secondary drive; connect power and turn the system on to verify that the BIOS can at least see the drives. If it can't, something is wrong.

Set the BIOS boot devices to this order: CDROM, HDD-0, HDD-1.

Power the system down, unplug it again and hook the CD-ROM up to the second connector in the 2-device IDE cable, making sure it's jumpered for slave. If you have the power connector splitter, plug it into that, otherwise use the power connector for the secondary hard drive -- this power supply only has 2 drive connectors.

You'll have to run it with the hood off and the CD-ROM dangling as all three drives won't fit into the case.

Installing the operating system

Note: this section will assume you know to choose the default and/or correct answers for trivial questions like language, keyboard type, etc. Also, you must have a working network connection via Ethernet to the machine in order for this install to work; otherwise, you should install from full Debian binary release CDs.

  1. Boot the Debian installation CD, choose appropriate values for language and so forth and let it unpack the installer. The boot CD may appear to hang at the initial Debian logo screen; just press enter.
  2. When you get to partitioning, it should be pointing to IDE1 master (hda). If it's pointing to hdb, hdc or hdd you've screwed up your cables; fix them and get back to this point. Select 'Manually edit partition table.'
    • Select IDE1 Master (hda) from the next screen and create a new empty partition table on the device.
    • Select the new pri/log partition and create 3 new partitions on it:
      • 2GB primary beginning, ext3, mount point /, bootable flag on (becomes hda1)
      • 64MB primary end, swap (becomes hda2)
      • primary max, ext3, no mount point, bootable flag off (becomes hda3)
    • If you have the power connector splitter, partition your second hard drive (hdc) the exact same way.
    • Select "Finish partitioning and write changes to disk." Ignore the tempting RAID option.
    • It will warn you about hda3 not having a mount point. Continue without going back and assigning one.
  3. Debian will begin installing the base system. This will take a while on the EPIA M 6000E.
  4. Allow Debian to install GRUB to the master boot record.
  5. Reboot when prompted.
  6. Set the hardware clock to GMT and set your time zone (you can fix the date and time later if necessary). Set a password for root and create a new user with a password. Ideally this would be the same username you use to log into your Windows machines, if you're only setting things up for yourself. There can't be any spaces, however.
  7. Choose http for apt, and select a mirror near you.
  8. At the Debian Software Selection screen, select File Server and
  9. For the Samba workgroup question, if you have windows machines with the default settings in effect, name the workgroup WORKGROUP, otherwise name it whatever you use on your network.
  10. When it comes to configuring Exim, most people will want "mail sent by smarthost; no local mail." You want mail capabilities so the system can e-mail you about problems.
    • Answering the first question with the default 'localhost.localdomain' will do fine, or you could change it to your hostname (for example 'datacube'), or your FQDN if you are putting the system on a domain (for example 'datacube.domain.com').
    • Answer the second with the address of your outgoing SMTP server -- usually you can find this in the configuration of your mail program, like Outlook or Eudora or Thunderbird or Apple Mail.
  11. Login as root. Run 'aptitude' and hit 'g' and let it install more packages. Why these aren't installed properly in the first place, and why 'apt-get install' doesn't see them, is beyond me.

Configuring mail if your ISP uses Authenticated SMTP

You want to do this in order to be able to receive e-mail when the various monitoring utilities detect something going wrong with your RAID or drives. You only need to do this if you need a username and password to login to your SMTP server before sending mail; see the configuration of your e-mail software to determine if this is the case.

  1. Login as root. Edit (use 'vi' or 'pico') /etc/exim4/passwd.client and put in the right values for your SMTP server. If your server doesn't support SSL/TLS connections, read /usr/share/doc/exim4/README.SMTP-AUTH.

Installing a new kernel

It is highly recommended to install a 2.6.x kernel which is properly configured for this specific hardware and application.

Using my custom-built kernel

I've built a 2.6.8 kernel which is optimized for the EPIA M 6000E hardware and which contains a variety of other useful options built-in, and a number of things not needed removed.

Download the Debian package from the following page and install it using 'dpkg -i': Image:Kernel-image-2.6.8 datacube.20050911.1 i386.deb

  1. As root, wget http://wiki.evernex.com/images/4/48/Kernel-image-2.6.8_datacube.20050911.1_i386.deb
  2. dpkg -i Kernel-image-2.6.8_datacube.20060911.1_i386.deb

Building your own kernel

You need to know what you are doing to do this. I recommend you download my supplied kernel above, install it, and examine the configuration I used, which is present in /proc/config.gz when the kernel is running. If you are not using the EPIA hardware, you will need to build your own kernel; examine Stan Kaufman's RAID1 on Debian Sarge guide.

  1. Use aptitude to install the kernel-package, libncurses5-dev packages, or apt-get install kernel-package libncurses5-dev
    • (libncurses5-dev is necessary if you wish to use 'make menuconfig' to configure your kernel)
  2. Install the latest kernel-source-2.6.x package using aptitude or apt-get
  3. cd /usr/src/linux
  4. tar xvjf kernel-source-[blah]
  5. ln -s kernel-source-[blah]/ linux
  6. cd linux
  7. Run make menuconfig and config the kernel properly, compiling RAID directly into the kernel, NOT as modules. See Stan Kaufman's RAID1 on Debian Sarge guide as necessary.
  8. Do make-kpkg --revision=hostname.YYYYMMDD.x kernel-image where YYYYMMDD is the current date and x is your attempt number, in case you screw up. Get a sandwich and watch some TV; this will take quite a while on the EPIA.
  9. use dpkg -i to install the kernel-image package that was created in /usr/src

After installing the new kernel

Checking RAID support

  1. Disconnect CD-ROM, connect second hard drive if applicable. Reboot.
  2. Check /proc/mdstat to check for the "personalities" of RAID the kernel is capable of:
    $ cat /proc/mdstat
    Personalities : [raid1]
    read_ahead 1024 sectors

    If you don't see any personalities in /proc/mdstat, then you need to redo the kernel.

Setting up RAID

This involves several steps. Here's the concept: for each of our original partitions (excluding swap since we're not putting swap into the RAID but rather "striping" the swap -- see below) /dev/hda1 ... /dev/hdan, we'll create RAID1 devices /dev/md0 ... /dev/md(n-1) with the /dev/hdax partition "missing" and the /dev/hdcx present. We'll then copy over the contents of all the /dev/hdax partitions to /dev/hdcx, then boot to the new RAID1 device, add back /dev/hda, and let the RAID1 system rebuild /dev/hda. Thus

  1. Install mdadm and hdparm at this point.
    apt-get install mdadm hdparm
  2. If you haven't partitioned your second hard disk, you can try to copy the partition scheme from the first to the second with the following command:
    sfdisk -d /dev/hda | sfdisk /dev/hdc
    This may not work for some hard drives. In that case, run 'cfdisk /dev/hda' on the first one, write everything down, and run 'cfdisk /dev/hdc' and create an exact duplicate partition table on the second disk. Remember to set bootable and type flags.
  3. Now set the partition type to Linux RAID autodetect on every non-swap partition on hdc. Run 'cfdisk /dev/hdc' and set the type of every partition but the swap to 'fd'. Then Write and Quit.
  4. Set up the swap partition on hdc: 'mkswap /dev/hdc2' (or whatever your swap partition is) and 'swapon -a'. You may have to 'mkswap /dev/hda2' as well, during my install Debian conveniently forgot to format my initial swap partition. Add a line to /etc/fstab for the swap partition on /dev/hdc2 (or whereever) so it'll be activated at boot next time.
  5. Reboot and make sure things still work.
  6. Create and format the new RAID1 (or RAID0 if you're living dangerously) devices with mdadm and mkfs. Note how we pass mdadm the two drive arguments -- the first one "missing" and the second one /dev/hdcx:
    # mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/hdc1
    # mkfs.ext3 /dev/md0# mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/hdc3
    # mkfs.ext3 /dev/md1

    Don't do this for your swap partitions, of course.

Copying the system

At this point, we mount the new RAID device /dev/md0 to a mount point and copy over the appropriate stuff from /dev/hda. If you're following this guide to the letter, you only need to copy / to /mnt once /dev/md0 is mounted on it, because there's noting in the other big partition which will be for your fileshares.

# mount /dev/md0 /mnt
# cp -dpRx / /mnt

Setting up the new fstab

Edit with your favorite text editor fstab on the new RAID device. Edit /mnt/etc/fstab. NB: the CD-ROM entry has been deleted since it's no longer needed. Note also the swap is left on /dev/hda2 and /dev/hdc2 and is not put in the RAID; the "pri=1" option "stripes" the swap across the two drives. Copy /mnt/etc/fstab to /etc/fstab.

Note how / is now /dev/md0. Don't forget to create a directory (in this case /shares) as a mount point for your big partition, and add that partition to the new fstab!

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/md0        /               ext3    defaults,errors=remount-ro 0       1
/dev/md1        /shares         ext3    defaults        0       2
/dev/hda2       none            swap    sw,pri=1        0       0
/dev/hdc2       none            swap    sw,pri=1        0       0
#/dev/hdb        /media/cdrom0   iso9660 ro,user,noauto  0       0
#/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

Setting up GRUB

Edit with your favorite text editor /boot/grub/menu.lst on the new RAID device, copy it to the first, and install grub on the second drive.

# add these entries at top of boot list
title           Debian GNU/Linux, kernel 2.6.8 RAID
root            (hd0,0)
kernel          (hd0,0)/vmlinuz ro root=/dev/md0 md=0,/dev/hda1,/dev/hdc1
savedefault
boot

title           Debian GNU/Linux, kernel 2.6.8 RAID Mirror Recovery
root            (hd1,0)
kernel          (hd1,0)/vmlinuz ro root=/dev/md0 md=0,/dev/hdc1
savedefault
boot

Edit /mnt/boot/grub/device.map and add a line (hd1) /dev/hdc, then copy that file to /boot/grub/device.map.

Now run grub-install /dev/hdc and once it completes, run grub --device-map=/boot/grub/device.map to do the following:

grub>  device (hd0) /dev/hdc
grub>  root (hd0,0)
grub>  setup (hd0)
grub>  quit

What this does is make grub think that either /dev/hda or /dev/hdc is equivalent to (hd0), the first hard drive the BIOS finds during boot. In other words, this means that grub can boot from either drive when the other is out.

Fixing partitions on first drive

Again, use 'cfdisk' on /dev/hda and change all non-swap partitions to type 'fd', RAID autodetect. Then Write and Quit.

Rebooting

Reboot the machine and if all is well, it will reboot with root running on the degraded RAID device -- remember, the first disk is still 'missing.' Create /shares and mount the big RAID partition to it.

/proc/mdstat will tell us that the first disks in each RAID volume are still missing. Use mdadm to add them and keep looking at /proc/mdstat to check the progress. Note that a partition of close to 300GB on this machine will take well over an hour to sync. While that big volume is syncing, you can get rid of a lot of unneeded packages to make your Debian install leaner, faster booting, and more secure. See below.

# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1]
md1 : active raid1 hdc3[1]
      291017408 blocks [2/1] [_U]

md0 : active raid1 hdc1[1]
      1951744 blocks [2/1] [_U]

unused devices: <none>
# mdadm --add /dev/md0 /dev/hda1
mdadm: hot added /dev/hda1
# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1]
md1 : active raid1 hdc3[1]
      291017408 blocks [2/1] [_U]

md0 : active raid1 hda1[2] hdc1[1]
      1951744 blocks [2/1] [_U]
      [===>.................]  recovery = 18.5% (361600/1951744) finish=0.4min speed=60266K/sec
unused devices: <none>

Trimming the installation

Unless you are talking to ancient Macs or *nix machines which use NFS, you can safely remove NFS and netatalk, along with some other packages which take up memory and may be unwarranted security risks if you're not using them.

apt-get remove netatalk nfs-common nfs-kernel-server portmap lpr pidentd slpd

Do not remove nfs-common or portmap if you plan on using autofs (automount). This is particularly useful if you want to set up a mount point in your shares folder and have a USB drive automatically mounted to it when it's plugged in; see below for further details.

Installing useful utilities

NTP

It's a good idea to keep your clock synchronized to the appropriate time on a file server where timestamps can be important, and the best way to do that is NTP.

Installing ntp, ntp-simple and ntp-server should work out of the box to keep your clock synced reasonably closely to the real accurate time, using pool.ntp.org. Additionally, you can now sync your other computers to this machine using NTP (Date and Time control panel, Internet Time tab in Windows XP) -- quite helpful when you want timestamps to match across the various machines that may be storing files on the server.

smartmontools

Smartmontools is a package which gives access to S.M.A.R.T. data from compatible hard drives, and which can monitor drives for signs of impending failure. Install the smartmontools package with aptitude or apt-get.

Edit /etc/default/smartmontools and uncomment the line that starts smartd. Then put something like the following in /etc/smartd.conf:

/dev/hda -a -o on -S on -n standby -H -l error -l selftest -s (S/../.././04|L/../../5/06) -m youremail@domain.com

/dev/hdc -a -o on -S on -n standby -H -l error -l selftest -s (S/../.././04|L/../../5/06) -m youremail@domain.com

This enables various types of S.M.A.R.T. monitoring and will send you warning e-mails if something bad is detected, plus the -s option enables a short self-test every day between 4-5am and a long self-test every Friday between 6-7am. 'man smartd.conf' for details.

To test that the e-mail will actually work, append -M test to the above lines and start smartd with '/etc/init.d/smartmontools restart'. Then check your e-mail in a minute or two. After you're satisfied that it works, remove the -M test and restart smartmontools.

Note that the self-tests degrade performance while they are running, so plan their timing carefully if you enable them. Some S.M.A.R.T. data can be collected without doing self tests, but it's good to do one at least once in a while.

Configuring mail for monitoring

When mdadm was installed, Debian helpfully put a script in /etc/init.d/ to start it up in monitoring mode for you. This script will send mail to root if something goes wrong. If you didn't tell Exim4 to send mail to an outside e-mail about, and took the default of "real-[username]" during setup, you want to change that now. Edit /etc/aliases and replace the root: real-username line with root: youremail@domain.com.

Then you need to test that it's working. Do 'mail youremail@domain.com' from the command line (a single period on a blank line ends the message) and 'mail root'. Both messages should show up at youremail@domain.com, which means that not only will mdadm mail to root about RAID problems get through, but smartmontools directly to the e-mail address you put in the config file will get through.

Setting up the network

You may wish to give your server a static IP on your LAN so that you can ssh to it or access it via IP in other ways should the need arise. You can accomplish this by editing /etc/network/interfaces or possibly by giving the machine a static DHCP address on your home router if you have one.

Testing the RAID

We installed grub into both disks so we should be able to boot with either disk. To test this, shutdown and power off the computer, unplug the power to one of the hard drives, then restart the computer. The computer should boot from the remaining disk.

It will reboot unless you have a brain-dead BIOS which detects the missing hard drive and waits for the user to press F1 to continue or F2 to enter BIOS setup. However, the good news is that with an adequate UPS and new drives, the likelihood of simultaneous drive failure and reboot (usually from a power outage) is remote.

In any case, once the computer has rebooted, you'll see from /proc/mdstat that the one drive is missing. Shut down and power off the computer again, then reconnect the drive's power. Reboot and now you can add the missing drive back in with mdadm. Make certain to allow the drive volumes to re-synch completely before you do anything else (may not be true). You then can repeat the process with the other drive.

Setting up Samba

This portion of the guide covers only common tasks in setting up file shares in a home or small-office environment; users needing more complicated capabilities such as groups and varying permissions should make use of the extensive help links available in swat, and read the Samba documentation in /usr/share/doc/samba-doc and /usr/share/doc/samba, as well as online (for Samba 3).

Note that the default config currently won't work with browsing the Network share in OS X -- it hangs Finder. Use command-K and enter smb://server.address.here/sharename to access shares (fix coming up).

Getting started

Make some directories in /shares for the various file shares you want.

Then edit /etc/inetd.conf and uncomment the line for 'swat'. You should now be able to connect to the machine with a web browser on port 901 at http://x.x.x.x:901/ where x.x.x.x is the machine's IP. Log in as root when it prompts you. It is not advisable to use swat over an unsecured wireless connection, as anyone could potentially sniff your root password when you log in.

Globals

  1. For users with only Windows (and possibly *nix) machines on their network who want wide-open shares which anyone can access, set security = share and see the "Open shares" section below. Users with Macs running OS X 10.4 (Tiger) or later, or who plan to eventually upgrade to 10.4 or later, need to set security = user.
  2. It may be helpful to set syslog = 1.
  3. Switch to Advanced and set null passwords = yes.
  4. Consider switching to advanced mode and setting oplocks = no. On Debian woody's version of Samba, enabling oplocks could lead to problems accessing files in Windows Explorer if the left-side preview pane was enabled and the file was previewable; for example, single-clicking an MP3 file in Explorer would lead to a play interface appearing in the left pane. Subsequent attempts to open the file in another application such as Winamp would fail. I do not know whether this behavior has been fixed in Samba 3. Please note that disabling oplocks will result in a performance decrease, though for a light-duty home or small-office fileserver, this should be unimportant.

Printers

Unless you intend on sharing a printer from the server, which is quite possible but currently beyond to scope of this document, you may wish to disable the printer shares.

  1. Open Printers in swat, then chose both printers and lp in turn and set browseable = no and available = no.

Shares

Home directories

Unless you know what you are doing, you should choose the homes share and set browseable = no and available = no.

Open shares

To set up an open share which anyone on your network can connect to regardless of NETBIOS username (generally their login name on Windows XP and MacOS X), you want to map every connecting user to the guest user, and map users with bad login info to the guest user, and allow the gust user to read/write the share.

Clearly, if security is an issue, this is not a good idea as anyone on your network could delete your entire share. See the other types of shares for more information. If you're in a trusted environment such as a home network behind a broadband firewall, this is the easiest type of share to use.

These instructions will cause all files to be written to the share as user:group nobody:nogroup (the default guest user) on the file server.

  1. Open the Shares tab in swat, create a share, then choose advanced mode.
  2. Set the path to the proper directory in /shares (or whereever) and enter a descriptive comment.
  3. Set force user = nobody.
  4. Set read only = no.
  5. The security-conscious could set create mask = 0740 and directory mask = 0750, though this doesn't matter much on an open share, since if anyone hacks into your server they presumably already have access to the open share.
  6. Set guest ok = yes.
  7. Commit changes, switch to Globals, switch to Advanced mode, and set map to guest = Bad User.

Please note that if you use the same username on any of your client machines as the non-root username you created when installing Debian, you will need to set a Samba password on the server for that account. Log in as the user you created, run 'smbpasswd' and enter the password you intend to connect with. You'll need to change this by hand by logging into the server and re-running 'smbpasswd' if you want to change it.

Alternatively, you can set map to guest = Bad Password in the Globals advanced view. If you do so, you should set guest ok = no for any non-open shares you create. There are caveats to this approach if you intend on creating non-open shares. Click the Help link next to the map to guest option in swat before setting it to Bad Password.

User-access shares

This section describes how to set up shares available to users with accounts on the server and valid passwords in the smbpasswd database. You will have to create accounts on the server ('man adduser' as root) and then give them Samba passwds ('smbpasswd user' as root); they can then use this username/password combination to access these shares.

You can use the valid users option or valid groups option to limit what users or groups of users can access certain shares; discussion of users and groups on Linux is beyond the scope of this document.

  1. Open the Shares tab in swat, create a share, then choose advanced mode.
  2. Set the path to the proper directory in /shares (or whereever) and enter a descriptive comment.
  3. Set read only = no.
  4. The security-conscious should set create mask = 0740 and directory mask = 0750 to (possibly) prevent anyone who has gained access to your server from reading the files in these shares directly on the machine.
    • If you have problems with user B not being able to write to files/directories created by user A, try setting these to 0760 and 0770 respectively -- this should work, but since I only have one user on my home network, myself, I haven't tested it.
    • You could also set force user = nobody. This will cause all files in the share to be owned by user 'nobody' on the server, but users will still have to authenticate before connecting. Since all files are owned by nobody, and users are mapped to nobody after connecting, there will be no problems with authenticated users being able to write to each others' files.
  5. Make sure guest ok = no.
    • Note that if you have map to guest = Bad Password set (see Open shares, above) and a user connects without a valid Samba password, they will not be able to later access these shares (at least from Windows XP) until they reboot and supply a valid password! This is because they are considered guests by the system, and guest ok = no is set for user-access shares, as it should be.

After setup

Once your shares are all set up and you've verified that they're working the way you want, it's a good idea to disable swat by commenting it out in /etc/inetd.conf until you need to change something. Like any server software, swat is a potential security hole, so it shouldn't be left running when it's not needed.

Adding automount support for USB drives

This section is largely taken from here.

If your kernel is configged right or you're using the provided kernel, apt-get install autofs.

(section incomplete)

Other uses for your system

CVS

You can use CVS, or Concurrent Versions System, to use your system as a reliable place to store source code for cooperative development. The CPU and memory requirements of CVS are quite lean, so your EPIA-based system will be more than adequate for most projects.

This section does not explain the use of CVS pserver, and is merely an overview of what is possible; interested users without CVS experience should read the documentation.

  1. Install cvs with aptitude or apt-get.
  2. Tell debconf your repository is in /shares/cvs, then tell it to create the repository.
  3. This guide does not cover using pserver; any user you wish to have access to your source repositories will need to be created with adduser and then added to the 'src' group using the command adduser [username] src.

(section incomplete)


Squeezebox2 SlimServer

If you're storing your MP3 files on your server and you own a SliMP3, Squeezebox or Squeezebox2 from http://www.slimdevices.com, you can install the SlimServer software directly to your server and use it to stream music to your player, run a web interface to control your player and manage playlists, and handle Internet radio for your player. Since your server will likely be always on, it's a great candidate for running SlimServer instead of any client machines on your network.

Even if you don't own one of the hardware players, SlimServer can still be used to stream your music to remote locations (such as your computer at work) from your server via a broadband connection. To do this, you must forward a port on your broadband router, usually port 9000.

Please note that the SlimServer cannot play files purchased from Apple's iTunes Music Store due to Digital Restrictions Management (DRM).

The slower EPIA machines (such as my 600MHz model) are rather slow for running SlimServer, which is a giant resource-intensive application written in Perl. Your Squeezebox player may act sluggish at times. As the player is a thin client for the server, it's the server's fault. I imagine a 1GHz or better EPIA would perform far more quickly. The trick is to be patient, especially when selecting large playlists or groups of songs to play, or when searching for music. If you start hitting buttons on the remote when you just told the player to play a directory with 500 songs, chances are it might abort before populating the playlist. Then your playlist will be incomplete. So chill!

As of summer 2006, SlimDevices has a beta Debian package of SlimServer 6.5b1 available. If you wish to see the obsolete installation instructions for 6.2.1, check the history for this article here. The transcoding instructions may still work, so far I haven't tested this with 6.5b1.

SlimServer 6.5b1

  1. Edit /etc/apt/sources.list to include the following line:
    deb http://debian.slimdevices.com/ stable main
  2. Run apt-get update followed by apt-get install slimserver (or use aptitude).
  3. Connect to your server with a web browser on port 9000 and follow any instructions there. You may need to factory reset your Squeezebox if it acts up after the firmware upgrade; do so by unplugging it, then plugging it back in to the power source while holding down the "add" key on the remote until the Squeezebox displays "Factory Reset."


Transcoding

If you want to transcode certain formats for streaming remotely or to save bandwidth streaming to a Squeezebox (by encoding WAV to FLAC on the fly, for example) it's easy to install codecs at least for MP3 and FLAC. I have not attempted Shorten, Monkey's Audio, AAC/Apple Lossless, or WMA (with wmadec). SlimServer 6.2 builds include a firmware upgrade that allows the Squeezebox2 to play WMA natively.

In a test of transcoding FLAC to MP3 on the fly and then streaming it to a remote Winamp instance, the 600MHz VIA C3 was easily able to handle the job at a sustained load of 27-30% with Player Settings set to a qval of 9 (poor quality but fast) and a bitrate of 320Kbps.

Setting the qval to 5 and the bitrate to 192Kbps resulted in a sustained CPU load of 64-71% with spikes to 100% during prebuffering. Preliminary tests revealed no skipping or stuttering in the stream.

  • MP3 (LAME): Debian doesn't include LAME due to MP3 patent issues, but http://www.rarewares.org/ offers a Debian package repository. As of this writing, to install LAME for transcoding with SlimServer (or for any reason):
    1. edit /etc/apt/sources.list and add deb ftp://ftp.nerim.net/debian-marillat/ sarge main
    2. apt-get update
    3. apt-get install lame (3.96.1-1 at this writing)
  • FLAC: Simply run apt-get install flac

See also

External links

TODO

This page was last modified on 11 March 2009, at 05:27. This page has been accessed 2,724 times.