Monday, April 23, 2018

Extend Physical Volume Group

root@ubuntu:/motadata/motadata# fdisk -l
Disk /dev/sda: 322.1 GB , 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders, total 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000713d6

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 782335 390144 83 Linux
/dev/sda2 782336 209713151 104465408 8e Linux LVM

Disk /dev/mapper/vg0-root: 10.2 GB, 10238296064 bytes
255 heads, 63 sectors/track, 1244 cylinders, total 19996672 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-root doesn't contain a valid partition table

Disk /dev/mapper/vg0-swap: 8191 MB, 8191475712 bytes
255 heads, 63 sectors/track, 995 cylinders, total 15998976 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-swap doesn't contain a valid partition table

Disk /dev/mapper/vg0-motadata: 88.5 GB, 88541757440 bytes
255 heads, 63 sectors/track, 10764 cylinders, total 172933120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-motadata doesn't contain a valid partition table


root@ubuntu:/motadata/motadata# lvdisplay

--- Logical volume ---
LV Path /dev/vg0/root
LV Name root
VG Name vg0
LV UUID 8lPue7-0uYL-Pra7-FvoN-AVdd-1sxy-l7BFQY
LV Write Access read/write
LV Creation host, time ubuntu, 2017-05-22 12:46:16 +0530
LV Status available
# open 1
LV Size 9.54 GiB
Current LE 2441
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0

--- Logical volume ---
LV Path /dev/vg0/swap
LV Name swap
VG Name vg0
LV UUID tFWxPn-WPa5-J56B-8dN3-0fsr-to0K-RXMSWw
LV Write Access read/write
LV Creation host, time ubuntu, 2017-05-22 12:46:16 +0530
LV Status available
# open 2
LV Size 7.63 GiB
Current LE 1953
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1

--- Logical volume ---
LV Path /dev/vg0/motadata
LV Name motadata
VG Name vg0
LV UUID ri3bxW-tEPc-XiJB-eu0W-k2Zt-Ri0c-7nbkq7
LV Write Access read/write
LV Creation host, time ubuntu, 2017-05-22 12:46:16 +0530
LV Status available
# open 1
LV Size 82.46 GiB
Current LE 21110
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2


root@ubuntu:/motadata/motadata# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg0 lvm2 a-- 99.62g 0


root@ubuntu:/motadata/motadata# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
motadata vg0 -wi-ao--- 82.46g
root vg0 -wi-ao--- 9.54g
swap vg0 -wi-ao--- 7.63g


root@ubuntu:/motadata/motadata# vgs
VG #PV #LV #SN Attr VSize VFree
vg0 1 3 0 wz--n- 99.62g 0


root@ubuntu:/motadata/motadata# lvextend /dev/vg0/motadata /dev/sda2
No free extents on physical volume "/dev/sda2"
No specified PVs have space available


root@ubuntu:/motadata/motadata# fdisk /dev/sda
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (1-4, default 3):
Using default value 3
First sector (209713152-629145599, default 209713152):
Using default value 209713152
Last sector, +sectors or +size{K,M,G} (209713152-629145599, default 629145599):
Using default value 629145599

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 or after you run partprobe(8) or kpartx(8)
Syncing disks.


root@ubuntu:/motadata/motadata# df -kh
Filesystem Size Used Avail Use% Mounted on
udev 12G 4.0K 12G 1% /dev
tmpfs 2.4G 704K 2.4G 1% /run
/dev/dm-0 9.3G 3.4G 5.5G 39% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 12G 0 12G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/mapper/vg0-motadata 82G 69G 9.4G 88% /motadata
/dev/sda1 361M 40M 299M 12% /boot


root@ubuntu:/motadata/motadata# fdisk -l
Disk /dev/sda: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 cylinders, total 629145600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000713d6

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 782335 390144 83 Linux
/dev/sda2 782336 209713151 104465408 8e Linux LVM
/dev/sda3 209713152 629145599 209716224 8e Linux LVM

Disk /dev/mapper/vg0-root: 10.2 GB, 10238296064 bytes
255 heads, 63 sectors/track, 1244 cylinders, total 19996672 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-root doesn't contain a valid partition table

Disk /dev/mapper/vg0-swap: 8191 MB, 8191475712 bytes
255 heads, 63 sectors/track, 995 cylinders, total 15998976 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-swap doesn't contain a valid partition table

Disk /dev/mapper/vg0-motadata: 88.5 GB, 88541757440 bytes
255 heads, 63 sectors/track, 10764 cylinders, total 172933120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg0-motadata doesn't contain a valid partition table


root@ubuntu:/motadata/motadata# partprobe


root@ubuntu:/motadata/motadata# pvcreate /dev/sda3


Physical volume "/dev/sda3" successfully created


root@ubuntu:/motadata/motadata# vgextend vg0 /dev/sda3
Volume group "vg0" successfully extended


root@ubuntu:/motadata/motadata# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
motadata vg0 -wi-ao--- 82.46g
root vg0 -wi-ao--- 9.54g
swap vg0 -wi-ao--- 7.63g


root@ubuntu:/motadata/motadata# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg0 lvm2 a-- 99.62g 0
/dev/sda3 vg0 lvm2 a-- 200.00g 200.00g


root@ubuntu:/motadata/motadata# lvextend -L +180G /dev/vg0/motadata /dev/sda3
Extending logical volume motadata to 262.46 GiB
Logical volume motadata successfully resized


root@ubuntu:/motadata/motadata# resize2fs /dev/vg0/motadata
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/vg0/motadata is mounted on /motadata; on-line resizing required
old_desc_blocks = 6, new_desc_blocks = 17
The filesystem on /dev/vg0/motadata is now 68802560 blocks long.


root@ubuntu:/motadata/motadata# df -kh
Filesystem Size Used Avail Use% Mounted on
udev 12G 4.0K 12G 1% /dev
tmpfs 2.4G 708K 2.4G 1% /run
/dev/dm-0 9.3G 3.4G 5.5G 39% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 12G 0 12G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/mapper/vg0-motadata 259G 69G 180G 28% /motadata
/dev/sda1 361M 40M 299M 12% /boot

No comments:

Post a Comment