Filesystem: managing

Linux block devices can be partitioned into several partitions, max to several tens or hundreds primary partitions. (According to MBR or GPT)

In order to manage the block deivce more easily, Logical volume manager(lvm) is introduced. It can split a partition into several volumes.

First a partition is splitted into several physical volums (pv), and a physical volume is consists of several volume groups (vg), and each volume group consists of several logical volumes(lv).

Determine a partition is of lvm kind, use fdisk to print its type.

Check lvm status, using the commands: pvs, vgs, lvs.

Each logical volume has a filesystem managing files contained in it, check each fs type by:

fsck /dev/mapper/cl-home

If fs type is xfs, then the fs cannot be shrinked, and only can grow to a larger size.

To remove current logical volume:

umount /dev/mapper/cl-home
lvremove /dev/mapper/cl-home

To recreate a logical volume with given size:

lvcreate -L 4G -n home cl
mkfs.xfs /dev/mapper/cl-home
mount /dev/mapper/cl-home

Now that shrinked one partition, to grow another partition of xfs typed fs by:

lvextend -r -l 100%FREE /dev/mapper/cl-root

Check results: using lvs

猜你喜欢

转载自www.cnblogs.com/sansna/p/9095831.html
今日推荐