Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > Configuration > Issue <<  9 of 606 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 1372
Last update: 02-27-08
Issue:
How do I create a logical volume using Logical Volume Manager (LVM) post installation?
Resolution:

Logical volumes can be created at installation time, however, the need sometimes arises to create new logical volumes after the installation.

To create a logical volume after install time we can do the following, for example:

We have disk partitions /dev/sda3, /dev/sdb1 and /dev/hda2 free for use and we want to create a volume group (VG) named test_vg for a Logical Volume Manager (LVM) partition.

  1. Change the partition type for these 3 partitions to 8e with fdisk.
    See pvcreate(8) (man 8 pvcreate) which tells us that 8e identifies LVM partitions.

  2. pvcreate /dev/sda3 /dev/sdb1 /dev/hda2

  3. vgcreate test_vg /dev/sda3 /dev/sdb1 /dev/hda2 With our volume group test_vg now online, we can create logical volumes. For example, a logical volume with a size of 100 MB and standard name /dev/test_vg/lvol1 and another one named my_test_lv with size 200 MB striped (RAID 0) across all the three physical volumes.
    1. lvcreate -L 100 test_vg
    2. lvcreate -L 200 -n my_test_lv -i 3 test_vg

    Note that the command lvcreate -L 100 test_vg will create the logical volume named /dev/test_vg/lvol1 100 MB in size. The second command, lvcreate -L 200 -n my_test_lv -i 3 test_vg will create a logical volume named my_test_lv because we used the -n option. Also, the -i option gives the number of stripes which is equal to the number of physical volumes to scatter the logical volume, 3 in our case.

Now we can create a file system on our arrays. For example, to create an ext2 file system on the LV my_test_lv:

mkfs -t ext2 /dev/test_vg/my_test_lv

If you would prefer to create an ext3 file system on the new LV, then use the following commands:

mke2fs -j /dev/test_vg/my_test_lv

You can then mount the LV using the mount command:

mount /dev/test_vg/my_test_lv /usr1

If you want this newly created LV to come up during the boot sequence, you can add the correct notation in the /etc/fstab file.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > Configuration > Issue <<   9  of  606  >>