Differences
This shows you the differences between two versions of the page.
linux_wiki:create_and_remove_physical_volumes_assign_physical_volumes_to_volume_groups_and_create_and_delete_logical_volumes [2016/03/03 21:38] billdozor |
linux_wiki:create_and_remove_physical_volumes_assign_physical_volumes_to_volume_groups_and_create_and_delete_logical_volumes [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Create And Remove Physical Volumes Assign Physical Volumes To Volume Groups And Create And Delete Logical Volumes ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Working with logical volumes. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Partition Setup ===== | ||
- | |||
- | Parition that is prepared for type LVM (8e00) | ||
- | <code bash> | ||
- | gdisk /dev/sdb | ||
- | n | ||
- | Partition number: 1 | ||
- | First sector: default | ||
- | Last sector: +30G | ||
- | Hex code type: 8e00 | ||
- | w | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Physical Volumes ===== | ||
- | |||
- | Create physical volume | ||
- | <code bash> | ||
- | pvcreate /dev/sdb1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Summary of physical volumes | ||
- | <code bash> | ||
- | pvs | ||
- | </ | ||
- | |||
- | \\ | ||
- | Full display of physical volumes | ||
- | <code bash> | ||
- | pvdisplay | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Volume Groups ===== | ||
- | |||
- | Assign physical volume to new volume group | ||
- | <code bash> | ||
- | vgcreate vglocal /dev/sdb1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Assign physical volume to existing volume group | ||
- | <code bash> | ||
- | vgextend vglocal /dev/sdb1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Summary of volume groups | ||
- | <code bash> | ||
- | vgs | ||
- | </ | ||
- | |||
- | \\ | ||
- | Full display of volume groups | ||
- | <code bash> | ||
- | vgdisplay | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Logical Volumes ===== | ||
- | |||
- | Create logical volume | ||
- | <code bash> | ||
- | lvcreate --name lvhome --size 30G vglocal | ||
- | </ | ||
- | |||
- | \\ | ||
- | Summary of logical volumes | ||
- | <code bash> | ||
- | lvs | ||
- | </ | ||
- | |||
- | \\ | ||
- | Full display of logical volumes | ||
- | <code bash> | ||
- | vgdisplay | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== File System and Mounting ===== | ||
- | |||
- | Create filesystem and mount logical volume | ||
- | <code bash> | ||
- | mkfs -t xfs / | ||
- | mount / | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Removals ===== | ||
- | |||
- | Delete logical volume | ||
- | <code bash> | ||
- | lvremove / | ||
- | </ | ||
- | |||
- | \\ | ||
- | Remove a physical volume (/dev/sdb1) from a volume group (vglocal) | ||
- | <code bash> | ||
- | vgreduce vglocal /dev/sdb1 | ||
- | </ | ||
- | |||
- | \\ | ||
- | Delete volume group | ||
- | <code bash> | ||
- | vgremove vglocal | ||
- | </ | ||
- | |||
- | \\ | ||
- | Remove physical volume | ||
- | <code bash> | ||
- | pvremove /dev/sdb1 | ||
- | </ | ||
- | |||
- | ---- | ||