Updates
2005:
Dec 29: Automated mirroring
Decenber 19
Kernel update -> 2.6.11.4-21.10-default
November
27 Server to run after power failure
|
While
playing around with Linux I started thinking whether I
could make
a web server work;
Apache 2 is built in Suse, so it can not be that bad I thought.
The
subject is well covered in the Internet and after some surfing
in that area I decided to give it a go.
I
got my server running somewhere October 2005. It was not a
complete success story from the very beginning, but it's serving pages
now. I keep studying and try to make notes on the subject. I know you
do not
need to do much once it's up and running. So the notes may come handy
some day.
The
hardware had to obtained. I found an old box that had been
working as a Windows NT Workstation in YLE, Finnish Broadcasting
Company. This box started a new life as a Linux web server.
When
I fired it up for the first time it was quite surprising. It
played the opening tunes like no other box I had heard. I almost
thought I had plugged loudspeakers to it. Can't be I'm making a server
here.
But of course, it had been in a broadcasting company. So that tiny
little beeber the boxes usually have was something better. So I
installed while listening to Zappa from the beeper.
At
a time I then had my server, it served its first page. I could well
surf on that Apache default page for one night. Then I thought I'll
come
back to Apache documentation later and started thinking what am I going
to show people in the Net?
I
already had written some stuff down while working on the beginning of
the project so I thought OK I'll put some notes up in the Net. By the
time somebody will find the page I will have my pages of motorcycles
and that ever beautiful unigue archipelago of ours. I will tell you
about that later, but since you're already here, I will tell you what I
got so far.
I'm
running Apache 2 on suse Suse 9.3, kernel
2.6.11.4-21.9-default.
Suse
9.3 is one fantastic distro. I've tried many Linuces and a
couple of Suses before, but I think 9.3 is fantastic. It will be
supported about a year and a half from now, so probably I will keep it
running on this iron till the end. But I somehow packed a lot of
nonsence in it as a server, like windowmanagers and desktops and stuff.
So I'll be making another one on Suse 10. That's what it is all about
on these pages.
I
already have 10.0 as a desktop machine and everything looks good.
10.0 OSS is the one. I've managed to have it play all the audio and
video so far so maybe I should put up here a few words of its use in multimedia.
One
learns while doing is my method here. I keep tuning the server
to
serve the Motorcycling Track Season 2006. During this winter I will
tell the rest of you what I have come up with. Since you made it
here following the links they at least must have worked.
There's
more to come of motorcycling and motorcycling gear heater in the closet
with them. That being this box.
How
to get
server running after power failure
I
found a notice from the elecric company at my front door: We
will be doing maintenance work, the electric power will be down some
time between 1 pm and 4 pm.
Not
being a happy owner of a UPS device I started checking how my
computers will react to power failure.
One
out of six (an old Pentium 133, Smoothwall firewall/router)
got up after pulling the plug to test.
None
of my ATX machines (the most modern technology I have) booted.
They blew some cool air from their blowers, so the power supllies were
on.
There
was nothing in the BIOS about booting after power failure in any
of them.
Modification
I
pulled the power connector off the motherboard. I cut the green wire,
#14, and attached it with a screw to the frame of the machine.
I
just plugged the connector back to the motherboard, closed the skins
and that's it! Works like a charm. But since it's a web server it needs
to be in the Net, too.
And
after the power coming up the ADSL modem takes some time to boot.
So to let the ADSL boot first, disabled the fast selftest modeand I
even added a delay of one minute to the
default boot loader.
This
way my server boots after power failures, my next task is to get a
UPS. The problem with them, though, is that to be able to survive
longer times, they would have to be quite heavily equipped.. A light
built UPS would only help getting the machine down gently. Since my web
server only serves passive pages, no writing to disks at all exept log
files, I am counting on journaling filesysytems. Mine is Reiser fs and
has not failed yet. I might come back to this UPS subject after maybe
developing some interactive contents on the pages. Maybe.
Mirroring
I'm
using automatic mirroring to sort of backing up my data. It's not a
real backup as meant by incremental snapshots you can revert to at any
given time. Like if a file is deleted by accident. But I don't delete
anything by accident, I just trash files. I empty the trash then
conciously every now and then. I just make sure that a disk crash does
not take my data with it, for example in case of a power failure. It's
a known fact that as long as a disk is running it seldom breaks. It's
the starting that normally breaks hardware. I use smartmontools to
monitor the disks, so there will be (hopefully) some warnings before
the disk will die for natural cause.
Why
mirror? For a backup to work it needs to be done. And to get done it
needs to be fully automatic. In enterprise level there would be
employees responsible for this but I don't have anybody employed. So
I'm using a fully automatic method to keep an up-to-date copy of all my
data. Once it's set up, you don't need to touch it anymore .
Medium
CD
and DVD are labour intensive, expensive, slow and get errors
easily. Yoy can't really be sure they work before you try them. Too
much work. In a short while there would be so many that archiving would
be a problem. What is "Average Seek Time" of a disk in a closet? Far
too many problems just to mention a few. Very soon there would be a lot
of money invested in them. A while later they would create an
environmental problem. So I don't use them.
Tape devices are expensive, tapes are expensive and someone has to
change the tapes. And I don't quite think that CD or tape robots will
enter our home server rooms soon.
I
have ended up using external USB hard disks. A hard disk is cheap
gigas. Hard disks are fast. External disks can be taken to any machine
and they work. They can be added easily.
Synchronizing
I use the command ( actually a program) called rsync. It's included in
every distro, if not installed by default, it can be installed in
seconds using Yast.
Example # 1, mirroring a local directory locally:
Assumed we want to mirror /home. I make usually directories on the USB
disk like /mirror/home, /mirror/etc and others depending on the use of
the machine in question. Here's the command
# rsync -vare --delete /home/* /media/usbdisk/mirror/home.
This will copy all the changes in directory /home since the last
mirroring. All new, changed files will be copied, all deleted ones will
be deleted.
The parameters -vare (one dash here) cause a verbose recursive
mirroring, --delete (two dashes) causes the files that have been
deleted from the original also to be deleted in the mirrored copy.
If there are NFS mounts in /home it's clever to umount them before the
mirroring and sync them separately. Then mount them again. If you sync
with the NFS shares mounted and one time they would not be mounted for
some reason they would be mirrored empty. Not very nice if you use the
flag --delete.
You noticed here that I mirror as root. (# in front of the command).
Because I want to sync all homes with all hidden directories and files
in them I do that as root. Then all settings can be restored easily.
I have made this a cron job. It umounts the NFS shares, does the sync
and mounts the shares again. I have left the verbose flag (-v) away
from there, so it will work quietly and only email the errors to root.
Example #2, mirroring over ssh:
rsync -vare ssh --delete vahis@192.168.1.10:/home/vahis/mp3/*
/media/usbdisk/mirror/mp3/
This makes a local copy of that directory on the machine 192.168.1.10
You could do this over The Internet thus securing your data at a
friend's place and vice versa. In case of fire you or your friend would
have one thing less to worry about. Then you obviously would like to
encrypt the data as well as use more secure methods like vpn or
something
More
automation
This is about a home server, so I use home made solutions. Cron takes
care of doing the jobs. On other times the USB disks are idle. So to
ensure that they don't wear out and more important they don't get
damaged by possible voltage peaks in thunderstorms I cut them off the
power outlet as they are idle.
USBdisks have their own external power supplys. I've connected the
power supply via a cheap battery equipped clock devise, € 9.35. That
turns the power on a couple of minutes before the cron job starts and
turns it off again after an estimated time needed for the mirroring.
Since only changed files are copied it doesn't take that long, I have
the disks running all together three hours at a time.
I hope these examples will give you an idea how to configure some type
of backup. It can be developed to use more back up type of software,
more complex scripting and so on, but as such, this covers pretty much
my worries of disk crashes at least.
These
notes are about Suse 10.0. You can download different Bittorrents
of on my server, right here.
Top of page
Linux Pocket size index Mail me
|