Friday, 29 January 2016

[Linux] How to Increase the size of LVM by adding a new disk

1. Check New Disk Device

fdisk -l


2. Create Partition

  2.1. Select Device
fdisk /dev/xvdb

  2.2. New Partition
Command (m for help): n

  2.3. Continue...
Command action
   e   extended
   p   primary partition (1-4)
p

Partition number (1-4): 1

First cylinder (1-2610, default 1): (enter)
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): (enter)

  2.4. Change to a partitions system ID
Command (m for help): t
Selected partition 1

Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

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

Calling ioctl() to re-read partition table.
Syncing disks.

3. Create PV(Physical Volume)

pvcreate /dev/xvdb1



4. Extend VG(Volume Group)
vgdisplay


vgextend VolGroup /dev/xvdb1


pvscan


5. Extend LV(Logical Volume)

lvdisplay
































lvextend /dev/VolGroup/lv_home /dev/xvdb1


6. Resize File System

resize2fs /dev/VolGroup/lv_home




Before Extention



After Extention



No comments:

Post a Comment