Saturday, April 24, 2010

Switch NIC order without reboot (Suse)

Let's say we have two nics installed on our system, eth0, and eth1.
At some times latter, you removed eth0 from the system/replaced it's board.
Now eth1 is the only nic in your machine... and you want to rename this nic (eth1 as eth0).

This is how it's done:

# rcnetwork stop
# vi /etc/udev/rules.d/30-net_persistent_names.rules

Through udev configuration we can change the systems nic order as we desire:

SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth1"

 Let's change eth1, as eth0,
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:b3:22:84:f3", IMPORT="/lib/udev/rename_netiface %k eth0"

Save and exit the file.

Now execute the following command
# /lib/udev/rename_netiface
# /lib/udev/rename_netiface eth1 eth0

Now, restart rcnetwork, and we're done:
# rcnetwork start

Sunday, April 18, 2010

Quick Howto: Configuring Linux Auto Mounter

The Linux automounter is a great feature that allows "transparent" mounts, means you can access samba / nfs shares without actually mounting the area by yourself. Let's see how it's done:

The master configuration file is /etc/auto.master , you will not deal much with it because it simply points to other auto.* configuration files, be sure though your confguration file is listed there.
On most distro auto.misc exists by default so I will use it in this example.

I've set up an NFS share of the /nfs directory on a remote server called "prana" . I've also configured the following command in my /etc/auto.misc file on my local server:

nfs  -rw,soft,intr  prana:/nfs

We need to reload autofs configuration with:

/etc/init.d/autofs restart

Make sure your firewall configured to accept nfs connections and the relevant deamons are up and running (nfs,portmap,mountd).

Now, when accessing /misc/nfs on local server you should see the contents of the exported /nfs folder on prana.

Adding disk to Linux VM without reboot

Have you rebooted your Linux VM after adding storage to it so changes will take effect? No more !
Here is a sweet way to re-scan the SCSI bus "on the fly":

1.Check your current disk status with: fdisk -l

2.Add the wanted disk via VMware GUI

3.To rescan the bus:
root@chronos# echo "- - -" > /sys/class/scsi_host/host#/scan

Replace host# with actual value such as host0. You can find scsi_host value using the following command:
root@chronos# ls /sys/class/scsi_host
So the command will look like this:
root@chronos# echo "- - -" > /sys/class/scsi_host/host0/scan