jasonwryan.com

Miscellaneous ephemera…

Microserver

image

I recently picked up a HP Microserver; a small, silent server to use primarily to back up my other boxes. I went for the 2GB version without any preinstalled operating system.

As I want this machine to just sit quietly in my garage for the next 5 or 6 years, I opted for Debian stable as the base system. After installing two 1TB drives, I set them up as an encrypted RAID 1 array, in a logical volume.

Pro tip when you get to the part of the partitioning where you configure the volume for encryption, make sure you select No for erase data. It took close to 90 hours to scrub both the hard drives. And, as I am not really expecting a visit from the spooks, that seems a little like overkill…

Once the base install was complete, I set up my SSH keys, tmux, configured the firewall and forwarded the necessary ports, set up NFS, and that was it. The box is deathly quite, can be mounted locally for rsync backups and accessed remotely (for a tmux session running irssi), and all for less than NZD700.

I knocked together a quick script1 to manage the backing up; currently I run it manually, but once I have the excludes file tweaked properly, I’ll set up a cron job to automate the task.

runbackup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Backup to remote server over NFS

if [ $(id -u) -ne 0 ]; then
     printf '%s\n' "You must run this as root. Terminating."
     exit 1
fi
 
if [ -d /media/Sentinel/Backups ]; then 
     printf '%s\n' "Sentinel mounted."
 else
     printf '%s\n' "Mounting Sentinel."
     mount.nfs 192.168.1.200:/home/jason /media/Sentinel || exit 1
 fi

# sync directories
 printf '%s\n' "Starting sync..."

 rsync -azP --delete --exclude-from=Scripts/excludes.txt \
     --log-file=Documents/rsync.log \
     /home/jason /etc /media/Sentinel/Backups/Centurion

 if [ "$?" -eq 0 ]; then
     printf '%s\n' "Synched successfully; now unmounting."
     umount /media/Sentinel
 else
     printf '%s\n' "Fail!"
 fi
Notes
  1. Any faults aside, it should be reasonably portable…

Comments