Logical Volume Manager (LVM) = Disk management to manage physical disks as logical volumes.
Volume = A device used for a filesystem, swap, or raw data. Without Logical Volume Manager, a volume would be either a disk partition or an entire disk drive.
Physical Volume (PV) = The standard partition that you add to the LVM.
Volume Group = a collection of logical volumes that are managed by Logical Volume Manager.
Logical Volume = Space that is defined within a volume group. A volume group is divided up into logical volumes.
Creating logical volumes on RHEL 4 :
Add new hard drive or create X partitions if using single hard drive, and change partition type to linux lvm (8e) using "fdisk"
Create physical volume
# pvcreate /dev/hda1
# pvcreate /dev/hdb1
Create volume group (vg)
# vgcreate vg0 /dev/hda1 /dev/hdb1
Check available volume group space
# vgdisplay -v
Create logical volume (lv) on new VG (for example 200 MBytes)
# lvcreate -L 200M -n test vg0
Create file system for the new logical volume
# mkfs.ext3 /dev/vg0/test
Create new directory to mount the logical volume
# mkdir /test
Add new logical volume to "/etc/fstab" to make automaticly mount at system start and reboot the system or manually mount with :
# mount /dev/vg0/test /test
Resizing Logical Volume on RHEL 4 :
Add new hard drive / partitionChange partition type to linux lvm (8e) using "fdisk"
# vgextend vg0 /dev/hdc1
Check available volume group space
# vgdisplay -v
Add new free space to logical volume
# lvextend -L +50M /dev/vg0/test
Resize filesystem (never used mkfs/mke2fs because it will be format all the logical volume)
# ext2online /dev/vg0/test
Reducing logical volume on RHEL 4 :
Unmount any directories associated with the logical volume.
# umount /test
Reduce the volume group
# resize2fs /dev/vg0/test 120M
Reduce the logical volume
# lvreduce -L 120M /dev/vg0/test
Mount again with the new size
# mount /dev/vg0/test /test
Check status disk free.
# df -h
Removing Logical volumes on RHEL 4 :
Unmount any directories associated with the logical volume
# umount /dev/vg0/test
Remove the logical volume with a command :
# lvremove /dev/vg0/test
0 comments:
Post a Comment