[mdlug] Notes about filesystems and LVM

Carl T. Miller carl at carltm.com
Mon Mar 11 10:42:09 EDT 2024


Hi All,

Here's a quick recap of the commands in the demo.
Bold formatting indicates an example usage.  If you'd
like, create a vm and tinker away!

c


  * *mount*
    displays mounted devices including filesystems

  * *df -h*
    lists mounted filesystems

  * *lsblk*
    lists block devices

  * *lsblk -e7*
    ignores loop devices

  * *lsblk -f*
    includes filesystem information, if available

  * *blkid*
    gives more detailed information about devices

  * *pvs*, *vgs*, and *lvs*
    shows summary of LVM physical volumes, volume groups, and logical
    volumes

  * *pvdisplay*, *vgdisplay*, and *lvdisplay*
    shows details about physical volumes, volume groups, and logical volumes

  * lvcreate and mkfs.ext4
    creates and formats a new logical volume in a volume group
    *lvcreate -L 6G -n home vgmint
    lvcreate -L 100%FREE -n tmp vgmint
    mkfs.ext4 /dev/vgmint/home
    mkfs.ext4 /dev/vgmint/tmp

    *
  * mount
    mounts newly formatted logical volumes
    *mkdir -p /home2*
    *mount /dev/vgmint/home /mnt/home2
    *
  * pvcreate
    formats a new physical volume
    after using fdisk to create a partition of type 8E:
    *pvcreate /dev/vdb1*
    to use entire harddrive:
    *pvcreate /dev/vdc

    *
  * vgextend
    adds one or more physical volumes to a volume group
    *vgextend vgmint /dev/vdb1 /dev/vdc

    *
  * lvresize and resize2fs
    increases size of a logical volume and resizes filesystem
    *lvresize -L 10G /dev/vgmint/home*
    *resize2fs -p /dev/vgmint/home

    *
  * pvmove, pvreduce, and pvremove
    removes device from LVM
    *pvmove /dev/vdb1
    pvreduce vgmint /dev/vdb1*
    *pvremove /dev/vdb1

    *
  * lvremove
    removes a logical volume from a volume group
    *lvremove /dev/vgmint/tmp*


More information about the mdlug mailing list