Linux Tips and Tricks Collection
there is always something new to learn!
This page contains a collection of assorted Linux tips and tricks. New tips will be added occasionally whenever we come across something we consider worthwhile adding. Enjoy! :-)
sensors not working, Error inserting kernel module with kernels since 2.6.31
This problem is caused by conflicts between the sensor hardware kernel module and ACPI. If your hardware kernel module was working fine with kernels older than 2.6.31 then there is a workaround. Append the following kernel setting to the kernel line in /boot/grub/menu.lst and reboot:
After that the kernel module should load again.
How to enable inbound connections through a Linux NAT gateway to a web server located on a network behind the NAT gateway
Run the following command on your Linux NAT gateway (replace IP address, port number and interfaces as appropiate):
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to 192.168.X.X
To make this configuration permanent add it to you firewall config or simply add the command to /etc/rc.d/rc.local.
how to find all video mode numbers that can be used for the Linux console
To get a list of all video mode numbers supported by the installed graphics card run:
This will list all supported video modes in hex (first column). To use one at boot use it with the '0x' prefix or convert it to decimal and append the following kernel setting to the kernel line in /boot/grub/menu.lst :
(replace XYZ with the chosen mode number)
Adding a disk to an existing Linux md Raid5 array in a nutshell
Brief step-by-step instructions on how to add an additional disk to an existing md raid5 array. In this example expanding a 4-disk array called /dev/md1 to a 5-disk array by adding the disk device /dev/sde1.
First, using your favourite partitioning tool (fdisk, parted, etc.) create a partition (here /dev/sde1) on the new disk (here /dev/sde), that is at least equal in size to the partitions on the existing disks used for the raid5. Set the partition as type fd
(Linux raid autodetect).
To add the the partition to the array (as spare disk for now), run:
mdadm --add /dev/md1 /dev/sde1
Then tell the array to expand to 5 disks:
mdadm --grow /dev/md1 --raid-devices=5
This will speed up the raid reshape (but will also increase cpu load, values are in KBytes/sec):
echo 50000 > /proc/sys/dev/raid/speed_limit_min
echo 500000 >/proc/sys/dev/raid/speed_limit_max
To observe the groth process which is now running in the background, run:
Once the reshape is complete, the filesystem (here mounted on /data) can be resized to take advantage of the new extra space, this is how to do it for JFS:
mount -o remount,resize /data
Enabling autologin with Gnome 2 / GDM 2
Add the following two configuration lines in the [daemon] section of
where 'username' needs to be the username of the user that is supposed to be automatically logged in.