Search This Blog

Friday, January 02, 2015

Resize an LVM partition on a HP Proliant server

1. Install HP Proliant support pack 

2. If you've installed the PSP before and it is already running on your server, you can skip this step, otherwise start HP Array Configuration Utility Online for Linux. 
cd /opt/compaq/cpqacuxe/bld
./cpqacuxe -R
note: after finishing online configuration utility, you might want to stop it by running
./cpqacuxe -stop

3. Expand array and logical drive
Go to https://localhost:2381 and click on array configuration utility link.
Click on expand array - it will take some time to finish (like 8hrs). After the expansion is finished, a new button called 'expand logical drive' will appear, clicking on it will finish expanding the array.

4. Make Linux kernel recognize the new size of your hardware raid5
Reboot Linux server, run  'partprobe' or 'sfdisk -R /dev/cciss/c0d0' followed by  'fdisk -l /dev/cciss/c0d0' multiple times, 'till it shows the new size.
You might have to reboot multiple times if the new size does not appear at fdisk -l.

5. Enlarge partition with fdisk - DANGEROUS, please have a full backup first!
fdisk /dev/cciss/c0d0  (you might consider using fdisk -u /dev/cciss/c0d0 - it will display the size in sectors instead of cyclinders)
"p" - take note where the /dev/cciss/c0d0p2 (your extended partition) starts!
press "d" then "2" to remove the c0d0p2 partition - yes you wil DELETE the partition, don't reboot, don't move, dont even breathe on top of that server!!!
press "n" for new, then "p" primary partition to use the full space
Make sure the old and new partition starts at the same cylinder or sector position, otherwise, all your data will be destroyed!!!
press "t" to change partition type to LVM
"w" to write
"q" to quit
now you will need to reboot again!

6. Resize physical volume size, logical volume size and perform file system online increase:

After reboot, check again the new size:
[root@log ~]# fdisk -l /dev/cciss/c0d0
Disk /dev/cciss/c0d0: 1799.7 GB, 1799797127168 bytes
255 heads, 63 sectors/track, 218812 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          13      104391   83  Linux
/dev/cciss/c0d0p2              14      218813  1757509959+  8e  Linux LVM

Let's see ho many free phisical blocks we have:
[root@log ~]#vgdisplay -v | grep "Free PE"
    Finding all volume groups
    Finding volume group "VolGroup00"
  Total PE / Free PE    54337 / 17879

Now let's resize the phisical volume:
[root@log ~]# pvresize /dev/cciss/c0d0p2
  Physical volume "/dev/cciss/c0d0p2" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
 
  note: we used vgdisplay -v to check the number of free PE, let's say it's 17879.

Now let's extend the lvm: 
[root@log ~]# lvextend -l +17879 /dev/VolGroup00/LogVol02
  Extending logical volume LogVol02 to 1.60 TB
  Logical volume LogVol02 successfully resized

And finally we will resize the filesystem:
[root@log ~]# resize2fs /dev/VolGroup00/LogVol02
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol02 is mounted on /data; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol02 to 430276608 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol02 is now 430276608 blocks long.

Ofc, steps 4 to 6 can be replaced with running offline gparted from a CD...

Monday, December 01, 2014

Stream webcam with sound

cvlc v4l2:///dev/video1 :v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300 :sout=#"transcode{vcodec=mp4v,vb=256,scale=Auto,acodec=mp4a,ab=48,channels=1,samplerate=8000}:http{mux=asf,dst=:8080/}" :sout-keep

Tuesday, November 04, 2014

Windows Shell for TS - without Domain Controller

On the RD Session Host Configuration ,the following (compiled as c:\windows\tssession.exe) script is executed as initial shell:

;(c)2014  sorinakis@g**il.com

;msgbox, Username: %A_UserName%
AuthUsers = Administrator|administrator
Loop Parse, AuthUsers, |
{
 ifEqual, A_LoopField, %A_Username%
 {
  Sleep, 500
  Run, explorer.exe
  ;MsgBox EXPLORER Executed.
  GoTo, End
 }
else
 {
  ;MsgBox In the ELSE branch.
  Sleep, 500
  Run, D:\Partages\apps\LCM\Bin\wrun32.exe -ws -c D:\Partages\apps\LCM\etc\CBLCONFI-RZ_APP.ini utmenu
  Sleep 500
  WinMaximize, ahk_class AcucobolWClass
  IfWinExist, Cie(01)
  {
   WinMaximize,  Cie(01)
   Sleep, 500
   WinWaitClose, Cie(01)
   Sleep, 500
   Run, shutdown /l
  }
  Return
 }
}
End:
Sleep, 100
;MsgBox At the END.

Friday, October 03, 2014

SSH BruteForce Attacks are back

I've put back the little iptables rule:

-N SSHBRUTE
-A INPUT -i eth1 -p tcp -m tcp --dport 22 -m state --state NEW -m recent -j SSHBRUTE
-A SSHBRUTE -m recent --set --name BRUTESSH --rsource 
-A SSHBRUTE -m recent --rcheck --seconds 60 --hitcount 5 --rttl --name BRUTESSH --rsource -j \ REJECT --reject-with tcp-reset
-A SSHBRUTE -m recent --rcheck --seconds 60 --hitcount 4 --rttl --name BRUTESSH --rsource -j \ LOG --log-prefix "Brute Force SSH Drop"
-A SSHBRUTE -m recent --update --seconds 60 --hitcount 4 --rttl --name BRUTESSH --rsource -j \ REJECT --reject-with tcp-reset
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Tuesday, September 02, 2014

A simple script to import .pst in thunderbird

#!/bin/bash
#
#(c)2014 sorinakis@g*il.com

if [ "$(whereis readpste | cut -d: -f2)" = "" ]; then.
 echo "Sending you to download readpst"
 kdialog --warningcontinuecancel "Go to http://www.five-ten-sg.com/libpst/ to download, then compile and install libpst
 Once libpst is installed please re-execute this script.
 If readpst is installed, but not in path, you have to comment the first section of $0" --continue-label "Go to site"
 if [ ! $? = 0 ]; then
  echo "Cancel Pressed. Exit"
  exit 2
 fi
 xdg-open http://www.five-ten-sg.com/libpst/
 exit 0
fi

# Prepare location
wrkfld=$TMP/outlook$$
export $(dbus-launch)
mkdir $wrkfld

# Convert pst
readpst -o $wrkfld -r "`kdialog --getopenfilename ~ '*.pst' 2>/dev/null`"

# Rename folder so thunderbird understands
find $wrkfld -type d | tac | grep -v '^$wrkfld$' | xargs -d '\n' -I{} mv {} {}.sbd
find $wrkfld.sbd -name mbox -type f | xargs -d '\n' -I{} echo '"{}" "{}"' | sed -e 's/\.sbd\/mbox"$/"/' | xargs -L 1 mv

#Cleanup empty folders
find $wrkfld.sbd -empty -type d | xargs -d '\n' rmdir

kdialog --msgbox "Conversion Done! Please create a subfolder in your Thunderbird's Local Folders,.
 then manuallly move $wrkfld.sdb into ~/.thunderbird/[profile]/Mail/Local Folders/[new folder]"

Sunday, August 10, 2014

Tune UP (in fact down) Windows 2008 R2

sssc config lanmanworkstation depend= bowser/mrxsmb10/nsi
sc config mrxsmb20 start= disabled

netsh int tcp set global rss=disabled
netsh int tcp set global chimney=disabled
netsh int tcp set global autotuninglevel=disabled
netsh int ip set global taskoffload=disablednetsh int tcp set global autotuninglevel=disablednetsh int tcp set global ecncapability=disablednetsh int tcp set global timestamps=disablednetsh advf set allp state off


:: reg add "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v DisableTaskOffload /t REG_DWORD /d "1" /f

reg add "HKLM\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" /v DisableBandwidthThrottling /t REG_DWORD /d "1" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp" /v TcpAutotuning /t REG_DWORD /d "0" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v TcpAutotuning /t REG_DWORD /d "0" /f
reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings" /v TcpAutotuning /t REG_DWORD /d "0" /f
reg add "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v EnableTCPA /t REG_DWORD /d "0" /f