Saturday, February 18, 2006

How to create a LVM2 logical volume and the ext2 or ext3 filesystem

1. Create a new partition using parted, mkpart
# parted /dev/hda "mkpart primary 101.976 2500"

2. Create new physical volume on new partition using pvcreate.
# lvm pvcreate /dev/hda2

3. Create a new volume group using lvm vgcreate for above physical volume.
# lvm vgcreate TestVG /dev/hda2

4. Activate new volume group using lvm vgchange.
# lvm vgchange -a y TestVG

5. Create a test logical volume in this volume group using lvm lvcreate.
# lvm lvcreate -l598 TestVG -nTestLV

6. Create a file system on logical volume using mkfs.ext3.
# mkfs.ext3 /dev/TestVG/TestLV

7. mount the file system.
# mount /dev/TestVG/TestLV /mnt/test

No comments:

Post a Comment