lunes, 15 de febrero de 2010

Copy MBR from one disk to another

This command will do the trick:
dd if=/dev/sda of=/dev/sdb bs=512 count=1



Getting Virtualized!!!

I had been looking for a process where you could take an existing physical machine, and convert it into a new virtual one.
There are a few steeps that are needed in order to achive this goal:
- Define a virtualized hardware: CPU, Memory, IO, Networking.
- Export the data: this is the most critical process.
In order to get an vmkd file or vdi of an existing physical instalation consists in a few steps that i will explain here:
- First, boot the operating system with a live linux cd.
- Second, identify the partition or partitions involved in the recovery. For instance hd3
- Third, make a good use of dd like this one:
dd if=/dev/hdc of=/mnt/USB/diskImage/win2k3.img bs=1024
the partition will be dumped into a file.
- Fourth: qemu-img convert -f raw /mnt/USB/diskImage/w2k3.img -O vmdk /mnt/external/diskImage/w2k3.vmdk

VMware: Using player to install yor VM's

VMware player is almost a complete virtualization platform, the only thing that is missing to achive the full functuality of its big brother Workstation is the "Configuration Wizard".
I had found a website that allows you to define a vmx file (the configuration file) but i have found also a procedure to create your own.

The basics.

virtualHW.version
This parameter defines the version used. Defaults to 4

displayName
This parameter will be used in order to identify the virtual machine.

memsize
This parameter is obvious. Configures the amount of memory reserved for the vm.
defaults to Megabytes. Example 512


ideX:X.fileName
This parameter will be used in order to identify the disk . An example could look like this: "FREEDOS.vmdk"

ideX:X.present
Enables the availability of the disk to the vm. TRUE/FALSE

guestOS
The id of the operating system. See bellow in the Guest OS section list.
example winXPPro

Network
This section is a little bit more complicated. Each nic can have 3 status:
- bridget.
- hostOnly
- Internal Network.
Example :

ethernet0.present = "TRUE"
ethernet0.vnet = "VMnet0"
ethernet0.virtualDev = "vlance"


cdrom.

ide1:0.fileName = "E:\2k3-sp1-pebuilder313\pebuilder.iso"
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1.1.present = "FALSE"



A more complex vmx file.

This example has been extracted from http://sanbarrow.com/vmxbuilder.html

###### stupid-long-name .vmx #################
######
###### use copy and paste
###### to export this file
######
#######################################
####### generated by Ullis VM builder #

####### Identity ######################
displayName = "stupid-long-name"

# Devices
config.version = "8"
virtualHW.version = "4"
memsize = "512"
numvcpus = "2"
guestOS = "winNetEnterprise"

####### ide-disks #####################
ide0.0.present = "FALSE"
ide0.1.present = "FALSE"
ide1:0.present = "TRUE"
ide1:0.fileName = "E:\2k3-sp1-pebuilder313\pebuilder.iso"
ide1:0.deviceType = "cdrom-image"
ide1:0.startConnected = "TRUE"
ide1.1.present = "FALSE"

####### scsi-controllers ##################
scsi0.present = "TRUE"
scsi0.virtualDev = "buslogic"
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"

####### scsi-disks #####################
scsi0:0.present = "FALSE"
scsi0:1.present = "FALSE"
scsi0:2.present = "FALSE"
scsi0:3.present = "FALSE"
scsi0:4.present = "FALSE"
scsi0:5.present = "FALSE"
scsi0:6.present = "FALSE"
scsi1:0.present = "FALSE"
scsi1:1.present = "FALSE"
scsi1:2.present = "FALSE"
scsi1:3.present = "FALSE"
scsi1:4.present = "FALSE"
scsi1:5.present = "FALSE"
scsi1:6.present = "FALSE"

####### nics ##########################
ethernet0.present = "TRUE"
ethernet0.vnet = "VMnet0"
ethernet0.virtualDev = "vlance"
ethernet1.present = "TRUE"
ethernet1.vnet = "VMnet1"
ethernet1.virtualDev = "vmXnet"
ethernet2.present = "TRUE"
ethernet2.vnet = "VMnet2"
ethernet2.virtualDev = "vlance"
ethernet3.present = "TRUE"
ethernet3.vnet = "VMnet3"
ethernet3.virtualDev = "vmXnet"

####### sound #########################
sound.present = "FALSE"

####### usb ###########################
usb.present = "FALSE"

####### floppies #######################
floppy0.present = "FALSE"
floppy0.startConnected = "FALSE"
floppy1.present = "FALSE"
floppy1.startConnected = "FALSE"

####### ports #########################
parallel0.present = "FALSE"
serial0.present = "FALSE"
serial1.present = "FALSE"

####### cluster-options ##################
####### skipping Cluster-options ###########



The Guest Os supported.
Bellow is the list of operating systems supported and the Id
Microsoft Windows, 32-bit

winVista = Windows Vista (experimental)
longhorn = Windows Longhorn (experimental)
winNetBusiness = Windows 2003 Small Business Server
winNetEnterprise = Windows 2003 Enterprise Server
winNetStandard = Windows 2003 Server
winNetWeb = Windows 2003 Web Server Edition
winXPPro = Windows XP Professional Edition
winXPHome = Windows XP Home Edition
win2000AdvServ = Windows 2000 Advanced Server
win2000Serv = Windows 2000 Server
win2000Pro = Windows 2000 Professional
winNT = Windows NT
winMe = Windows Me
win98 = Windows 98
win95 = Windows 95
win31 = Windows 3.1 / Windows 3.11
windows = Other Windows
Microsoft Windows, 64-bit

winVista-64 = Windows Vista x64 Edition (experimental)
longhorn-64 = Windows Longhorn x64 Edition (experimental)
winNetEnterprise-64 = Windows 2003 Enterprise Server x64 Edition
winNetStandard-64 = Windows 2003 Server x64 Edition
winXPPro-64 = Windows XP Professional x64 Edition
Linux, 32-bit

ubuntu = Ubuntu Linux
redhat = Red Hat Linux
rhel4 = Red Hat Enterprise Linux 4
rhel3 = Red Hat Enterprise Linux 3
rhel2 = Red Hat Enterprise Linux 2
suse = SuSE Linux
sles = SuSE Linux Enterprise Server
mandrake = Mandrake Linux
nld9 = Novell Linux Desktop 9
sjds = Sun Java Desktop System
turbolinux = Turbo Linux
other26xlinux = Other Linux on a 2.6.x kernel
other24xlinux = Other Linux on a 2.4.x kernel
linux = Other Linux
Linux, 64-bit

ubuntu-64 = Ubuntu Linux 64-bit
rhel4-64 = Red Hat Enterprise Linux 4 64-bit
rhel3-64 = Red Hat Enterprise Linux 3 64-bit
sles-64 = SuSE Linux Enterprise Server 64-bit
suse-64 = SuSE Linux 64-bit
other26xlinux-64 = Other Linux 2.6.x 64-bit
other24xlinux-64 = Other Linux 2.4.x 64-bit
otherlinux-64 = Other Linux 64-bit
Sun Microsystems Solaris

solaris10-64 = Solaris 10 64-bit
solaris10 = Solaris 10
solaris9 = Solaris 9
solaris8 = Solaris 8
solaris7 = Solaris 7
solaris6 = Solaris 6
solaris = Other Solaris
Novell Netware

netware6 = Netware 6.x
netware5 = Netware 5.x
netware4 = Netware 4.x
netware = Other Netware
FreeBSD

freeBSD-64 = FreeBSD 64-bit
freeBSD = FreeBSD
Apple Darwin

darwin = Apple Darwin (unsupported)
Other

other = Other OS
other-64 = Other 64-bit OS

viernes, 12 de febrero de 2010

VMDK file creation with QEMU

In order to get a vmdk file for VirtualBox or VMWare download the latest release of Qemu
and execute the following command:
>qemu-img.exe create -f vmdk WindowsXPPro.vmdk 2G for windows
>qemu-img create -f vmdk WindowsXPPro.vmdk 2G for linux

jueves, 11 de febrero de 2010

Ldap timestamp search

Hi there!!!
I had to produce an incremental ldif file from an ldap server. This file had to have all ldap entries modified from a certain date (for example 1st of Febrary 2010). But the issue was not as easy as it sounds, mainly because i had to guess what was the search string that provided a valid filter in order to get the desired results.
The format is as follows:
YYYYMMDDhhmmssZ
4 digit Year
2 digits Month
2 digits Day
2 digits hour
2 digits minute
2 digits second
End with "Z" char
Example:

ldapsearch -x -H ldaps://A.B.C.D:636 -D "cn=admin,o=demo" -W -b "ou=users,o=kasa" "modifyTimestamp>=20100201000000Z" >tst.ldif

I hope that it will be usefull for you.

martes, 2 de febrero de 2010

Multiple CPU top report

Many times i wanted to know what was the status of the system in terms of CPU usage. In the interactive mode just press the "1" key and on the top side of the report you would be able to see the status of every core you have on your system.
Regards...