Old Laptop as a File Server

There’s couple of reasons why you’d want to use laptop as a (home) server:

I’m using an old Acer 5520 which, with 2GB of RAM, a Dual Core AMD processor and a Gigabit Ethernet, can handle the task of a file server very well. I’ve connected two external drives, each 1TB in size, to store files.

First Problems

For a while things functioned really well and I was very pleased. Sure there was a problem with graphic chip, causing display not function from time to time, but that’s not something I was too concerned with.

The first actual problem appeared after couple of months, when system crashed on boot, with messages like the one bellow:

failed command: READ FPDMA QUEUED
status: { DRDY ERR }
end_request: I/O error, logical block 2

I’ve tried to fsck disk, with little success. Since this was a system disk and I didn’t care about its contents, I’ve decided to format and reinstall. It was rather obvious, at that point, that the nature of the problem is hardware. I’ve manage to reinstall but it didn’t last of course. Couple of days latter, on reboot, system crashed again with same messages.

System on a USB key

Since my internal disk was dead, I’ve decided to try and install system (in this case Arch Linux) on a USB key. For this at least 2GB drive is needed, I’ve used 4GB SandDisk key.

Getting system run from USB stick is super easy:

Operating System


The first sane choice was Debian, which was relatively fast and easy to use. I was using it and was very pleased with it, until my disk crashed.


Unfortunately I didn’t get pass the BTX Loader, when trying to boot into installer system just rebooted without saying anything at all. I’ve tried everything I could think of: turn ACPI off, safe mode ON, single user, verbose (boot -v), different versions. Always the same result. Of course, with no logs left behind and no error messages whatsoever being displayed, resolving this would be mission impossible, so I just gave up at some point. But I didn’t gave up on BSD.


NetBSD is know for wide hardware support, I suppose that’s the reason there was no problems I’ve experienced in FreeBSD.

I’ve installed and configure the system and couple of applications, like Transmission and Samba, only to finally realize there’s no ext4 support in BSD. Silly me! Both my external disks are using ext4 and at that point I wasn’t in the mood to convert them to something else (XFS or ZFS - still on my TODO list).

BSD is lightweight and fast - really fast. This is one system I’ll definitely come back to.


CentOS meant above all for enterprises, it’s a quite heavy and slow distribution; a definite overkill for my poor home server. I suppose I could’ve just removed some of the applications installed by default, but I prefer the other way around: start with a small base, and add what I need.


After my disk crashed I’ve installed Arch to replace Debian.

I’ll be the first to admit that Arch isn’t exactly the best option for the server. For me it’s not question of security (this is small home server, after all) or stability (in all the time I’m running it on the desktop, I had little to no problems with it), it’s the question of constant upgrades. I have feeling, I cannot leave it for a month like I could Debian. Only kernel gets upgraded couple of times per month, not to mention other things. And if you’re not upgrading it regularly, then yes, you’re compromising stability (meaning that, when you’ll finally upgrade it, it might die).

I have profound admiration for Arch, and with exception of BSD, Arch is the fastest and most lightweight on this list.


First of all, of course, I’ve installed SSH then Samba, rsync to keep simple backup, and finally transmission-cli, which I access from a web client.

File Organization

As I said, I have two drives, 1TB each, I call them simply Primary and Secondary (yay, lack of imagination). The Secondary disk is being used entirely for backups, and is mounted only when files are being copied to it.

Here’s how my files are organized on the Primary drive:

├── Audio
│   ├── Music
│   └── Talks
├── Documents
│   ├── Creative
│   ├── Official
│   ├── Other
│   ├── Plans
│   └── Projects
├── Dump
│   ├── Samba
│   └── Temp
├── E-books
│   ├── ...
├── Games
│   ├── GNU-Linux
│   └── Windows+DOS
├── Pictures
│   ├── Home
│   └── Other
├── Projects
│   └── Archive
├── Services
│   └── Torrent
└── Video
    ├── Home
    ├── Movies
    ├── Music
    ├── Series
    └── Various



I wrote about Samba previously, it’s worth mentioning that I have enabled nmbd and smbd.socket (Samba socket so the daemon is started on the first incoming connection).

I didn’t add Secondary disk to the fstab, and for the Primary, I’ve set to be mounted on fist access:

UUID=xxx-x-...  /home/Primary  ext4  defaults,nofail,x-systemd.automount  0 2

I’ve also set nofail option, so that disk is ignored if absent.


I’ve put together a small script which I use to do backups and I’ve added it to the Cron, to be executed daily. Script can be run manually too, as a root:

# ./daily-backup.sh

or to remove old files (sync!):

# ./daily-backup.sh delete



echo "Mount Primary"
mount -a
echo "Mount Secondary"
mount /dev/disk/by-uuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /home/Secondary/

echo "Is the primary drive mounted?"
if grep '/home/Primary' /etc/mtab > /dev/null 2>&1 ; then
    echo "YES."
    echo "NO, terminated.";
    exit 1;

echo "Is the secondary drive mounted?"
if grep '/home/Secondary' /etc/mtab > /dev/null 2>&1 ; then
    echo "YES."
    echo "NO, terminated.";
    exit 1;

echo "Sync started..."
if [[ $1 == 'delete' ]]; then
    echo "Will deleted obsolete files."
    rsync -avzh /home/Primary/ /home/Secondary/Backups/ --exclude=Dump --exclude=lost+found --exclude=.Trash-1000 --exclude=.hidden --exclude=Services --delete
    rsync -avzh /home/Primary/ /home/Secondary/Backups/ --exclude=Dump --exclude=lost+found --exclude=.Trash-1000 --exclude=.hidden --exclude=Services

echo "Unmounting drive..."
umount /home/Secondary
echo "Done!"
exit 0;

The point of it is to mount Secondary drive, check that both are mounted, run rsync with some parameters and finally unmount Secondary.


Because I’m not using bluetooth or wifi, I’ve used: rfklill block bluetooth and rfklill block wifi to keep those two off.

Finally, I’ve added /etc/udev/rules.d/99-lowbat.rules, to shutdown the computer when the battery start getting low:

# Poweroff the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="5", RUN+="/usr/bin/systemctl poweroff"
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="4", RUN+="/usr/bin/systemctl poweroff"
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="3", RUN+="/usr/bin/systemctl poweroff"
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="2", RUN+="/usr/bin/systemctl poweroff"
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="1", RUN+="/usr/bin/systemctl poweroff"
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="0", RUN+="/usr/bin/systemctl poweroff"

This is archived version of blog, preventing broken links. This version will stay online indefinitely.