Archive for the 'adrian' Category

A New Order

A few weeks ago I upgraded the hard disk in my notebook from 160GB to 250GB. I copied the whole hard disk using dd from the old drive to the new drive. I still had to change the partition layout to use the new space. So I downloaded the gparted live CD, booted it and discovered that I was not able to move an extended partition using gparted. I have the following partitions:

/dev/sda1          7  HPFS/NTFS
/dev/sda2          7  HPFS/NTFS
/dev/sda3   *     83  Linux
/dev/sda4          5  Extended
/dev/sda5         83  Linux

My plan was to increase the Windows partitions as well as the Linux partitions. To increase the size of /dev/sda2 I had to move /dev/sda3 and /dev/sda4. I was not able, however, using gparted, to move /dev/sda4. So I decided that I had to make a backup of /dev/sda5, then delete it (and /dev/sda4), move /dev/sda3 and increase the size of /dev/sda2.

Therefore I booted a Fedora installation DVD in the rescue mode and made a backup of /dev/sda5:

dd if=/dev/sda5 bs=65536 | ssh adrian@backup-server "dd of=sda5.img bs=65536"

Then I booted the gparted live CD and deleted /dev/sda5 and /dev/sda4, moved /dev/sda3 and increased the size of /dev/sda2. After that I created a new extended partition (/dev/sda4) and created /dev/sda5 using the remaining space. After gparted finished I booted the Fedora installation DVD again in the rescue mode and restored the backup:

ssh adrian@backup-server "dd if=sda5.img bs=65536" | dd of=/dev/sda5 bs=65536

At the end of the operation I booted my system and was happy that it still worked. Now I still had to resize the encrypted partition. This was pretty easy:

cryptsetup resize luks-<uuid>
pvresize /dev/mapper/luks-<uuid>

Before doing the lvresize I checked the available extends with vgdisplay and used that number in the following lvresize command:

lvresize -l +16449 /dev/mapper/vg_dcbz-lv_root
resize2fs /dev/mapper/vg_dcbz-lv_root

And that was already it. It took some time (maybe 4 hours), but everything finished without any problems. To make sure everything finished without any problems I forced a fsck (touch /forcefsck; reboot).

Before:

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_dcbz-lv_root
                       74G   69G  1.4G  99% /

After:

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_dcbz-lv_root
                      137G   69G   62G  53% /

Archaeology

If I remember it correctly my server at home (file-server, print-server, router, …) has been installed a long time ago using Red Hat Linux 8.0. Since the initial installation I have done live upgrades using rpm, apt-get or yum to its current version (Fedora 11). Now I just started doing a live upgrade using yum to Fedora 13 and I got an interesting dependency problem:

--> Finished Dependency Resolution
lilo-21.4.4-26.i386 from installed has depsolving problems
 --> Missing Dependency: mkinitrd >= 3.4.7 is needed by package lilo-21.4.4-26.i386 (installed)

It seems I still have an unused version of lilo installed on my system and now that mkinitrd has been replaced yum starts complaining. The lilo package is from 2004 and has also been installed in 2004 (according to the RPM database). It is the oldest package on my system but now it has to go.

28th Open Grid Forum

Starting tomorrow (2010-03-15), I will be at the 28th Open Grid Forum (OGF28) in Munich for four days.

RAID 1 Shrinking

I was not happy with the partitioning of one of the cluster infrastructure servers. It had a software RAID for /boot, one for swap and the rest was a big software RAID for /. I should have used LVM for / for easy resizing, but I forgot and so I had to do it the hard way. I wanted to resize /dev/md2 which was used for / and then use LVM for the rest.

First I had to resize the filesystem. Online shrinking is not supported for resize2fs (at least I was not able to do it) and so I had to boot the CentOS 5.4 rescue system.

After dropping to the shell of the rescue system (without mounting the filesystems) I copied a mdadm.conf from a similar system to /etc so that I would be able to start the RAIDs:

  • mdadm -A /dev/md0
  • mdadm -A /dev/md1
  • mdadm -A /dev/md2

Only starting /dev/md2 would have be enough, but I wanted to make sure that everything is working as it is supposed to. Then, before running resize2fs, I had to do a filesystem check:

  • e2fsck -f /dev/md2 -C 0

Next step was to actually shrink the filesystem and make it smaller than the desired final size:

  • resize2fs /dev/md2 30G

Then I shrunk the RAID to about 40GB:

  • mdadm --grow /dev/md2 -z 40000000

and after that I had to resize the filesystem again to use the 40GB:

  • resize2fs /dev/md2

At this point I mounted the filesystem to see if it actually worked and it looked good (and smaller). Now came the hard part; to use the remaining space I had to re-partition the disk. I started fdisk and deleted the corresponding partitions and created at the same start point smaller partitions (42GB). This was the part were I was really worried about losing all my data which was fortunately backed up (of course). After I created the smaller partitions I tried to start /dev/md2 and it failed, saying that it could not find any RAID partitions.
I then tried to create the RAID again, hoping all data would be still available. I first created the RAID with only one device:

  • mdadm --create /dev/md2 -n 2 -l 1 /dev/sdb3 missing

This seemed to work and after mounting the new RAID I saw that all my files were still there. So the next step was to add the second device to the RAID with:

  • mdadm --manage -a /dev/md2 /dev/sda3

At this point the RAID started to re-sync and 20 minutes later I was able to grow the RAID to the new partition size:

  • mdadm --grow /dev/md2 -z max

Again I had to wait and before doing the final filesystem resize another filesystem check was necessary:

  • e2fsck -f /dev/md2 -C 0
  • resize2fs /dev/md2

And after only two hours I finally had what I wanted. I rebooted the system and it came up with the smaller / partition. I used the remaining space to create a new RAID (/dev/md3) which will probably be used with LVM if I ever need more space on this server in the future.

Without having a backup I would have not done all the steps because I was not always sure it would actually work.

Just Like Three Weeks Ago

Yesterday (2010-02-06) Benjamin and myself were again in Lech/Zürs snowboarding; just like three weeks ago. Last time (2010-01-17) Pattrick and Torsten were also able to join. This time it was only Benjamin and me.

The weather was similar to our last visit. Mostly cloudy with a few peeks of sunshine. This time, however, we had lots of new deep powder and it was freeriding time. Extremely exhausting but great fun.

Updating My RPM Fusion Builder

I am running one of the RPM Fusion builders in a VM using CentOS and after I saw that the newly created VMs on my notebook are using virtio for network and disk access I thought that I will try this also for my builder VM. It was pretty easy and straight forward.

First I had to update from CentOS 5.2 to CentOS 5.4 so that the virtio drivers are available. After that I was just following http://wiki.libvirt.org/page/Virtio.

For the network:

  • shut down the VM
  • edit the XML and add <model type='virtio'/> to the network section
  • start the VM
  • done

For the disk:

  • create a new ramdisk with the virtio drivers: mkinitrd --with virtio_pci --with virtio_blk -f /boot/initrd-$(uname -r).img $(uname -r)
  • or dracut -f --add-drivers "virtio_pci virtio_blk" /boot/initrd-$(uname -r).img $(uname -r) for Fedora 12
  • change /boot/grub/device.map from “(hd0) /dev/hda” to “(hd0) /dev/vda
  • using LVM requires no changes to the root= parameter in /etc/grub.conf
  • shut down the VM
  • edit the XML changing <target dev='hda' bus='ide'/> to <target dev='vda' bus='virtio'/>
  • start the VM
  • done

During the boot of the VM I can now see that it is loading the virtio disk drivers and detecting vda1 and vda2. Using lspci and lsmod I can also verify that the new virtio devices are available and also used. The VM seems to be faster but I have not actually benchmarked it.

Back In School

Not really back in school, but it has been now more than one week that I started my new job at my old university in Esslingen at the beginning of December 2009. After only 11 months at my previous workplace (Matrix Vision) I am now working for the faculty of Information Technology.

I will be responsible for the setup and installation of the new cluster of the university. The cluster will be part of the bwGRiD and it will have around 1500 cores and is currently being installed. It is partly water-cooled and a few days ago the racks were delivered and installed. The cluster is from NEC and we are expecting the servers to be delivered in the next few days. The cluster will be running Scientific Linux.

I am now in the same building as my mirror server. This might be a good thing, because now I am much closer to the hardware and can act faster if something unexpected happens… It might also be a bad thing, because now I am much closer and can experiment with things I would not do if I was not in the same building.

First Text Then HTML

I finally have mutt configured in such a way that it first tries to display the plain text part of a mail and only the HTML part if there is no plain text available. For years I had mutt configured to display HTML mails using lynx but it was displaying the HTML part even if there was plain text available.

To display HTML mails I was using auto_view text/html in my .muttrc like it is described everywhere with the following corresponding entry in my .mailcap:

text/html;      lynx -dump %s; copiousoutput; nametemplate=%s.html

The problem with this setup is that it displays the HTML part of a mail even if there is a plain text part available. So I had auto_view text/html disabled for most of the time and edited the configuration file manually to enable it again for the rare cases in which I received a HTML only mail.

But as this is mutt and almost everything can be configured I finally searched and found a solution:

auto_view text/html
alternative_order text/plain text/html

If the message has a plain text part and a HTML part mutt shows me the plain text part, but if there is only a HTML part available I get the HTML converted to plain text. Exactly what I always wanted.

Lightning Talk

Last Thursday (2009-08-13) I gave a lightning talk about the mirror server I am maintaining. According to the description from Wikipedia lightning talks are usually between 1 and 10 minutes with a 5 minute limit being common[¹]. In this session there were four talks with each being about 15 minutes with additional 5 to 10 minutes for questions. So it was a bit longer than the definition but that was a good length for all four talks.

The lightning talks were organized by the Chaos Computer Club Stuttgart (CCCS). They are organizing a talk every month and in the summer it is usually a lightning talks session. The given talks were:

I am very happy that I decided to give my talk and altogether it was a very nice event. There was also an audio recording (which unfortunately has not yet been released).

[¹] http://en.wikipedia.org/wiki/Lightning_Talk

Music Player

About two years ago I started to build a music player. I had an old notebook and a friend gave me his old CD player. The plan was to get the important parts of the notebook into the chassis of the CD player. This was done about two years ago and since then it stayed half-finished. Last week I finally had enough motivation (and the other notebook acting as our music player using mpd was actually being really used again) so that the project is now finally finished. Before I started it looked something like this:

On the left side the board is mounted on two pieces of wood. I had to cut new holes on the backside for all the connectors. Although it is booted over network and running from NFS it needs a hard-disk, because the BIOS needs 15 seconds longer if there is no hard-drive. As I wanted a fast boot I had to connect something to it and that is why I bought a 256MB flash drive with a 44-pin IDE connector.

All the cables which can be seen on the right side are from my idea to use the original buttons of the CD player chassis. The cables are connected to the keyboard controller and they are a very good example that I am more a software than a hardware guy. The plan was that certain combinations of the cables generate certain keyboard events (characters). That worked perfectly and I tried out many combinations and found enough keyboard events to connect all the cables to buttons of the CD player chassis. The problems started when I soldered all the cables to the board with the buttons. After I had soldered all cables to the board behind the buttons I powered it on again and it was generating lots of keyboard events even if I was not pressing any button, probably because I did not think about it that all cables which were connected to ground pins were now all connected together. So it was a bad idea and everything I did was pretty much useless. So I removed everything again and connected it again, but this time I tested the result after every button.

The most important button was the power on button, which works. I have now only four working buttons which is far from what I wanted but better than no possibility to control anything directly at the chassis.

To use the characters coming from the buttons I took mingetty, removed most of the code and modified it to read just one character (readfromtty1.c) and return that immediately to a shell script wrapped around. So if I now press the REPEAT button I get a message in the syslog saying “REPEAT pressed“.

I also had to cut two more holes into the CD player chassis on the left side for the CPU fan and for the audio connectors.

That was the only change to finally use it. If I now press the STANDBY/ON button, about 20 seconds later it starts playing music. I am using mpd so that I can control it from anywhere and pressing the same button again shuts the system down in about 5 seconds. Without much work I could get it probably to boot faster but right now I am using an only slightly modified Fedora 11 with a custom kernel so that I probably leave it the way it is now.

In addition to the buttons and all the available mpd clients I can also control the music player using my phone. I have extended my phone2jabber script to not only send jabber notifications when somebody calls but also to play the next song when one of my unused MSNs is called.