LVM

What is LVM?

  1. Function & Requirement: Dynamic manage partition size.
  2. Description:

   PV(physical volume) means physical media (hard disk), and it includes lots of small units (PE - Physical Extents).

Concepts:

  1. PV: physical volume, normally it means one hard disk and divide it with lots of PEs.
  2. VG: volume group, normally it includes lots of PVs.
  3. LV: logical volume, part of VG.
  4. PE: physical extents
  5. Physical Media or hard disk


Managing LVM:

    1. Change the hard disk to LVM type(8e) with command "fdisk".
    2. Create PV: pvcreate /dev/hda; pvcreate /dev/hdb; pvcreate /dev/hdc
    3. Create VG: vgcreate myvolume /dev/hda /dev/hdb /dev/hdc
    4. Activate VG (optional for the first time): vgchange -a y myvolume
    5. Create LV: lvcreate -L 1500M -n usr myvolume | -i <stripe disk number> -I <stripe unit size>
    6. Create fs: mkfs.txt3 /dev/myolume/usr; mkreiserfs /dev/myvolume/usr
    7. Mount fs: mount -f reiserfs|ext3 /dev/myvolume/usr /usr; edit /etc/fstab directly
    8. Change LV size: lvextend -L +1g /dev/myvolume/usr; or e2fsadm
    9. Change fs size: resize_reiserfs -f /dev/myvolume/usr; | unmount /usr; resizee2fs; mount /dev/myvolume/usr /usr; | ext2resize
    10. Delete&Add new PV to VG: pvcreate /dev/hdd; vgextend myvolume /dev/hdd
    11. Query PV: pvdisplay /dev/hda
    12. Query VG: vgdisplay -v myvolume
    13. Move hard disk between computers: vgexport myvolume; vgimport myvolume
posted @ 2021-03-04 11:55  tang88seng  阅读(52)  评论(0编辑  收藏  举报