martedì, maggio 27, 2014

HowTo Find fiber channel ID (WWN) of a disk/LUN

If you have a privilege to admin a server that is connect via fiber channel with a disk and you want to know channel ID in Ubuntu you have to install sysfsutils :
# apt-get install sysfstools
and then digit
# systool -av -c fc_host | grep "port_name" |awk '{print $NF}'

giovedì, maggio 15, 2014

HowTo save rules of the iptables?

If you need to secure your Ubuntu Server adding some rules on iptables and you want to re-apply rules after a server reboot you can install iptables-persistent


# sudo apt-get install iptables-persistent

After installed, you can save/reload iptables rules anytime:

# sudo /etc/init.d/iptables-persistent save 
# sudo /etc/init.d/iptables-persistent reload

giovedì, maggio 08, 2014

Restore a raw copy of Hyper-V configuration files.

Today I'll try to explain how to recovery Hyper-V VMs from a raw copy of configuration files. My experience start from a new installation of Windows 8 on my notebook.

Before formatting I'v backup C:\ProgramData\Microsoft\Windows\Hyper-V with a raw copy of all files on my external disk. When i'v finished to install all components of my new Windows 8 installation I'v restore the content of previous directory. But when I've launched the Hyper-V console I can't see no VM. At that moment my first question was: Why cannot view VMs if XML files are restored?

Searching with Google I'v found this article when is explained that configuration files have a special permission "NT VIRTUAL MACHINE\{VM_GUID}" to be restored, where {VM_GUID} is the name of XML file.

If you have, like me, a lot of VMs you can use this simple bat script that i write for restore a single VM.

@ECHO OFF
SET VMID=7E3FEDA5-CC67-49FB-8372-23B3F6E1E85D
icacls "%systemdrive%\programdata\Microsoft\Windows\Hyper-V\Virtual Machines\%VMID%.xml" /grant "NT VIRTUAL MACHINE\%VMID%":(F) /L
icacls "%systemdrive%\programdata\Microsoft\Windows\Hyper-V\Virtual Machines\Locks\%VMID%.lock" /grant "NT VIRTUAL MACHINE\%VMID%":(F) /L
net stop vmms
net start vmms
pause

NB: Remember to launch this script as an administrator because it restart the vmms service.

I hope that this article may be useful for you.

Salvo.