Search This Blog

Tuesday, April 2, 2013

Extend Volume Group and increase Logical Volume size + Resize Partition ( STEP BY STEP)

10 STEPS to add 10GB to LVM



1. Add size to the Virtual Disk in vmware. 
***for example let's add 10GB to filesystem*** REBOOT Guest after adding.(If needed)

2.Check if you got free space on physical disk.
[root@localhost ~]# sfdisk -s
/dev/sda: 20031488

3. Space need to be assigned to /dev/sda check whick sda partitions you already have and create a new one:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2

We create new partition /dev/sda3:
[root@localhost ~]# fdisk /dev/sda
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1306-1697, default 1306): Enter
Using default value 1306
Last cylinder or +size or +sizeM or +sizeK (1306-1697, default 1697): Enter
Using default value 1697
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
***REBOOT***

4. Check if new partition exists:
[root@localhost ~]# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Apr 1 2013 /dev/sda
brw-rw---- 1 root disk 8, 1 Apr 1 2013 /dev/sda1
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda2
brw-rw---- 1 root disk 8, 2 Apr 1 2013 /dev/sda3

5. Create a physical volume for LVM:
[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created

6. Assign the physical volume to the Volume Group:
[root@localhost ~]# vgextend VolGroup00 /dev/sda3
Volume group "VolGroup00" successfully extended

7. Check if you got free space on Volume Group:
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               10.88 GB
  PE Size               32.00 MB
  Total PE              956
  Alloc PE / Size       956 / 10.88 GB
  Free  PE / Size       97 / 10.1 GB
  VG UUID               a8rsVw-ACdV-K5aP-uG7l-Nfvq-Wn9i-E36JE5

8. Extend volume:
[root@localhost /]# lvextend -L+10G /dev/VolGroup00/LogVol00
Rounding up size to full physical extent 10 GB
Extending logical volume LogVol00 to 20.88 GB
Logical volume LogVol00 successfully resized

9.Resize FileSystem:

[root@localhost ~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.35 (28-Feb-2004)
/dev/VolGroup00/LogVol00 is mounted; can't resize a mounted filesystem!

Cannot use resize2fs as it is online. Use ext2online instead. 

[root@localhost ~]# ext2online /dev/VolGroup00/LogVol00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b

10. Check if you resize success:
[root@localhost ~]# df -hl
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       21G   10.2G  9.6G  57% /
/dev/sda1              99M   13M   81M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm

That's All. :)

Monday, January 28, 2013

Get mailbox size exchange 2007

How to get mailbox size in exchange 2007 via PowerShell.
Very simple!
1. If you need to check mailbox size for individual use string bellow:

Get-MailboxStatistics username | ft DisplayName, TotalItemSize, ItemCount
******for more information use get-help Get-MailboxStatistics -full******

2. If you need to get mailbox size for all user use next command:

Get-MailboxStatistics | ft DisplayName, TotalItemSize, ItemCount
******To export output to the file, add > c:\mailboxsize.txt******

FOR EXAMPLE:  Get-MailboxStatistics | ft DisplayName, TotalItemSize, ItemCount > c:\mailboxsize.txt

To view more friendly output you can try to use my string:


Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression = {$_.TotalItemSize.Value.ToMB()}},ItemCount > c:\mailboxsize.txt


:)


******If the command is not working run this before:******

add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin

Sunday, January 20, 2013

From network drive Excel file takes long time to open (Office 2003)

Office 2003
The problem is with big excel files. When you try to open them from network drives, it takes long time to load.
For fix this issue you will be need to edit your REGISTRY.
Please follow these steps:

Please open StartRun →  and type regedit  <Enter>
Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\FileValidation
****(If under Excel Key, Security and FileValidation does not exist, create it.)****
Right click on key "FileValidation" New → DWORD
Under Name of DWORD type EnableOnLoad  <Enter>
Right clcik on DWORD and choose Modify.
Set Value Data 0
Click <Ok> and exit from editor. Try Open again your EXCEL File.
Should be ok. :)




Tuesday, December 18, 2012

Active Directory | LDAP - DSQuery user






DSQuery user

Search for users in active directory.

Syntax
    DSQuery User [{StartNode | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name Name] [-desc Description] [-upn UPN] [-samid Filter] [-inactive NumberOfWeeks] [-stalepwd NumberOfDays] [-disabled] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}] [-q] [-r] [-gc] [-limit NumberOfObjects] [{-uc | -uco | -uci}]
Key
         StartNode | forestroot | domainroot The node in the console tree where the search starts. forestroot = search using the global catalog.

-o                               The format used to display the search results.
                                    dn = distinguished name.
                                    rdn = relative distinguished name.
                                    samid = Security Accounts Manager (SAM) account name.

-scope                     The scope of the search:
                                     subtree = subtree that is rooted at the start node in the console tree.
                                     onelevel = immediate children of the start node only.
                                     base = single object that the start node represents.
                                     If forestroot is the StartNode, then subtree is the only valid scope.

-name                        Search for user(s) whose name attribute(CN) matches Name.
                                     For example, "br*"

-desc                              Search for user(s) whose description matches. For example, "contractor*"

 -upn                                Users whose UPN attribute matches UPN

 -samid                           User(s) whose SAM account name matches SAMName

 -inactive                    Users who have been inactive for n number of weeks

-stalepwd                     Users who have not changed their passwords for n days

-disabled                    Users with disabled accounts

 -s                                     Server to connect to (Default=the domain controller in the logon domain.)

 -d                                     Domain to connect to.

 -u                                     Username with which the user logs on to a remote server.

 -p                                       Password (UserName or Domain\UserName or Username@domain.com)

 -q                                     Quiet, suppress all output

 -r                                     Recursive search (follow referrals)

 -gc                                    Use the AD global catalog during the search.

 -limit                             The maximum number of objects to return, default=100.

 -uc                                    Unicode format

 -uco                                Unicode format for output only

 -uci                                  Unicode format for input only

Examples

Find all inactive accounts (more than 4 weeks inactive)

C:\> dsquery user -inactive 4

Disable all inactive accounts (more than 4 weeks inactive)

C:\> dsquery user -inactive 4 | dsmod user -disabled yes

Export all active users to .txt file.

C:\> dsquery user -limit 1000 -o rdn -name * > c:\all_users.txt

Export all disabled users to .txt file.

C:\> dsquery user -limit 1000 -o rdn -disabled -name * > c:\all_disabled_users.txt

Tuesday, June 5, 2012

phpinfo - how to create info file?

PHP Info


This file can help you to identify which php modules/extensions installed and enabled on your server.
This solution very simple.
Step 1.
Connect to the server through SSH and be sure you have root credentials.
Navigate to public_html directory.
cd /home/websiteuser/public_html
Step 2.
Create file.
nano phpinfo.php
Copy to the file code below:


<?php  
phpinfo(); 
?> 
Save and quit from file editor.
Step 3.
Let's check file permissions and owner.

root@server [/home/ websiteuser/public_html]# ls -l | grep phpinfo
-rw-------  1 root  root      24 Jun  5 13:34 phpinfo.php

As you see, owner of this file root, because we created this file under user root.
Change ownership:
chown websiteuser.websiteuser phpinfo.php
Change permissions:
chmod 644 phpinfo.php

Step 4.
Browse to this file from browser.
http://websiteuser.com/phpinfo.php

Now you see information page of apache & php. All modules and extensions.

eNj0Y!


WINSXS folder - How to clean up? (Windows 2008 R2 / Windows 7)

Windows 2008 R2 WINSXS folder

SP1 MUST BE INSTALLLED!

1) Install Service Pack 1

2) Start command prompt

3) Run DISM command: DISM.exe /online /Cleanup-Image /spsuperseded


4) wait few minutes (5-10m)

5) check you disk space!

eNj0Y!

Wednesday, May 23, 2012

Service stuck in "starting" or "stopping" state.

Windows  Service stucking problem.

Many times, service stuck and we don't know what to do with this issue.
If your server is production and you can't reboot him right now, but you must start or stop the specific service - this post for you.


1. Open command prompt
Let's find your service and identify the PID.
If you already know the name of service, run next command:

sc queryex w32Time

and you will see PID number.
If you don't know name of the service, just run same command without name of the service.

sc queryex

you will see list of all services, just find what you need.

2. Let's kill the service.
Now you know PID of the service and let's kill him!

taskkill /f /pid 1132

That's all.

enJoY!