Thursday, March 19, 2015

Cloning a VM Using VMware vSphere Client

                VMware vSphere is the most robust virtualization solution. Cloning a Virtual Machine in ESxi 5.x is a feature of vCenter server. Out of the box vSphere free edition hypervisor does not support cloning. But there is an alternative way to clone a VM.
  1. First connect to the ESXi using the vSphere client and power off the source VM.
  2. In vSphere client User Interface.Select the Configuration tab and Storage settings on the left menu. The Datastores list will come up on the right pane.
vSphere Datastores
     3. Right click on the datastore of the source VM and select Browse.
     4. Right click on the root folder on the left tree and Create a new folder.
     5. Select the source folder of the VM,which one we want to clone
     6  Copy the configuration file (.vmx) and the virtual disk file (.vmdk) Copying the files
 7. Paste the copied files into the destination folder,new folder
 8. In the destination folder select .vmx file and Add to Inventory.
 9. Enter the name of the cloned VM and finish the wizard.

Clone A VMware’s VM Without vCenter in ESXi 5.x-Using VMKFS

                                           I herewith show the procedure by cloning a VM Server/snapshot of a VM.We have already option for taking Snapshots of a VM in VSphere client.
For taking snapshot via VSphere client :- Right click the vVM ---> Make a snapshot
For taking Clone follow the steps
  1. Shutdown the VM otherwise the files will be locked.
  2. Connect the ESXi host via Putty and Browse the Datastore and check the VM Server location
#cd /vmfs/volumes/datstore name
     3.   List the items in the location
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7#ls
     4.   Enter in to the location, which is allocated for the VM and list the items
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
                                       As you can see now, there are more than one vmdk disk files, the flat vmdk, the delta vmdk and the vmdk descriptor file (the Xp3-000001.vmdk file in our example), along with the memory snapshot and various control and log files.
    For taking Clone Via vmkfstool command line Syntax :-
vmkfstools -i source_path destination_path -d disk_format -a adapter_type
If you didn’t have a snapshot, the source file would be the vmdk descriptor file of your vm
     5.   Create the destination folder in datastore folder
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1 # mkdir SVR-2
     6.   Clone the disk file - In the case of Snapshot
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1-000001.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
     7.   Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
    8. Create a new vm and force the use of an existing disk file via VSphere client
Eg:-
Based i have a VM machine named “vmsvr-1” located in datastore.Datastore name is 220
Here i have clone my vmsvr-1 machine to a new vmsvr-2 VM and loaded into SVR-2 folder
  1. Login into the ESXi host and check the item in machine placed location                                    
                      #cd /vmfs/volumes/220/
                     /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
vmsvr-1-flat.vmdk  vmware-11.log
vmsvr-1.nvram      vmware-12.log
vmsvr-1.vmdk       vmware-13.log
vmsvr-1.vmsd       vmware-8.log
vmsvr-1.vmx        vmware-9.log
vmsvr-1.vmxf       vmware.log
vmware-10.log
  1. Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
After you enter the above command it shows a message to start the cloning process
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/220/SVR-1/vmsvr-1.vmdk'...
Clone: 10% done.
Clone: 100% done.
  1. Check the SVR-2 folder location after the cloning process
                    /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-2 #ls
vmsvr2-flat.vmdk  vmsvr2.vmdk
  1. Create a new vm and force the use of an existing disk file (vmsvr-2.vmdk) via VSphere client

Wednesday, March 4, 2015

Run Tomcat 6/7 As tomcat Or Any Other User

                                      The default user and group are configured in /etc/default/tomcat.The file is format is show below
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat7.
TOMCAT7_USER=tomcat7
# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat7.
TOMCAT7_GROUP=tomcat7
For Changing User Default User And Group In Tomcat:-
  1. Stop the tomcat service
  2. Editing the file /etc/default/tomcat7.Change the user and group in thi file
              (Add new user name instead of tomcat7)
  1. Change ownership of the folder /var/log/tomcat7 and /var/lib/tomcat7/webapps
            and all of it's files.
sudo chown -R newuser:newgroup /var/log/tomcat7
sudo chown -R newuser:newgroup /var/lib/tomcat7/webapps
sudo chown -R newuser:newgroup /var/log/tomcat7
     4. Optional :- Change ownership of the working folder
sudo chown newuser:newgroup /var/cache/tomcat7
sudo chown -R newuser:newgroup /var/cache/tomcat7/Catalina
     5. Make config files readable. Here you have two options:
Either add you new user to the tomcat7 group by:
sudo usermod -a -G tomcat7 newuser
          OR  change ownership of the config files:
sudo chown -R :newgroup /var/lib/tomcat7/conf/*
     6. Restarted the Server and Started the tomcat service

Monday, March 2, 2015

Command Line / Batch Script For Finding System Informations

For Username :-  whoami
For System Name :- hostname
For Computer Manufacturer :- systeminfo | findstr /c:"System Manufacturer"
For Computer Model :- systeminfo | findstr /c:"System Model"
       Make Batch File using With the above command
  1. Create a text file and saved as .bat extension
  2. Updated the text with the following command
whoami
hostname
systeminfo | findstr /c:"System Manufacturer"
systeminfo | findstr /c:"System Model"
pause

Sunday, March 1, 2015

Convert FAT32 To NTFS File System Without Losing Data

                                     Before you convert a Disk Drive from FAT32 File system to NTFS, you need to know the importance of the NTFS file system.NTFS file system has many advantages as compared to FAT File System below are the some listed advantage using NTFS.
  1. Allows indexing which improves file searching fast
  2. Better security – file encryption not available in Fat32
  3. Supports user's quota option
  4. File compression to save disk space on Hard Disk
  5. Supports larger files than FAT
                                          Once you convert a FAT32 partition to NTFS, you cannot simply convert it back to FAT32 with command line. You need to reformat this partition, of course, you will lose all data so make sure before doing any change take the backup.
  1. Open Command Prompt :- Start  ---> Run ---> cmd
  2. Follow the below mentioned Syntax
                        convert drive letter: /fs:ntfs
Eg :-     convert D:/fs:ntfs
Sample :-
C:\Users\ictops>convert D:/fs:ntfs
The type of the file system is FAT32.
Volume _ICTOPS created 3/1/2015 11:05 PM
Volume Serial Number is A024-4342
Windows is verifying files and folders...
File and folder verification is complete.
Windows has scanned the file system and found no problems.
No further action is required.
  15,616,992 KB total disk space.
           8 KB in 1 hidden files.
          72 KB in 2 files.
  15,616,904 KB are available.
       8,192 bytes in each allocation unit.
    1,952,124 total allocation units on disk.
    1,952,113 allocation units available on disk.
Determining disk space required for file system conversion...
Total disk space:              15633376 KB
Free space on volume:          15616904 KB
Space required for conversion:    81842 KB
Converting file system
Data error (cyclic redundancy check).

bloggerwidgets