preload
Mar 06

I noticed nice command today, dmidecode. It tells lots of information about hardware from linux. I.e bios version and what kind of memory the machine uses:

[root@sirius ~]# dmidecode | head -n 13
# dmidecode 2.7
SMBIOS 2.3 present.
51 structures occupying 1436 bytes.
Table at 0x000F2F50.

Handle 0x0000, DMI type 0, 20 bytes.
BIOS Information
        Vendor: Award Software, Inc.
        Version: ASUS A7A266 ACPI BIOS Revision 1009
        Release Date: 10/19/2001
        Address: 0xF0000
        Runtime Size: 64 kB
        ROM Size: 256 kB

The man page tells that you can also find information with prebuild strings like bios-version:

[root@sirius ~]# dmidecode -s bios-version
ASUS A7A266 ACPI BIOS Revision 1009

You can also query information with type. Like -t memory etc. Refer to man page.

Jan 31

Nice way to look users who are using too much memory / cpu.

# ps -eo vsize,pcpu,pid,user,args | sort -k 1 -r | head -10

More options from ps manpage.

Jan 22

So sometimes linux can’t automaticly start array from array members. So lets do it manually.

Get the info from array member (disk partition)


[root@sirius ~]# mdadm --examine /dev/hda1
/dev/hda1:
Magic : a92b4efc
Version : 00.90.01
UUID : b2d657f5:b881d26d:e249f8e9:a64f1406
Creation Time : Sat Jan 14 17:00:14 2006
Raid Level : raid1
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0

Update Time : Thu Jan 18 18:07:52 2007
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Checksum : 26a507ac - correct
Events : 0.224

Number Major Minor RaidDevice State
this 0 3 1 0 active sync /dev/hda1

0 0 3 1 0 active sync /dev/hda1
1 1 3 65 1 active sync /dev/hdb1

As you can see that we can get lots of information from disk, but we are only intrested on UUID which identyfies the array member:


[root@sirius ~]# for i in a b; do mdadm --examine /dev/hd"$i"1 | grep -i uuid; done
UUID : b2d657f5:b881d26d:e249f8e9:a64f1406
UUID : b2d657f5:b881d26d:e249f8e9:a64f1406

So partitions hda1 and hdb1 seems to have same UUID which means that they are from same array.

And now lets start the array from those members:


[root@sirius ~]# mdadm --examine /dev/hda1 | grep UUID | awk '{ print $3 }' > /tmp/hda1
[root@sirius ~]# mdadm -A --uuid=`cat /tmp/hda1` /dev/md0

Touché.