msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

03 Feb 2016 Generate IP-address ranges using simple bash script

This is just a simple script to generate IP-addresses in a IP-range and write the result output to a file.
The script does also remove addresses you would like to exclude from the final output.

#!/bin/bash
OUTFILE="mk-iprange.txt"
IPRANGE="192.168.0 
192.168.1"
EXCLUDE="192.168.0.1
192.168.0.2
192.168.1.1"

# Remove old OUTFILE
rm -f $OUTFILE

# Loop addresses, write to OUTFILE
for IP in $IPRANGE
do
        seq -f "$IP.%g" 1 255 >> ./$OUTFILE
done

# Exclude IP-addresses from file (inplace replacement)
for EX in $EXCLUDE
do
        sed --in-place "/$EX/d" ./$OUTFILE
done

Tags: , ,

Posted by

02 Nov 2015 How to mount LVM partitions from rescue mode

This is a short post about mounting LVM partitions when you are using a rescue CDROM or a desktop install CDROM. The whole process is only four easy steps.

  1. Boot your rescue media. This can be a CentOS, Ubuntu, Red Hat or other CDROM that gives you a console access to the server. Most newer linux distributions have LVM support available.Scan for volume groups
    # lvm vgscan -v
  2. Activate all Volume Groups
    # lvm vgchange -y
  3. List Logical Volumes
    # lvm lvs –all
  4. You have now activated the volumes and have all the information you need to mount them
    # mkdir /media/your-mount-point
    # mount /dev/volumegroup/logical-volume /media/your-mount-point

You can now look into /media/your-mount-point and see the content of your mounted LVM volume.

 

Tags: , , , ,

Posted by

15 Jul 2015 Virtualize physical Ubuntu linux server

This post describes how to create a bit for bit copy of a Ubuntu 14.04 LTS server using tools like gddrescue and qemu from a Ubuntu Live-CD. This procedure can actually be used to create a copy of any operating system, not just Ubuntu.

This could probably have been done more easily and faster using VMware vCenter Converter Standalone Client but I have experienced that not all linux flavours can be converted easily.

To perform such an operation you need several things.

  • Extra harddrive – same size or bigger than used disk space
  • Access to the linux packages gddrescue, qemu-imgThe first thing you should do to reduce the time ddrescue uses to copy the data is to remove unneeded files and folders as well as removing harddrives that you do not want to copy.

Creating the disk image

# ddrescue --nosplit /dev/sda imagefile.img imagefile.log

The –nosplit option copies the disk without retrying or splitting the file and is also “fast”.
Remember to place the imagefile.img on another harddisk than you are imageing to avoid filling your disk.

Convert the img file to a VWware VMDK disk file

# qemu-img -p convert -f raw sda.img -O vmdk sda.vmdk

Options used
-p gives you a nice progress indication of the conversion
-f raw tells us that we a trying to convert a raw disk image
-O vmdk describes the output format of the new disk image, in this example a VMware VMDK-file

qemu-img (1.5.0) supports a wide range of formats like vvfat vpc vmdk vhdx vdi sheepdog sheepdog sheepdog rbd raw host_cdrom host_floppy host_device file qed qcow2 qcow parallels nbd nbd nbd dmg tftp ftps ftp https http cow cloop bochs blkverify blkdebug.

Tags: , , , , , ,

Posted by

15 Jul 2015 VMware ESXi host tips

Some of my VMware notes in short form, just publishing it since it has been in my drafts folder too long.

Remove virtual adapter ala vmk0
# esxcli network ip interface remove -i vmk1

Configure IP on vmk
# esxcli network ip interface ipv4 set -i vmk3 -I 10.255.2.37 -N 255.255.255.0 -t static

List vmk
# esxcli network ip interface ipv4 get

# esxcfg-route

# esxcli software vib list

Remove vib on VMware host
# esxcli software vib remove -n=”vcloud-agent”

Removing of inaccessible NFS datastore
# esxcli storage nfs list

On the ESXi host
# /etc/init.d/storageRM stop

In the vSphere Client
“Rescan All” storage på host

# /etc/init.d/storageRM start

In vSphere Client
Remove inaccessible datastore

Check MTU values on ESXi host
# esxcli network nic list
Name PCI Device Driver Link Speed Duplex MAC Address MTU Description
—— ————- —— —- —– —— —————– —- —————————————————————-
vmnic0 0000:002:00.0 bnx2 Up 1000 Full a4:aa:aa:ab:aa:33 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic1 0000:002:00.1 bnx2 Up 1000 Full a4:ae:aa:ab:aa:35 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic2 0000:003:00.0 bnx2 Down 0 Half a4:ae:aa:ab:aa:37 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic3 0000:003:00.1 bnx2 Down 0 Half a4:ae:aa:ab:aa:39 1500 Broadcom Corporation Broadcom NetXtreme II BCM5709 1000Base-T
vmnic4 0000:045:00.0 ixgbe Up 10000 Full a0:ae:aa:ab:aa:4c 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic5 0000:045:00.1 ixgbe Up 10000 Full a0:ae:ba:ab:aa:4d 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic6 0000:046:00.0 ixgbe Up 10000 Full a0:ae:aa:ab:aa:e0 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
vmnic7 0000:046:00.1 ixgbe Up 10000 Full a0:ae:aa:ab:aa:e1 1500 Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection

Install NetApp plugin on ESXi host
# cd /vmfs/volumes/
# esxcli software vib install -d file://$PWD/NetAppNasPlugin.v20.zip

VAAI
On ESXi 5.x hosts, to determine if VAAI is enabled, run these commands and check if Int Value is set to 1 (enabled):

# esxcli system settings advanced list -o /DataMover/HardwareAcceleratedMove
# esxcli system settings advanced list -o /DataMover/HardwareAcceleratedInit
# esxcli system settings advanced list -o /VMFS3/HardwareAcceleratedLocking

DELL
Dell support: generate DSET file. Requires that DELL OpenManage is installed on the ESXi host
C:\Program Files (x86)\Dell\AdvDiags\DSET\bin>DellSystemInfo.exe -s 10.255.2.3 8 -u root -p password -d hw,sw -r c:\temp\dell\dset-20131115.zip

DELL OpenManage (ESXi host)
# /opt/dell/srvadmin/bin
# ./dataeng status

Tags: , , , ,

Posted by