Linux

Linux related. Random bits to remember.


Resize iSCSI partition

Lets have a practical scenario. A disk box, with iSCSI LUN, which is used by a linux box.
LUN fills up, and is resized on that disk box.

On linux side, lets rescan session, to get updated target size visible:
iscsiadm -m session -R

Lets assume, the partition is plain ext4 and available as /dev/sde1

parted /dev/sde

Parted should detect disk size update and notify about it
Warning: Not all of the space available to /dev/sde appears to be used, you can fix the GPT to use all of the space
(an extra 2147483648 blocks) or continue with the current setting?
Read the rest


Spamassassin and clean SQL database

When starting spamassassin with empty sql database You can see

‘WARN: bayes: database version  is different than we understand (3), aborting!’ in logs.

It should be read as ‘database is too empty’.Spamassassin stores its database version number in database. If it can not find its database version, it dies.… Read the rest


Fast way to create or assemble mdadm devices

Booting from cd and no /dev/md devices? First, correct kernel modules are needed. modprobe raid1 If configuration uses different raid, then a different raid module should be loaded. Be it a raid 0,5,6 or whatever. Devices can be made then mknod /dev/md0 b 9 0 mknod /dev/md1 b 9 1 and so on. As many of them as needed. From this point on door is open for mdadm create,assemble or whatever is needed. Creating a device goes like this: mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda2 /dev/sdc2

Postfix, MySQL lookups and Temporary lookup failure 1

After setting up postfix to use mysql as lookup backend for alias or virtual or whatever table, everything seems ok. Mails are delivered. But sometimes strange "Postfix SMTP server: errors from " e-mails are received. Usually more than one in the same second, then there can be no errors for days or weeks. Then they appear again. There is a "Temporary lookup failure" or "queue file write error" cited in those error e-mails but everything seems to work ok again. Even those e-mails that get error on first try get delivered on second try some minutes later. One thing to look out for is

Squid: WARNING! Your cache is running out of filedescriptors 2

Sometimes squid stops working and "WARNING! Your cache is running out of filedescriptors" is logged in cache.log. Restart usually resolves that problem. Temporarily though. This article is based on http://www.cyberciti.biz/faq/squid-proxy-server-running-out-filedescriptors/ adding some Gentoo specific bits. Squid, as a web cache should, holds a lot of files from internet on a local hard disk. It means that a lot of files are open at the same time. On busy servers this amount grows till the limit imposed by the operating system. Then no more files can be opened and squid seemingly dies.

LDAP from command line

Using LDAP from command line can be quite man (or info) expensive. Usually LDAP is used for samba authentication, so it is set up something like this: domain example.com is described in LDAP as base dn: "dc=example,dc=com" also two OU-s are usually present: ou=groups for all groups and ou=users for all users. All this is case insensitive. Selecting all groups from LDAP is done using ldapsearch. ldapsearch -x -b "ou=groups,dc=example,dc=com" -h LDAP_host This lists all groups.

Multiple internet connections in one box

Sometimes it is needed to have multiple internet connections in one Linux box. To distinguish it from a more common scenario - it means that multiple default routes are specified. Multiple default routes is a bit of a dilemma - default route is loosely defined as 'if everything else fails send packets there'. By definition there can not be two or more last resort options. One of those internet connections therefore should be designed as default, and configured normally, giving it IP address, default gateway and so on. The rest should have its IP addresses configured.