Add Logical Partition to root in Linux

Add logical Partition to the root
old size of root : 8GB
add size of 30GB in root
[root@rac-node2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
6.5G 3.8G 2.4G 62% /
tmpfs 4.8G 0 4.8G 0% /dev/shm
/dev/xvda1 477M 68M 380M 16% /boot
/dev/xvdb1 50G 52M 47G 1% /u01
1: Add Disk of 30GB
[root@rac-node2 ~]# fdisk -l
Disk /dev/xvdc: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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
2: run fdisk using /dev/xvdc
[root@rac-node2 ~]# fdisk /dev/xvdc
Command (m for help): n [TYPE n]
Command action
e extended
p primary partition (1-4)
p [TYPE p]
Partition number (1-4): 1 [TYPE 1]
First cylinder (1-3916, default 1): [ENTER]
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3916, default 3916): [ENTER]
Using default value 3916
Command (m for help): t [TYPE t]
Selected partition 1
Hex code (type L to list codes): 8e [TYPE 8e]
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w [TYPE w]
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3: [root@rac-node2 ~]# fdisk -l
Disk /dev/xvdc: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x54aca0fe
Device Boot Start End Blocks Id System
/dev/xvdc1 1 3916 31455238+ 8e Linux LVM
4: [root@rac-node2 ~]# pvcreate /dev/xvdc1
Physical volume "/dev/xvdc1" successfully created
5: [root@rac-node2 ~]# vgdisplay
--- Volume group ---
VG Name VolGroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 7.51 GiB
PE Size 4.00 MiB
Total PE 1922
Alloc PE / Size 1922 / 7.51 GiB
Free PE / Size 0 / 0
VG UUID Jb01NO-YpG9-jU7D-VBRr-vlOG-xWTY-TdhZKw
6: [root@rac-node2 ~]# vgextend VolGroup /dev/xvdc1
Volume group "VolGroup" successfully extended
7: [root@rac-node2 ~]# pvscan
PV /dev/xvda2 VG VolGroup lvm2 [7.51 GiB / 0 free]
PV /dev/xvdc1 VG VolGroup lvm2 [30.00 GiB / 30.00 GiB free]
Total: 2 [37.50 GiB] / in use: 2 [37.50 GiB] / in no VG: 0 [0 ]
8: [root@rac-node2 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/VolGroup/lv_root [TAKE LV PATH]
LV Name lv_root
VG Name VolGroup
LV UUID m30nCz-swe1-VzRY-nfzD-mlbo-lZd9-e2ngDb
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-01-14 01:14:40 -0500
LV Status available
# open 1
LV Size 6.71 GiB
Current LE 1718
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Path /dev/VolGroup/lv_swap
LV Name lv_swap
VG Name VolGroup
LV UUID Leqw34-2ZiP-ohmc-CgvV-s6Qq-qrkF-iUkGdo
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2016-01-14 01:14:47 -0500
LV Status available
# open 2
LV Size 816.00 MiB
Current LE 204
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
9:
[root@rac-node2 ~]# lvextend /dev/VolGroup/lv_root /dev/xvdc1 [COMMAND]
Size of logical volume VolGroup/lv_root changed from 6.71 GiB (1718 extents) to 36.71 GiB (9397 extents).
Logical volume lv_root successfully resized
10:
[root@rac-node2 ~]# resize2fs /dev/VolGroup/lv_root [COMMAND]
resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 3
The filesystem on /dev/VolGroup/lv_root is now 9622528 blocks long.
[root@rac-node2 ~]# df -h [COMMAND]
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 3.8G 31G 11% /
tmpfs 4.8G 0 4.8G 0% /dev/shm
/dev/xvda1 477M 68M 380M 16% /boot
/dev/xvdb1 50G 52M 47G 1% /u01
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment