Networking, Programming and Graphics - Tutorials
ONLINEHOWTO.net Tutorials Category

LVM Logical Volume setup and management

Type: Code Networking, Programming and Graphics - Tutorials
Networking, Programming and Graphics - Tutorials
Level: Beginner Networking, Programming and Graphics - Tutorials 
Networking, Programming and Graphics - Tutorials
Date: 2009-Nov-30
Networking, Programming and Graphics - Tutorials
Visited: 420 times
Networking, Programming and Graphics - Tutorials
Rating: Networking, Programming and Graphics - Tutorials
Networking, Programming and Graphics - Tutorials
Published: Stephen Think

In the first two tutorials of these series we have shown the basics of Logical Volume Management (LVM) so it is now time to get to the last part of this topic.

Until now we have covered the :
LVM general information and Physical volume creation and LVM Volume Group creation and management. Last part of these series is about the Logical Volume setup and management.

Logical Volume
1.Creating a logical volume
Logical volume with specific size creation(in our case 2GB)
# lvcreate -L 2G -n testvolume my_volume_group
Successful result of the above command should look like this

Logical volume "testvolume" created

We are just one step away from being able to use the space and be able to mount the virtual device in the directory tree. The last part is to create the file system. For that step we use the mke2fs command. In the below example we create s ext3 partition.
#mke2fs -j /dev/my_volume_group/testvolume
From now on, you have a virtual device. You could mount on the directory tree just as any other formated physical device.

Last part that I will focus on in this tutorial is the part where you can delete an existing logical volume.

Logical volume removal
A logical volume must not be mounted before it can be removed. So there are two command that we have to execute to make that happen. In the example we assume that we have the Logical volume mounted at /mnt/test. In real system that probably will be your /var or /home partition so you have to be sure that no process is trying to access that piece of your files system.

# umount /mnt/test
# lvremove /dev/my_volume_group /testvolume
Do you really want to remove active logical volume "testvolume"? [y/n]: y
Logical volume "testvolume" successfully removed

Rate this tutorial:                    
Post Comment

Need a specific tutorial? Do not hesitate and submit a request!
Your e-mail: