Octubre 26

Password Protect Grub Bootloader

Steps:

  1. Log into your box as root
  2. Open up a shell.
  3. At command prompt, become superuser, then type grub:

linux:~ # su
Password:
linux:~ # grub

  1. At “grub>” prompt type md5crypt:

grub> md5crypt

  1. Enter a password at the Password: prompt, preferably something other than root password:

Password: *****

  1. It will then give you the password encrypted

Encrypted: $1$Rdv455345ga345GvIRgXWxcF1Vjb7tZ//

  1. Copy the encrypted password into the clipboard.
  2. Open up a new shell.
  3. At command prompt, become superuser, then type vi /boot/grub/menu.lst

linux:~ # su
Password:
linux:~ # vi /boot/grub/menu.lst

  1. After you see title SUSE Linux 10.0 on the next line type lock. On the following line type password md5 [the encrypted password you copied from previous shell]:
###Don't change this comment YaST2 identifier: Original name: linux###
title SUSE Linux 10.0
lock
password md5 $1$Rdv455345ga345GvIRgXWxcF1Vjb7tZ//
root (hd0,1)
     kernel /boot/vmlinuz root=/dev/hda2 vga=0x31a selinux=0
resume=/dev/hda1  splash=silent showopts
     initrd /boot/initrd

Note: ***You may do the above steps for each grub boot item.
Category: GRUB, VMWARE | Los comentarios están deshabilitados en Password Protect Grub Bootloader
Octubre 26

How to reset root password on vCenter Appliance 5.5?

1. Introduction

This method of reseting/recovering of lost Linux root password should work on most of linux distributions. I have tested this method for couple years already, starting with debian woody,redhat and suse to ubuntu .

UPDATE:To recover a root password on REDHAT and CentOS visit a following guide on how to recover a root password on RHEL 7 Linux.

If you run lilo boot loader instead of grub you can use the same method but with some modifications on how to edit lilo boot prompt.

2. Edit Grub boot menu options

First you need to get into grub menu options. This menu is displayed right at the beginning of the boot. If you cannot see your grub menu options press “ESC’ key.

You should get something similar to this:

grub boot menu

Now we attempt to edit grub’s boot option. Press “e” to edit the first grub menu option and navigate to kernel line:

edit grub boot option with

Press “e” key again to edit and remove:

quiet splash

and add:

init=/bin/bash

You may have some different boot options but the main part you need to change/add is init=/bin/bash. You will get something similar to this:

change to init=/bin/bash

Press enter:

ready to boot from edited grub menu
At this point, we have edited grub boot menu, and we are ready to boot. Press “b” key to boot.

3. Remount / and /proc

After successfully boot you will be presented with bash command prompt:

booting to a bash command prompt

On some linux systems, you will need to completely mount / and /proc partitions. To do that, enter following commands:

mount -o remount,rw / mount -o remount,rw /proc

* NOTE: If you are not sure that if your partition is already mounted RW, run the above command anyway as, otherewise on some systems you will not be able reset your root password. If you fail to do so, you get this error displayed on the screen:

passwd: Authentication token lock busy

* NOTE: On some Linux distributions, you will have /proc mounted already if this is not your case, just run following command:

mount /proc

mount and remount partitions in single boot mode

4. reset / recover forgotten linux root password

To reset a actual root password is now simple as typing :

passwd

reset / recover forgotten linux root password

5. Reboot

Before you reboot it is recommended but not compulsory to run

sync

command. Your job of reseting a linux root password is accomplished.

Category: VMWARE | Los comentarios están deshabilitados en How to reset root password on vCenter Appliance 5.5?
Septiembre 16

Howto Convert a ESXv5 to ESXv4 VM

This details the steps needed to convert a machine from ESXv5 to ESXv4

Convert OVA to VMX

  1. On ESXv5 Machine, Export the VMWare ESX5 Machine to OVF (File -> Export -> Export OVF Template)
  2. Download ovftool
  3. Convert ova to vmx (ignoring manifest errors)
ovftool sourefile.ova destfile.vmx (make sure filename [without extension] is different)
  1. Modify the vmx file

Change

virtualhw.version = "8"

to:

virtualhw.version = "7"

Convert back to OVF

(this takes awhile because 9 is max compression)

 

ovftool --compress=9 destfile.vm destfile_converted.ovf

Deploy OVF on your ESXv4 Machine

Import OVF like normal on your ESXv4 machine

Category: VMWARE | Los comentarios están deshabilitados en Howto Convert a ESXv5 to ESXv4 VM
Marzo 6

How To Shrink a VMDK with ESXi5

I’ve had the luxury of working quite a bit with ESXi5 and how it relates to storage. With ESXi5, you can easily expand your virtual disks (VMDK file) for the VM on the fly, however there isn’t a simple way to reduce the size of your drives. As I’ve learned, best practices for VM’s is to always start small, as you can always increase later on with ease. Unfortunately, the previous administrator didn’t honor this, and started everything out with 600gb drives, and only utilizing 25gb. Needless to say, my SAN was getting chewed up by VMDK’s that only was using a fraction of the space allocated for it. After some research, this was the method that I use to reduce the size of the VMDK.

I should probably preface all of this that this is a dangerous procedure, and you run the risk of hosing your VM, so proceed at your own risk.

Most of my VM’s are windows machines, so I first need to reduce the windows partition. First I’ll need to defrag the drive. Then, open up the Disk Management via the MMC console snap-in, and right click on the drive, and select Shrink. It will tell you the maximum amount that it can shrink. If you want it to shrink more, it means that certain files are locked towards the end of the disk. In my case, I was able to delete/move the user profiles off of the disk, and that’s what was preventing me from reducing the disk to the size I wanted.

Great, so in this case, I was able to reduce a 600gb disk to 38gb.

Now I need to power down the VM, and SSH into the host and copy the VMDK file to make a backup of it. Hold onto these in case something goes wrong:

1 cp vmname.vmdk vmname-original.vmdk
2 cp vmname-flat.vmdk vmname-original-flat.vmdk

Now let’s open the vmdk within vi and modify the expected size. Towards the top, you will see a line that appears similar to the following:

1 # Extent description
2 RW 1258291200 VMFS “vmname-flat.vmdk”

The number value will need to be changed to the desired size using the following formula (x = desired size in GB):
vmdk_size = [x * (1024*1024*1024)] / 512

Because I like round numbers, I decided to make my new drive size of 40gb, so my new Extent description was as follows:

1 # Extent description
2 RW 83886080 VMFS “vmname-flat.vmdk”

Now I need to clone the drive to get it to the new size:

1 vmkfstools -i vmname.vmdk vmname-new-size.vmdk

Assuming all goes well, I will new delete the original (because I already made a copy of it just in case), and clone the disk to the original file name:

1 rm vmname.vmdk
2 rm vmname-flat.vmdk
3 vmkfstools -i vmname-new-size.vmdk vmname.vmdk

Now I should be able to start the VM again, and the new disk size will be shown!

– See more at: http://www.whitneytechnologies.com/?p=270#sthash.xXOHxkXs.dpuf

Category: VMWARE | Los comentarios están deshabilitados en How To Shrink a VMDK with ESXi5