Blog Moved

Friday, October 22, 2010

Linux LVM

Instructions for creating a new file system via LVM.
I'll assume we have two disks we're going to use, /dev/sde and /dev/sdf.
All of this has to be done as root.
  1. Create partitions on both disks using fdisk. Set the type to 8e (Linux LVM). These may be the full disk, or not. I'll assume these are now /dev/sde1 and /dev/sdf1
  2. Create physical volumes:
    # pvcreate /dev/sde1
    # pvcreate /dev/sdf1
  3. Check our work:
    # pvdisplay
  4. Create a volume group:
    # vgcreate NameOfGroup /dev/sde1 /dev/sdf1
  5. Check our work:
    # vgdisplay
  6. Create the logical volume, which is what Linux will see as if it were a partition:
    # lvcreate  -l 100%VG -n NameOfVolume NameOfGroup
    Note that the -l option can be provided in many forms. This one says to assign 100% of the space in the volume group to this logical volume.
  7. Check our work:
    # lvdisplay
  8. Create the filesystem:
    # mke2fs -j -L VolumeLabel /dev/NameOfGroup/NameOfVolume
  9. Now the new filesystem can be mounted in the usual ways.
Some good links for more info:

No comments:

Post a Comment

Comments welcome, but they are expected to be civil.
Please don't bother spamming me. I'm only going to delete it.