Search This Blog

Tuesday, 19 April 2011

Extending VMWARE guest linux OS Filesystem

1.Rescan SCSI Bus to detect newly added disk using below command.

[root@RHEL ~]# echo "- - -">/sys/class/scsi_host/host*/scan

2. Tail system message file for checking the newly added disk is probed.
[root@RHEL ~]# tail -f /var/log/messages
Mar  6 16:34:56 RHEL kernel: SCSI device sdc: 545259520 512-byte hdwr sectors (279173 MB)
Mar  6 16:34:56 RHEL kernel: sdc: cache data unavailable
Mar  6 16:34:56 RHEL kernel: sdc: assuming drive cache: write through
Mar  6 16:34:56 RHEL kernel: SCSI device sdc: 545259520 512-byte hdwr sectors (279173 MB)
Mar  6 16:34:56 RHEL kernel: sdc: cache data unavailable
Mar  6 16:34:56 RHEL kernel: sdc: assuming drive cache: write through
Mar  6 16:34:57 RHEL kernel:  sdc: unknown partition table
Mar  6 16:34:57 RHEL kernel: Attached scsi disk sdc at scsi0, channel 0, id 2, lun 0
Mar  6 16:34:57 RHEL scsi.agent[31318]: disk at /devices/pci0000:00/0000:00:10.0/host0/target0:0:2/0:0:2:0
Mar  6 16:34:57 RHEL udevd[1418]: udev done!

3. Now the new disk (/dev/sdc) is  visible in fdisk output (With a invalid disk label for new disks)
[root@RHEL ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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        3916    31350847+  8e  Linux LVM

Disk /dev/sdb: 75.1 GB, 75161927680 bytes
255 heads, 63 sectors/track, 9137 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        9138    73400319+  8e  Linux LVM

Disk /dev/sdc: 279.1 GB, 279172874240 bytes
255 heads, 63 sectors/track, 33940 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table

4. Create physical volume on new disk
#pvcreate /dev/sdc
5. Extend the VG(VgBSL) to new disk (/dev/sdc)
[root@RHEL ~]# vgextend VgBSL /dev/sdc
  /dev/cdrom: open failed: No medium found
  Volume group "VgBSL" successfully extended
5. List the existing Physical Volumes
[root@RHEL ~]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a-    29.88G      0
  /dev/sdb1  VgBSL     lvm2 a-    69.97G   1.53G
  /dev/sdc   VgBSL     lvm2 a-   259.97G 259.97G

6. Extend logical Volume to new size (old size + newly available)
[root@RHEL ~]# lvextend -L 299G /dev/mapper/VgBSL-LogVol02
  Extending logical volume LogVol02 to 299.00 GB
  Logical volume LogVol02 successfully resized

7. Extend the Volume using ext2online command.
[root@RHEL ~]# ext2online /dev/mapper/VgBSL-LogVol02
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
8. Now the Volume is resized to new size
[root@RHEL ~]# df -h /apps
Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VgBSL-LogVol02
                      295G   37G  247G  13% /apps

No comments:

Post a Comment