in the maze.net

To content | To menu | To search

Linux › Gentoo

There's all kind of talk about operating systems. Trash talk, evangelist talk, etc. I think you're all crazy. Where would I be without you? This topic is about my adventures with my "lunix build of choice", gentoo (well, it's the only build I've ever worked with - I know it ain't the simples one)

Entries feed - Comments feed

Friday, March 27 2009

Flawed backup strategy

Okay, so a few months ago, I mounted a samba drive on my Gentoo machine that linked to a Windows file server I had lying there.

Then, I added an rsync task to my backup server - every day, along with other folders, a remote server took backups from the Windows machine through the Gentoo server.

All works fine.

Did you guys find the flaw yet? I didn't find it until this morning.

Yesterday night, the Windows server went down. Its an old Celeron 400mhz - its way past its prime. Problem is, it went down before the nightly backup routine.

So the samba mount "disappeared".

And when the rsync took place, all the backup could see was an empty mount drive...

And so, rsync synchronized - and wiped the whole backup. Now the folders are synchronized.

  • sigh *

I need to rethink that particular strategy.

Update 1 Instead of the previous setup, I've mapped my Gentoo server to the windows network via Samba - I'm sharing the driver directly from the Gentoo server now - much less hassle.

Update 2 Yanik Proulx was kind enough to send me a simple script that fixes the problem by make a rotation backup of the mount ("soft link") to a hard link. Thanks, buddy!

Another interesting solution would be to rsync from soft to hard link locally after checking the mount status.

Update 3 Another method would be not to backup the root folder of the mounted drive. This way, the folder to backup would not exist and rsync would simply fail.

Thursday, April 3 2008

limiting CPU usage of a task under Linux

I have a few tasks that I run at irregular intervals on some of my servers.

Some of them actually eat up quite a bit of CPU - something that I don't want on certain servers.

Running the task when the CPU is normally less used is nice, but I was looking for a way to start the task with a very low priority.

Basically, if anything else than that particular task wants the CPU, give it up. Otherwise, have a ball.

After a bit of search, what I found was the command called "nice". "renice" is also nice. Uhm... well.. its not "nice", but its nice.

Moving on.

Each task is given a "nice" level, which is the process' stat about how nice it is with other processes when it comes to sharing the CPU. The "nice" level is used by the kernel to determine who gets the CPU's attention.

Basically, the higher the level is, the more prone the task is to share CPU resources. The lower the level, the more selfish the process becomes.

The "nice" commands starts a process and assigns it a "nice" value, while "renice" allows you to change the "nice" value of an existing process.

For example, because I love examples, you could do the following weird backup command:

nice -n 20 zip -r /root/ugly_backup.zip /var/www/*

Which would start a low-priority (nice=20) task to recursively zip all of /var/www within the fule /root/ugly_backup.zip

(and people, please, don't backup this way if you haven't been forced to by someone with a gun or a big cheque)

NB: if you see your low-priority task run with a high CPU attribution, don't panic - it just means that no other tasks is asking for CPU. And your web server's CPU don't have to sit on its tiny metaphorical sillicon hands while waiting for your visitors to take a peak at your awesome, (hopefully) relevant, web page.

While I'm in the process of writing this reminder note for myself, I feel that it is nice to add, for the benefit of my memory, that by ending a command line with an ampersand symbol &, the task will be started in the background.

Friday, October 5 2007

Lost my eth0 on my way to upgrade

Long time no post...

Today's post is not too entertaining, but might help someone. Who knows?

So I was making various tests upgrading portage profiles, too see how systems react before I try doing it on more important servers.

During my tets, on an old machine I never updated, I was trying to update "baselayout" (via "emerge -av baselayout"), as part of the thing I needed to update by moving to the 2007.0 profile.

Okay. So on that machine, I couldn't update because a silly old version of dhcp was installed.

Fine, I said. I removed the package - thinking I'll update later.

One "emerge -C dhcp" later and my baselayout installed fine.

All is well, I thought. Lets see if it holds water and reboot everything.

Forgettign about dhcp.

So, you know where I'm going, right?

The server boots fine, but now my connection to the network is also gone.

Of course, I can't emerge dhcp back (as I should've before rebooting...)

So here's how to get your network card back up again, without dhcp:

ifconfig eth0 up <ip_address>

Where <ip_address> is a valid ip address for your machine.

route add default gw <gateway_ip_address>

Where <gateway_ip_address> is the ip address of your gateway server.

From there, I could get my dhcp back up again and everything's fine.

Saturday, March 17 2007

Gentoo and new timezone settings

Your gentoo server is not at the proper date? Well, perhaps you did not properly update to the new daylight saving settings?

Continue reading...

Friday, November 10 2006

ERROR: sys-libs/glibc-2.4-r4 failed

Trying to do a system-wide gentoo update using emerge, I ran into a compile error trying to update glibc:

*** These critical programs are missing or too old: gcc
*** Check the INSTALL file for required versions.

!!!ERROR: sys-libs/glibc-2.4-r4 failed.
Call stack:
ebuild.sh, line 1546: Called dyn_compile
ebuild.sh, line 937: Called src_compile
glibc-2.4-r4.ebuild, line 1174: Called toolchain-glibc_src_compile
glibc-2.4-r4.ebuild, line 257: Called glibc_do_configure 'nptl'
glibc-2.4-r4.ebuild, line 925: Called die

Continue reading...

- page 1 of 3