Debian Server
From David Darts Wiki
Updated: 01-16-2010
This is a guide for installing and configuring Debian Squeeze on a USB drive attached to the Seagate FreeAgent Dockstar. The Dockstar makes an excellent low power (128MB of RAM and 256MB Flash memory) server. The hardware supports (and provides power for) 4 USB drives and it only draws 8 watts max which makes it a great candidate for a 24/7 server (you can find out more about Plug Computers here). And the Dockstar is extremely affordable - I picked mine up on sale from Woot! for $20.
Once you've installed Debian on your Dockstar, you can check out the Post-Installation guide for more ideas for how to modify and use your server. You can also check out my PirateBox project including the PirateBox_DIY page for another way to utilize your Debian Dockstar.
I also recommend visiting Jeff Doozan's Dockstar forum for additional ideas and support.
Stuff You'll Need
- Dockstar (Ideally one that has never been connected to the Internet)
- USB Flash Drive (1GB or larger) (more info about compatible devices here). Note: you can also use USB hard drives like the FreeAgent Go Drive
- Partition Editor that can create Linux file systems (ext2,3,4). I recommend GParted - see below.
- Computer connected to your home network with SSH (Secure Shell Network Protocol - comes pre-installed on Ubuntu and Mac OS X - Windows users can use PuTTY).
Pre-Installation
Format Your USB Flash Drive
First, format your USB flash drive. If you're running Ubuntu, you can use the GParted partition editor. To install GParted, open a terminal and type:
sudo apt-get install gparted
Once installed, GParted can be found under the System > Administration > GParted menu.
Note: If you're not running Ubuntu/Linux, you can create and run a live CD or USB version of GParted. You can also use a Live Ubuntu CD which comes with GParted pre-installed.
Note: For this tutorial, we're going to make 3 partitions on your Flash Drive. The first partition will contain your system and should be formatted as ext2. This should be at least 512mb (ideally 1GB) as the bare-bones install is 280mb. The second partition should be formatted as "swap" (minimum 256mb). The third partition will be formatted FAT32 and should take up the remainder of your drive - it will be used for storing data. The FAT32 partition is optional unless you are planning to use your system as a PirateBox in which case it becomes your shared folder. I've suggested using FAT32 for this shared data partition as it is readable and writable on virtually any system and does not store permissions which ensures that you can easily access and modify the files across computers and users. See the PirateBox DIY Tutorial 2 for more details.
Note: you can also format the first partition as ext3 or ext4 though this is not recommended for flash drives as these file systems are journaled and add additional read/write ware to the device.
Prepare the Dockstar
- Now, disconnect your router from the Internet (e.g. unplug the ethernet cable from your modem).
- Then, plug in your formatted USB drive to the Dockstar (use the USB port in the back closest to the ethernet port) and connect the device to your router with an ethernet cable.
- Now, from a computer connected to your router, open a web browser and log in to your router admin page (e.g. http://192.168.1.1) to find the IP address that your Dockstar has been assigned on your network.
Note: If you find that your router does not assign an IP address to the Dockstar, first try rebooting both devices. If your router still does not provide an IP address for the Dockstar, you may have a "dud" (I've had one dud out of ten Dockstars). Power cycle the Dockstar by unplugging it and plugging it back in. Wait 2-3 minutes and check to see if the LED on the front of the Dockstar is blinking yellow/amber. This indicates that the Dockstar did not boot successfully. You should contact Seagate or the company your purchased it from and request a replacement.
- Next, from a computer connected to your router, open a terminal and connect to the Pogoplug partition of your Dockstar via SSH:
ssh root@IP_Address_Of_Your_Dockstar
- When prompted, enter the default password: stxadmin
- Next, prevent your Dockstar from auto-updating by running the following killall command (Note: this step is an extra precaution and may not be needed - according to Jeff Doozan a new out of the box Dockstar will take approximately 90 mins before auto-updating).
killall hbwd
- Now reconnect your router to the Internet.
Install Debian Squeeze
- Download and run Jeff Doozian's Debian install script by running the following commands in a terminal (one at a time). NOTE: More info on Jeff's Debian page.
Note: If your drive is formatted with ext4, first issue the following command:
fw_setenv usb_rootfstype ext4
cd /tmp wget wget http://dev.shyd.de/dockstar/dockstar.debian-squeeze.sh chmod +x dockstar.debian-squeeze.sh export PATH=$PATH:/usr/sbin:/sbin ./dockstar.debian-squeeze.sh
- The script will now download and extract the debian image on your USB flash drive. This will take some time - mine took about 25 minutes in total.
- Note: If the installation script returns an error message after a couple of minutes, try re-issuing the last command again.
- When the install is finished, the script will prompt you to reboot into your new install. After a couple of minutes, reconnect to your Dockstar via SSH. Note: my router re-assigned my Dockstar with the hostname "debian" which allowed me to login via SSH using:
ssh root@debian
- Depending on your router, you may need to use the IP address instead. You can confirm the IP address (and hostname if assigned) of your Dockstar by logging in to your router's admin page.
Change Password and Sources List (Optional)
- The default password for your new Debian install is "root." Once you're logged in, you should change your password to something more secure:
passwd
- Jeff also recommends changing the sources.list to point to something closer to where you are located (e.g. for those living outside the United States).
nano /etc/apt/sources.list
- Note: Disconnecting your Dockstar from power without first shutting it down via the command line can cause booting errors the next time you start it up. To avoid these problems, always halt the system first when you plan to unplug it by issuing the following command:
halt
- To restart your Dockstar, disconnect the power supply cable and then plug it back in.
Install Recovery System (Optional but Recommended)
The Dockstar comes with NAND flash memory set into four partitions. The first partition mtd0 (1 MB) contains an old version of the U-Boot boot loader. The second partition mtd1 (4 MB) contains a Linux kernel image, and the third partition mtd2 (32 MB) contains a Linux jffs2 file system. The remaining partition mtd3 (219 MB) is not used.
Jeff has built a rescue system that is designed to help you recover the system in the event of a catastrophic failure. This replaces the pre-installed Pogoplug kernel on mtd1 and the Pogoplug system on mtd2. Check out Jeff's explanation and instructions for more info.
To install the Recovery system,
cd /tmp wget http://jeff.doozan.com/debian/rescue/install_rescue.sh chmod +x install_rescue.sh ./install_rescue.sh
The default login is root and the password is also root (you can't change this as the system is mounted as read only). Note: If you receive an error message about the U-Boot boot loader, you can update your U-Boot by following these instructions.
Installing Software Updates
Once you've installed the base system, you'll want to install any available software and security updates. SSH into your Debian install and run the following command:
apt-get update
Next, check for and install any available updates using:
apt-get upgrade
Install GNU Nano Text Editor
Jeff's Debian installation includes the VI text editor. As an alternative, some people find the GNU Nano editor easier to use. To install, simply type:
apt-get install nano
Set Timezone
You can check the current date and time on your machine by running a simple command:
date
You can also check your system's timezone setting with:
cat /etc/timezone
To modify your timezone setting, you can use the following command:
dpkg-reconfigure tzdata
Synchronize your clock with a NTP server
The DockStar doesn't have a battery-backed Real-time clock (RTC). Therefore, to keep the time accurate, it is important to syncronize the system with NTP servers on the internet. ntpdate is a simple NTP client which allows a system’s clock to be set to match the time obtained by communicating with one or more servers.
You can install ntpdate using the following command:
apt-get install ntp
ntpdate will automatically run when booting your system. You can configure it by running:
nano /etc/default/ntpdate
Also, to see if ntp is running, use:
ntpq -p
Mount External Partitions and Drives
One of the great features of the Dockstar is that it provides power to three regular USB 2.0 ports and one mini USB 2.0 port (designed to accommodate the FreeAgent Go drive).
By default, the system will not automatically mount partitions and USB drives connected to the USB ports. If you followed the installation instructions above, your system will have one unmounted FAT32 partition. You can determine it's location by running the following command:
fdisk -l
The output will include something like this:
/dev/sdb1 1 38913 312568641 b W95 FAT32
To temporarily mount this drive, you can use the following command (substitute /dev/sdb1 with whatever your fdisk -l command returned as the drive mount).
mount -t vfat /dev/sdb1 /mnt
Note: If your drive is formatted with a different file system, you can substitute vfat with ext2,3,4, etc.
To permanently mount the drive/partition, you must create a new directory as a mount point and then add a new line to your ftsab file.
First unmount the drive you just temporarily mounted with this command (substitute /dev/sdb1 with whatever your fdisk -l command returned as the drive mount).
umount -t vfat /dev/sdb1 /mnt
Now create a new directory for the drive to mount in. You can use any name you like, however, if you are building a PirateBox then you are recommended to name the directory "share." Use this command:
mkdir /mnt/share
Now, open your fstab file:
nano /etc/fstab
And add this line (substitute /dev/sdb1 with whatever your fdisk -l command returned as the drive mount):
/dev/sdb1 /mnt/share vfat rw,auto 0 0
If your partition or drive is formatted with ext2,3,4 use this instead:
/dev/sdb1 /mnt/newdrive ext3 defaults 0 0
Note: be sure to include one blank line at the end of your fstab file.
Save and exit (you'll need to reboot for these changes to take effect).
Note: With some USB Hard Drives, the root file system won't find the disk in time to mount it. You can read this bug report for more info. You can test if your drive has been mounted by issuing the mount command:
mount
If your disk doesn't show up, try issuing:
mount -a
Your disk should now be mounted. As a workaround for this, I have installed the package usbmount:
apt-get install usbmount
Reboot your Dockstar and issue the mount command again to see if your drive is mounted (it should be).
Note: If you'd like to learn more about fstab, check out this informative tuxfiles article.
Backup Root File System
Once you've configured your Dockstar, it's a good idea to make a backup of the root file system so that if you later break something, you can easily restore your base system. An easy way to backup the root file system is to remove your USB drive from the Dockstar (be sure to issue the "halt" command to shut it down first) and copy it to a second USB drive with a Linux computer.
User restamp provided a simple command on Jeff Doozan's Docktar Debian forum that seems to work well. Just remember that $OLDROOT should be replaced with the mount point of your current Dockstar Debian USB drive and $NEWROOT is the mount point of your destination drive.
cd $OLDROOT && find . | cpio -pdm $NEWROOT
To use this command, first plug in the Debian Dockstar USB drive that you would like to backup.
Next become a super user - in Ubuntu the command is:
sudo su
Determine the mount point of your ext2 partition with:
mount
Note: if your ext2 partitions are not labeled (this was an option when you originally formatted the disk) then the mount points will be a series of digits.
Next plug in the destination USB drive (the drive you're going to back up the system to). Make sure the destination drive is formated to ext2 and has enough space to accommodate the Debian system. If you're planning to boot with the new drive, be sure to also add a 256MB swap partition. Determine the mount point of the ext2 partition on your new USB drive with:
mount
Now issue the copy command listed above substituting the appropriate mount points. The command should look something like this one below. The whole process will only take a couple of minutes.
cd /media/debian && find . | cpio -pdm /media/debian_backup
Afterwards, unmount the new drive and try booting it in the Dockstar to ensure it worked.
Post-Installation
There are LOTS of useful things you can do with your Debian Dockstar. Check out the Post-Installation guide for some ideas and more info. I also recommend visiting Jeff Doozan's Dockstar forum for additional ideas and support.
An additional idea is to turn your Dockstar into a PirateBox. You can find detailed instructions for doing this on the PirateBox_DIY page.

