Sunday, May 29, 2011

linux force reboot or shutdown

Force Reboot :
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

If you want to force shutdown machine try this.
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Thanks to http://linax.wordpress.com/2009/02/16/linux-force-reboot-and-shutdown/

Wednesday, May 25, 2011

linux create logical volume

pvcreate /dev/sdb1
vgcreate VolGroup01 /dev/sdb1
lvcreate -L953G -n LogVol00 VolGroup01
parted -l

add iscsi target and initiator in CentOS Linux

----------------- Target (Server) ----------------
#> vi /etc/tgt/targets.conf

<target iqn.2011-04.com.storage2.volgroup01.logvol00>
backing-store /dev/VolGroup01/LogVol00
</target>

#> service tgtd restart

; Take care of iptables

-----------Initiator (Client) -------------
#> iscsiadm -m discovery -t st -p 192.168.2.140
#> iscsiadm -m node
#> chkconfig iscsi on
#> service iscsi start


Sunday, May 22, 2011

linux discover and add new disk without reboot dynamically

To Discover and add new disk to a linux machine without having to reboot the server (e.g when virtual disk is added to a machine online) do the below:

ls /sys/class/scsi_host

#output is host0
#new rescan the scsi bus
echo "- - -" > /sys/class/scsi_host/host0/scan

#now you can see the new disk
fdisk -l

# add the new disk to the lvm if you want

Monday, May 16, 2011

vmware server 2 virtual console does not load

To solve the problem
find and run ./vmware-vmrc -h server:8333 -M "VM_ID"
to find "VM_ID" goto vmware webui and generate a shortcut on dekstop

Tuesday, May 10, 2011

ESXi scp

In ESXi to do scp using pscp simply do scp -scp to avoid doing sftp

Wednesday, May 04, 2011

Mikrotik DMZ

To put and IP address in DMZ
simple create a destination nat from the public IP to private without specifying anything else