--> The problem solved itself <--
Sometime between November 2012 and January 2013 one of the Ubuntu updates made the time the mount command takes to complete go down to ~1 second again:
time mount /dev/mapper/8000 /media/8000 real 0m0.942s user 0m0.000s sys 0m0.504s
Thanks to everyone for trying to help me out.
I have a raid 5 (software) with 5x2TB drives. I encrypted the raid with cryptsetup and put an ext4-partition on top.
In the beginning opening and mounting the raid took less than 10 seconds, now (for a few weeks) mounting alone takes 1:30 minutes and the cpu stays around 93% the whole time:
The output of "time sudo mount /dev/mapper/8000 /media/8000" is:
real 1m31.952s user 0m0.008s sys 1m25.229s
At the same time only one line is added to /var/log/syslog:
kernel: [ 2240.921381] EXT4-fs (dm-1): mounted filesystem with ordered data mode. Opts: (null)
My Ubuntu-version is "12.04.1 LTS" and no updates are pending.
I checked the partition with fsck, but it says that all is ok.
The "cryptsetup luksOpen" command only takes a few seconds.
I also tried changing the raid-bitmap (as it was suggested in some forum) but it did not change the behaviour.
sudo mdadm --grow /dev/md0 -b internal
sudo mdadm --grow /dev/md0 -b none
I had the idea that it might be the hardware being slow, but a read test with "sudo hdparm -t /dev/md0" spit out values between 62 and 159 MB/sec:
Timing buffered disk reads: 382 MB in 3.00 seconds = 127.14 MB/sec Timing buffered disk reads: 482 MB in 3.02 seconds = 159.62 MB/sec Timing buffered disk reads: 190 MB in 3.03 seconds = 62.65 MB/sec Timing buffered disk reads: 474 MB in 3.02 seconds = 157.12 MB/sec
Although I think it is strange that the read rate jumps by more than 100% - could that mean something?
The speed test when reading from the mapped (decrypted) device shows similar behavior, although it is of course much slower. "sudo hdparm -t /dev/mapper/8000":
Timing buffered disk reads: 56 MB in 3.02 seconds = 18.54 MB/sec Timing buffered disk reads: 122 MB in 3.09 seconds = 39.43 MB/sec Timing buffered disk reads: 134 MB in 3.02 seconds = 44.35 MB/sec
The output of a verbose mount "mount -vvv /dev/mapper/8000 /media/8000" does not help much:
mount: fstab path: "/etc/fstab" mount: mtab path: "/etc/mtab" mount: lock path: "/etc/mtab~" mount: temp path: "/etc/mtab.tmp" mount: UID: 0 mount: eUID: 0 mount: spec: "/dev/mapper/8000" mount: node: "/media/8000" mount: types: "(null)" mount: opts: "(null)" mount: you didn't specify a filesystem type for /dev/mapper/8000 I will try type ext4 mount: mount(2) syscall: source: "/dev/mapper/8000", target: "/media/8000", filesystemtype: "ext4", mountflags: -1058209792, data: (null)
Any idea where I could find additional information on why mounting takes so long, or what additional tests I could run?