GNU/Linux

Creating an expandable encrypted RAID 5

E-mail PDF

If you have a lot of data to store it gets inconvenient to make backups and you might switch to a RAID.

My server had 4 1TB drives in a software RAID 5, so it could store 3TB of data. But some day came the time when even 3TB were full and I wanted to expand the raid.

Now some problems appeared:

  1. the system partition was a RAID 1 on the same drives
  2. the RAID partition was encrypted
  3. so where do you store 3TB?

 

Last Updated on Wednesday, 04 November 2009 10:39 Read more...
 

How to avoid DNS censoring

E-mail PDF
You may have heard that there will be a censoring mechanism for the Internet. This will be realized by censoring certain domains on the DNS servers. So if you try to look up 'howtobuildabomb.terror' the DNS server won't return an IP address but a warning (like the STOPP sign on couchsofa, which is a spoof, in fact). But since the government can only censor German DNS servers a address could still be looked up at a different server.
On GNU/Linux you can do that by the following command:
dig [type] [domain] @[server]

[type] will be the DNS record you want to read: A, PTR, SOA, NS or AXFR.
[domain] is the domain name to look up, for example 'Google.com' or 'howtobuildabomb.terror'.
[server] specifies a DNS server. If your local DNS servers are cencored you could use open DNS server. For example 4.2.2.2 or one from the lists you can find on google or at the CCC:

  • 85.214.73.63 (anonymisierungsdienst.foebud.org)
  • 204.152.184.76 (f.6to4-servers.net, ISC, USA)
  • 2001:4f8:0:2::14 (f.6to4-servers.net, IPv6, ISC)
  • 194.150.168.168 (dns.as250.net; anycast DNS!)
  • 213.73.91.35 (dnscache.berlin.ccc.de)
  • 80.237.196.2
  • 194.95.202.198
The open DNS servers will resolve the domains and return the IP addresses. Now you can enter the IP in your browser:
http://xxx.xxx.xxx.xxx
This has nothing to do with hacking or doing something illegal. It is just the way you can use the system!
Last Updated on Wednesday, 09 September 2009 16:12
 

Using PS1 to get system information in the bash prompt

E-mail PDF
If you are using a laptop and Linux you probably thought about how to get for example the battery status or CPU temperature (since most laptops have cooling issues) on your prompt in the shell.

First I used gDesklets for Gnome but when you are working in your shell you do not want to have a look at your desktop all the time.
But if you could have it in the PS1 updating every time you enter a command it would pretty neat.

The PS1 is defined in your bashrc file which is located at ~/.bashrc. Just add an additional line at the end, mine looks like this:

PS1='[`~/.battery.prompt.sh`][`~/.temp.prompt.sh`]\[\033[1;32m\]\h\[\033[0m\]:\$

As you can see there are two scripts executed:

  1. ~/.battery.prompt.sh
  2. ~/.temp.prompt.sh

The .battery.prompt.sh script is from wiki.ubuntuusers.de/Bash/Prompt if you want to customize your bash prompt that's definitely the site you want to check out!
You can find the battery script there too but you might have to edit it to get it work. On my IBM T23 it worked out of the box but my new DELL Latitude D610 needs some adjustments, so my .battery.prompt.sh looks like this:

#!/bin/bash
BATTERY_DIR=/proc/acpi/battery/BAT0
AC_DIR=/proc/acpi/ac_adapter/AC

if grep -q 'last full capacity' ${BATTERY_DIR}/info ; then

FULL_BATTERY=$( awk '/last full capacity/ {print $4}' ${BATTERY_DIR}/in$

CURRENT_BATTERY=$( awk '/remaining capacity/ {print $3}' ${BATTERY_DIR}$

PERCENT=$(( ${CURRENT_BATTERY} * 100 / ${FULL_BATTERY} ))

if grep -q on-line ${AC_DIR}/state; then
echo "$PERCENT+"
else
echo "$PERCENT-"
fi
else
echo "---"
fi

If it does not work for you you may go to /proc/acpi and check out if there's a battery folder and what files are in there. For me it was BAT0 and not BAT1 like on ubuntuusers.de.

The .temp.prompt.sh is far more easy. Just have a look at the acpi folder and check out if you can find thermal information, than just read it with awk.

#!/bin/bash
TEMP_DIR=/proc/acpi/thermal_zone/THM

TEMP=$( awk '/temperature/ {print $2}' ${TEMP_DIR}/temperature )

echo "${TEMP}°C"

If everything is working you get an output like this:
[31+][46°C]Zuse3:~ $

I hope this helps to increase your effectiveness while working on your laptop.

Last Updated on Saturday, 29 August 2009 10:49
 

backing up the MBR on Ubuntu

E-mail PDF

bildschirmfoto

I have a new laptop running Ubuntu 9.04 and I'm quite happy.
It runs smooth and even the compiz features worked out of the box! Together with the Gnome Screenlets you get a very effective desktop.

But since I'm studying civil engineering I need CAD and other programs that won't run in wine or consume a lot performance.
So I decided to try Windows 7. But before installing you want to back up your MBR because Windows will very likely override it with its own boot manager.

Probably the easiest way works with dd. Just check for the harddisk containing the MBR ...

Last Updated on Wednesday, 02 September 2009 15:58 Read more...
 





feed-image Feed Entries
follow-tweet-image