Popular
Latest Articles
- How to determine the Syslog Facility using Tcpdump
- Oracle 11g / Fedora 13 - Error in invoking target 'agent nmb nmo nmhs tclexec'
- Cisco Router Zone Based Firewall Configuation Guide - Video Tutorial
- Installing GNS3 0.7.2 onto Fedora 13
- Configuring a Pre-Shared Site to Site VPN between 2 Cisco Routers
- IPv4 Subnetting Notes
- Types of IDS Alerts
- How to run vSphere using SSH tunnelling
Logical Volume Manager
Saturday, 07 February 2009 14:56
Whats is LVM ?
LVM (Logical Volume Manager) for the Linux Kernel is a method of allocating hard drive space into logical volumes, this also allows for the easy creation, resizing, or removal of new or existing partitions.
There are 4 main terms with LVM .....
- physical volumes - These are your physical disks, or disk partitions, such as /dev/hda or /dev/hdb1.
- volume groups - A volume group is comprised of real physical volume or volumes.
- logical volumes - The volume group contains your logical volumes, such as /opt /var etc.
- Filesystem - On each logical volume you will have a filesystem.
Note : You can have more then one physically volume used when creating a volume group. i.e 2 Physical Volumes at 20 GB each (2 x 20GB). This would allow you to create a 40GB Volume Group.
How do I change the size of my Logical Volumes ?
In this example we will resize both /var and /usr to 40GB each. There current sizes are,
- /var = 60GB
- /usr = 20GB
The following commands will provide you with an overview of your Physical / Logical Volumes,
- fdisk -l - Displays your physical volumes
- lvdisplay - Displays your Logical Volume Groups
- df -kh - Displays you Logical Volumes
sed -i 's/id:3:initdefault/id:1:initdefault/g' /etc/inittab
reboot
Note : within the syntax all the size totals (40GB) is the total size that the filesystem / Logical volume will be.
umount /var
e2fsck -f /dev/vg0/var
resize2fs /dev/vg0/var 40G
lvreduce -L 40G /dev/vg0/var
lvextend -L 40G /dev/vg0/usr
resize2fs /dev/vg0/usr 40G
Then use the df -kh command to check that the changes have been successful.
Once you have confirmed the required changes have been made reboot your system into multiuser mode,
sed -i 's/id:1:initdefault/id:3:initdefault/g' /etc/inittab
reboot