Standard

Extend the root partition LVM или подкинул блоков в логический корень :)

Working environment is:

[~]# cat /etc/redhat-release 
CentOS release 5.11 (Final)

#####################################
Server running on ESXi host and root space was filled up,
I have increased virtual disk and then LVM needs to be resized thru the system…
#####################################
Simple steps log:


[~]# fdisk -l

Disk /dev/sda: 139.5 GB, 139586437120 bytes
255 heads, 63 sectors/track, 16970 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        5221    41833260   8e  Linux LVM

#################################



[~]# lvs    
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao  39.38G                                      
  LogVol01 VolGroup00 -wi-ao 512.00M  

#################################

[~]# df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00  39G   27G  9.6G  74% /
/dev/sda1                        99M   38M   56M  41% /boot
tmpfs                            125M     0  125M   0% /dev/shm

#################################

[~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree
  VolGroup00   1   2   0 wz--n- 39.88G    0 

################################

[~]# fdisk /dev/sda

The number of cylinders for this disk is set to 16970.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (5222-16970, default 5222): 
Using default value 5222
Last cylinder or +size or +sizeM or +sizeK (5222-16970, default 16970): 
Using default value 16970

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


[~]# reboot

Broadcast message from root (pts/1) (Fri Mar 18 15:42:28 2016):

The system is going down for reboot NOW!

#####################################

[~]# fdisk -l

Disk /dev/sda: 139.5 GB, 139586437120 bytes
255 heads, 63 sectors/track, 16970 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        5221    41833260   8e  Linux LVM
/dev/sda3            5222       16970    94373842+  8e  Linux LVM

[~]# mkfs.ext3 /dev/sda3
mke2fs 1.39 (29-May-2006)
warning: 500 blocks unused.

Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
11819520 inodes, 23592960 blocks
1179673 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
720 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

##########################################

[~]# vgextend VolGroup00 /dev/sda3
  Volume group "VolGroup00" successfully extended

##########################################

[~]# vgs
  VG         #PV #LV #SN Attr   VSize   VFree 
  VolGroup00   2   2   0 wz--n- 129.88G 90.00G

##########################################

[~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00
  Extending logical volume LogVol00 to 129.38 GB
  Logical volume LogVol00 successfully resized

##########################################

[~]# resize2fs /dev/VolGroup00/LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 33914880 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 33914880 blocks long.

##########################################

[~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      126G   27G   93G  23% /
/dev/sda1              99M   38M   56M  41% /boot
tmpfs                 125M     0  125M   0% /dev/shm

##########################################

[~]# date
Fri Mar 18 18:43:20 AZT 2016

##########################################

Done….

more