VMware, Linux: scan your scsi host without rebooting


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

echo "- - -" > /sys/class/scsi_host/host#/scan

Replace host# with number of your scsi adapter… sda would be host1, sdb host2 and so on.

Linux: VMware Tools on Red Hat or CentOS Prerequisites


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

This should do it:
yum install perl gcc make kernel-headers kernel-devel audit binutils glibc-headers

If vmware tools install cannot find your linux headers, throw these in too and try again:
yum install kernel-headers-`uname -r` kernel-devel-`uname -r`

VMware – Linux: OS cannot mount /dev/sd* after a virtual machine is converted – Waiting for device /dev/sd* to appear… not found – fall back


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

This happened when I created a SLES 11 VM with VMware Workstation and then moved to to ESX for production. Problem was that VMware Workstation used LSILogic SCSI drives to emulate my disks, but for some reason it wasn’t made clear to ESX by VMware Converter during conversion.

To fix this browse to your datastore and download your guest’s configuration file <vmname>.vmx to your desktop (or use your root access and open it in vi through ssh). Open it with a text editor and add the following line above your SCSI devices:
scsi0.virtualDev = "lsilogic"

So the whole SCSI device section should look like this:
scsi0.present = "true"
scsi0.sharedBus = "none"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.fileName = "disk1.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:1.present = "true"
scsi0:1.fileName = "disk2.vmdk"
scsi0:1.deviceType = "scsi-hardDisk"

Copy the config back to your datastore and start guest OS. You will be asked to confirm changes during post – answer yes to changes.

Disclaimer: Make sure you have a backup before making any change.

Linux: How to ifdown in a remote server


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

6 million dollar question… want to ifdown/ifup but don’t have physical access to your server? you can ifdown and ifup in one command:
ifdown eth0 && ifup eth0

That’s how you combine more than one command in one line!

Linux: User management


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

useradd: Add new users commands:
-d specify home directory
-s shell
-p specify password
-g user’s primary group
-G user’s other group
-m create home directory

The following command creates a user “ali”, adds to groups users and admin and create his home directory:
useradd -g users -G admin -p <password> -d /home/ali -m ali -s /bin/shell

usermod: Modify existing users
Use above switches to modify a user

Add “ali” to another group:
usermod -G <groupname> ali

userdel: Delete a user
Removes the user “ali”. To delete home directories use -r switch:
userdel -r ali

passwd: user Password
Logged on users can just use passwd to change their password. If root is changing a user’s password:
passwd <username>

su: switch user
To switch from current user to another:
su <username>

You may switch from root to another user without entering user’s password, but not the other way around. This will not log off current user. To return to previous user shell type “exit”.

Users, passwords and group information are stored in these files:

Users: /etc/passwd
Groups: /etc/group
Passwords: /etc/shadow