Monday, June 2, 2014

How to resize the existing extended vmware disk in Redhatlinux 5.3 and above


STEP 1:-
In some case ( Redhat 5.2  or older) we have to perform umount the file system and then deactivate the VG before resizing the lun
STEP 2 :-
# cd /dev/disk
# cd by-path
# ls -l
# echo 1 > /sys/class/scsi_disk/2:0:2:0/device/rescan

  ( if disk is from storage then use below command
echo "1" > /sys/class/scsi_device/$host:$channel:$id:$lun/device/rescan  ,where $host:$channel:$id:$lun are whatever combination of scsi path )

# fdisk -l | grep Disk
#pvs
#pvresize /dev/sdc
#pvs
#vgs
#lvs
#lvextend -L +180G /dev/vg02/lv02
#resize2fs /dev/vg02/lv02
#df -h /u02


I've been struggling with the same problem and came up with pretty much the same solution, except that rescan the disk using
# echo 1 > /sys/block/$LUN/device/rescan
($LUN=sdc in this case)

Two other solutions are to create a new 10G lun on the san and add it in so you get two PVs in the VG, messier but you can then resize without un mounting the files system.
Alternatively create a LUN of the size you want add it to the VG and then use pvmove to migrate the data off the smaller lun onto the new larger lun and use vgreduce to get rid of the old disk. Its more of a pain but the result is neater and again no un mounting. Oh and don’t try pvmoving your root filesystem unless you  really enjoy kernel panics.

No comments:

Post a Comment