Pages

Monday, February 6, 2017

How to check a server VM image or physical machine ?


How to check a server VM image or physical machine ?




1. search in dmesg



    dmesg | grep VMware


OR use below command


    dmesg | grep 'XEN\|VMware\|VirtualBox'


grep with logical OR .


This can be run by non root users


Output :
XEN
[root@VMIMAGE1 data]# dmesg | grep 'XEN\|VMware\|VirtualBox'
#1 [000329b000 - 00032b8000] XEN PAGETABLES ==> [000329b000 - 00032b8000]
#5 [00028bc000 - 000329b000] XEN START INFO ==> [00028bc000 - 000329b000]
XENBUS: Device with no driver: device/vbd/51712




VirtaulBox
[root@VMIMAGE1 data]# dmesg | grep 'XEN\|VMware\|VirtualBox'
DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006










Vmware

dmesg | grep 'XEN\|VMware\|VirtualBox'
DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015
Hypervisor detected: VMware
ata2.00: ATAPI: VMware Virtual IDE CDROM Drive, 00000001, max UDMA/33




2. using dmidecode (only for root )







    dmidecode -t system




Output :

Desktop or Non VM server
[root@sterinlap ~]# dmidecode -t system
# dmidecode 2.12
SMBIOS 2.7 present.


Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Dell Inc.
Product Name: Latitude E7440
Version: 01
Serial Number: DG5VD02
UUID: 4C4C4544-0047-3510-8056-C4C04F443032
Wake-up Type: Power Switch
SKU Number: Latitude E7440
Family: Not Specified




XEN
# dmidecode 2.11
# No SMBIOS nor DMI entry point found, sorry.










VirtaulBox
# dmidecode 2.12
SMBIOS 2.5 present.


Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: innotek GmbH
Product Name: VirtualBox
Version: 1.2
Serial Number: 0
UUID: D29C6E95-B72D-4A89-BC8B-F720A31C4EEB
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Virtual Machine










Vmware

dmidecode -t system
# dmidecode 2.12
SMBIOS 2.7 present.


Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Version: None
Serial Number: VMware-56 4d e1 ee 1c d7 be c2-07 ad 24 c5 73 a9 98 17
UUID: EEE14D56-D71C-C2BE-07AD-24C573A99817
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified


3. Checking SCSI devices (only for root )







    cat /proc/scsi/scsi





Output :

Desktop or Non VM server
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST500LT032-1E914 Rev: SDM1
Type: Direct-Access ANSI SCSI revision: 05



XEN
cat /proc/scsi/scsi
Attached devices:
Shows no devices .






VirtaulBox
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: VBOX Model: CD-ROM Rev: 1.0
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: VBOX HARDDISK Rev: 1.0
Type: Direct-Access ANSI SCSI








Vmware

Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02








4. Using Network Scan .



    nmap -sP <IP of VM IMAGE>


This can be done from remote system also .
Nmap might need to install . It is not avilable by default


This also works for windows VM guest


Output :

Desktop or Non VM server
nmap -sP <DELL Lap>
Starting Nmap 5.51 ( http://nmap.org ) at 2017-02-07 22:31 IST


MAC Address: F0:1F:AF:6F:A0:95 (Dell)
Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds



XEN
Starting Nmap 5.51 ( http://nmap.org ) at 2017-02-07 22:32 IST
Host is up (0.00033s latency).
MAC Address: 00:16:3E:59:3A:CA (Xensource)




VirtaulBox
Starting Nmap 5.51 ( http://nmap.org ) at 2017-02-07 22:32 IST


Host is up (0.00047s latency).
MAC Address: 08:00:27:51:56:C7 (Cadmus Computer Systems)




Vmware

Starting Nmap 5.51 ( http://nmap.org ) at 2017-02-07 22:33 IST


Host is up (0.00034s latency).
MAC Address: 00:0C:29:A9:98:17 (VMware)







Tuesday, December 13, 2016

Increasing the space of active img file


Increasing the space of active img file








To increase the space of live img file of xen VM image
 .By this method there will be no loss of data and no 
re format is required .




Here in VM image sixe of /dev/xvdb will increase from 49 GB to 58GB


Now
[root@VMIMAGE1 data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 9.4G 3.2G 6.2G 35% /
/dev/xvda1 99M 13M 82M 13% /boot
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/xvdb 49G 35G 11G 77% /data






1. Stop the VM image



    root@VMSERVER: xm destroy <ID>




2.Increase the size of img file using qemu-img


-rw-r--r-- 1 root root 52428800000 Dec 14 06:08 data.img


     root @VMSERVER : qemu-img resize data.img +10G e






Image resized.
-rw-r--r-- 1 root root 63166218240 Dec 14 06:44 data.img


3.Resize it using resize2fs




    root @VMSERVER : resize2fs -f data.img


resize2fs 1.43-WIP (20-Jun-2013)
Resizing the filesystem on data.img to 15421440 (4k) blocks.
The filesystem on data.img is now 15421440 blocks long.



4.Reboot the VM image .


5.check the size of the drive


df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 9.4G 3.2G 6.2G 35% /
/dev/xvda1 99M 13M 82M 13% /boot
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/xvdb 58G 35G 21G 64% /data
[oracle@VMIMAGE ~]$ cd /data/
[oracle@ VMIMAGE data]$ ls -l
total 2104844

drwxr-xr-x 3 oracle oinstall 4096 Feb 27 2014 10g

Monday, December 12, 2016

Reformatting the one of the drive in the hard disk , which has boot loader



Reformatting the one of the drive in the hard disk , which has boot loader








To fix below error : “/dev/sda1 is apparently in use by the system; will not make a filesystem here!”


[root@ecmtest2 /]# mkfs.ext3 /dev/sda1
mke2fs 1.43-WIP (20-Jun-2013)
/dev/sda1 is apparently in use by the system; will not make a filesystem here!






System is not allowing to format one drive part of same hard disk which has Boot loader


Hard disk : /dev/sda
File mount / :
/dev/sda4 on / type ext4
/dev/sda3 on /boot type ext4 (rw)
/dev/sda1 on vfat : that should be changed to ext3


1. Get Disk Mapper by fdisk command



    fdisk -l /dev/sda1


/dev/sda1 1 121602 976762583+ ee GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/mapper/OVM_SYS_REPO_PART_35000c50092db5a04: 993.9 GB, 993933656064 bytes


Here mapper ID : OVM_SYS_REPO_PART_35000c50092db5a04

2.remove the mapper



     dmsetup remove OVM_SYS_REPO_PART_35000c50092db5a04e


3.Run the format command again





    mkfs.ext4 /dev/sda1



4.Edit the /etc/fstab