Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3135

linux lvm vdisk online capacity expansion whitout guest os reboot

$
0
0

Vdisk  expansion preparation :Data is priceless ,you should clone or take a snapshot .

STEP1: login c# vsphere client or web client modify the vm property,add a vdisk  and input the size you want to expansion.

STEP2: login the guest linux os with root ,

#echo "- - -" > /sys/class/scsi_host/host0/scan

(if still can't see the vdisk,can  echo "- - -" > /sys/class/scsi_host/host1/scan  ,untill # fdisk -l  can see the add vdisk

STEP3:create pv and extend vgs

[root@localhost ~]# pvcreate /dev/sdb

Physical volume "/dev/sdb" successfully created

[root@localhost ~]# vgextend rootvg /dev/sdb

Volume group "rootvg" successfully extended

STEP4:extend lv and reszie filesysystem

[root@localhost ~]# lvextend -L 39G /dev/mapper/rootvg-home_lv    Extending logical volume home_lv to 39.00 GiB

Logical volume home_lv successfully resized

[root@localhost ~]# resize2fs /dev/mapper/rootvg-home_lv

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/mapper/rootvg-home_lv is mounted on /home; on-line resizing required

old desc_blocks = 2, new_desc_blocks = 3

Performing an on-line resize of /dev/mapper/rootvg-home_lv to 10223616 (4k) blocks.

The filesystem on /dev/mapper/rootvg-home_lv is now 10223616 blocks long.

 

 

 

 

example  (rootvg-root_lv enxtend 9GB) :

[root@CNSZBSQ-000027 ~]# fdisk -l

 

 

Disk /dev/sda: 525 MB, 525467648 bytes

4 heads, 32 sectors/track, 8018 cylinders

Units = cylinders of 128 * 512 = 65536 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2028d392

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sda1  *          2        8001      512000  83  Linux

 

 

Disk /dev/sdb: 92.3 GB, 92347170816 bytes

26 heads, 62 sectors/track, 111889 cylinders

Units = cylinders of 1612 * 512 = 825344 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4959f9c1

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sdb1              1      111888    90181632  8e  Linux LVM

 

 

Disk /dev/mapper/rootvg-root_lv: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-was_lv: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-tmp_lv: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-swap_lv: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

[root@CNSZBSQ-000027 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan

[root@CNSZBSQ-000027 ~]# fdisk -l

 

 

Disk /dev/sda: 525 MB, 525467648 bytes

4 heads, 32 sectors/track, 8018 cylinders

Units = cylinders of 128 * 512 = 65536 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2028d392

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sda1  *          2        8001      512000  83  Linux

 

 

Disk /dev/sdb: 92.3 GB, 92347170816 bytes

26 heads, 62 sectors/track, 111889 cylinders

Units = cylinders of 1612 * 512 = 825344 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4959f9c1

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sdb1              1      111888    90181632  8e  Linux LVM

 

 

Disk /dev/mapper/rootvg-root_lv: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-was_lv: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-tmp_lv: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-swap_lv: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

[root@CNSZBSQ-000027 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan

[root@CNSZBSQ-000027 ~]# fdisk -l

 

 

Disk /dev/sda: 525 MB, 525467648 bytes

4 heads, 32 sectors/track, 8018 cylinders

Units = cylinders of 128 * 512 = 65536 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2028d392

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sda1  *          2        8001      512000  83  Linux

 

 

Disk /dev/sdb: 92.3 GB, 92347170816 bytes

26 heads, 62 sectors/track, 111889 cylinders

Units = cylinders of 1612 * 512 = 825344 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4959f9c1

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sdb1              1      111888    90181632  8e  Linux LVM

 

 

Disk /dev/mapper/rootvg-root_lv: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-was_lv: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-tmp_lv: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-swap_lv: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

[root@CNSZBSQ-000027 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

[root@CNSZBSQ-000027 ~]# fdisk -l

 

 

Disk /dev/sda: 525 MB, 525467648 bytes

4 heads, 32 sectors/track, 8018 cylinders

Units = cylinders of 128 * 512 = 65536 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2028d392

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sda1  *          2        8001      512000  83  Linux

 

 

Disk /dev/sdb: 92.3 GB, 92347170816 bytes

26 heads, 62 sectors/track, 111889 cylinders

Units = cylinders of 1612 * 512 = 825344 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4959f9c1

 

 

  Device Boot      Start        End      Blocks  Id  System

/dev/sdb1              1      111888    90181632  8e  Linux LVM

 

 

Disk /dev/mapper/rootvg-root_lv: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-was_lv: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-tmp_lv: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/mapper/rootvg-swap_lv: 17.2 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

 

 

 

Disk /dev/sdc: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

 

[root@CNSZBSQ-000027 ~]# df -hT

Filesystem                Type  Size  Used Avail Use% Mounted on

/dev/mapper/rootvg-root_lv ext4    20G  6.2G  13G  33% /

tmpfs                      tmpfs  940M  72K  940M  1% /dev/shm

/dev/mapper/rootvg-was_lv  ext4    40G  9.8G  28G  26% /websphere

/dev/sda1                  ext4  485M  56M  404M  13% /boot

/dev/mapper/rootvg-tmp_lv  ext4    10G  216M  9.3G  3% /tmp

[root@CNSZBSQ-000027 ~]# vgs

  VG    #PV #LV #SN Attr  VSize  VFree

  rootvg  1  4  0 wz--n- 86.00g    0

[root@CNSZBSQ-000027 ~]# pvcreate /dev/sdc

  Physical volume "/dev/sdc" successfully created

[root@CNSZBSQ-000027 ~]# vgextend rootvg /dev/sdc

  Volume group "rootvg" successfully extended

[root@CNSZBSQ-000027 ~]# vgs

  VG    #PV #LV #SN Attr  VSize  VFree

  rootvg  2  4  0 wz--n- 96.00g 10.00g

[root@CNSZBSQ-000027 ~]# lvextend -L 29G /dev/mapper/rootvg-root_lv

  Extending logical volume root_lv to 29.00 GiB

  Logical volume root_lv successfully resized

[root@CNSZBSQ-000027 ~]# resize2fs /dev/mapper/rootvg-root_lv

resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/mapper/rootvg-root_lv is mounted on /; on-line resizing required

old desc_blocks = 2, new_desc_blocks = 2

Performing an on-line resize of /dev/mapper/rootvg-root_lv to 7602176 (4k) blocks.

The filesystem on /dev/mapper/rootvg-root_lv is now 7602176 blocks long.

[root@CNSZBSQ-000027 ~]# df -hT

Filesystem                Type  Size  Used Avail Use% Mounted on

/dev/mapper/rootvg-root_lv ext4    29G  6.2G  22G  23% /

tmpfs                      tmpfs  940M  72K  940M  1% /dev/shm

/dev/mapper/rootvg-was_lv  ext4    40G  9.8G  28G  26% /websphere

/dev/sda1                  ext4  485M  56M  404M  13% /boot

/dev/mapper/rootvg-tmp_lv  ext4    10G  216M  9.3G  3% /tmp


Viewing all articles
Browse latest Browse all 3135

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>