1. The pvcreate command initializes a disk or partition as a physical volume for use with the volume manager.
When using whole disks you don't need any special preparation.
# pvcreate /dev/xvdd
# vgextend vg_knaalpha /dev/xvdd
# vgdisplay -v vg_knaalpha
2. When using partitions, the system id of the partitions should be set to "Linux LVM" (8e).
# parted /dev/xvdd
(parted) mklabel gpt
(parted) mkpart FRA 0GB 600GB
(parted) print
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdc: 1797GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 600GB 600GB FRA
(parted) q
#
# pvcreate /dev/xvdd1
# vgextend vg_knaalpha /dev/xvdd1
# vgdisplay -v vg_knaalpha
3. The size of a specified logical volume can be safely increased using the lvextend command.
# lvextend --size 600G /dev/vg_knaalpha/lv_fra
Extending logical volume lvol0 to 600.00 GiB
Logical volume lv_fra successfully resized
#
4. You can then extend the file system on the logical volume using the resize2fs command.
The following example shows the file system being extended twice. The first time to 1500M,
only using part of the logical volume, then to fill the logical volume.
# resize2fs /dev/vg_knaalpha/lv_fra
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vg_knaalpha/lv_fra to xxxxxxx (xk) blocks.
The filesystem on /dev/vg_knaalpha/lv_fra is now xxxxxxx blocks long.
#
/dev/mapper/vg_knaalpha-lv_grid 40G 11G 28G 28% /oracle_grid
# umount /oracle_grid
# e2fsck -ff /dev/mapper/vg_knaalpha-lv_grid
# resize2fs /dev/mapper/vg_knaalpha-lv_grid 20G
# lvreduce -L -20G /dev/mapper/vg_knaalpha-lv_grid
# lvextend -L+20G /dev/mapper/vg_knaalpha-lv_app
# resize2fs /dev/mapper/vg_knaalpha-lv_app
# mount -a
or
# mount /dev/mapper/vg_knaalpha-lv_grid /oracle_grid
How to Extend/Reduce LVM (Logical Volume Management) in Linux
/dev/mapper/vg_knaalpha-lv_grid 40G 11G 28G 28% /oracle_grid
# umount /oracle_grid
# e2fsck -ff /dev/mapper/vg_knaalpha-lv_grid
# resize2fs /dev/mapper/vg_knaalpha-lv_grid 20G
# lvreduce -L -20G /dev/mapper/vg_knaalpha-lv_grid
# lvextend -L+20G /dev/mapper/vg_knaalpha-lv_app
# resize2fs /dev/mapper/vg_knaalpha-lv_app
# mount -a
or
# mount /dev/mapper/vg_knaalpha-lv_grid /oracle_grid
No comments:
Post a Comment