标签:current 存储介质 cti count files 5.0 修改 cat ted
LVM是逻辑盘卷管理(LogicalVolumeManager)物理卷(Physical Volume,PV)
指磁盘分区或从逻辑上与磁盘分区具有同样功能的设备(如RAID),是LVM的基本存储逻辑块,但和基本的物理存储介质(如分区、磁盘等)比较,却包含有与LVM相关的管理参数。
卷组(Volume Group,VG)
类似于非LVM系统中的物理磁盘,其由一个或多个物理卷PV组成。可以在卷组上创建一个或多个LV(逻辑卷)。
逻辑卷(Logical Volume,LV)
类似于非LVM系统中的磁盘分区,逻辑卷建立在卷组VG之上。在逻辑卷LV之上可以建立文件系统(比如/home或者/usr等)。
物理块(Physical Extent,PE)
每一个物理卷PV被划分为称为PE(Physical Extents)的基本单元,具有唯一编号的PE是可以被LVM寻址的最小单元。PE的大小是可配置的,默认为4MB。所以物理卷(PV)由大小等同的基本单元PE组成。
*逻辑块(Logical Extent,LE)
LVM抽象模型
LVM抽象模型
逻辑卷LV也被划分为可被寻址的基本单位,称为LE。在同一个卷组中,LE的大小和PE是相同的,并且一一对应。
创建物理卷PV(Physical Volumes)
pvcreate /dev/sd{b,c}
创建卷组VG(Volume Groups)
vgcreate myvg /dev/sd{b,c}
创建逻辑卷LV(Logical Volumes)
lvcreate -L 5G -n lv myvg
格式化
mkfs.ext4 /dev/mapper/myvg-lv
挂载
mount /dev/mapper/myvg-lv /mnt
LV扩展逻辑卷
物理边界
lvextend -L +10G /dev/myvg/lv
Size of logical volume myvg/lv changed from 5.00 GiB (1280 extents) to 15.00 GiB (3840 extents).
Logical volume myvg/lv successfully resized.
逻辑边界
resize2fs /dev/myvg/lv 25G
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/myvg/lv to 6553600 (4k) blocks.
The filesystem on /dev/myvg/lv is now 6553600 blocks long.
LV缩减逻辑卷
卸载
umount /mnt
强行检查
e2fsck -f /dev/mapper/myvg-lv
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/myvg-lv: 11/1638400 files (0.0% non-contiguous), 146882/6553600 blocks
逻辑编辑缩减
resize2fs /dev/mapper/myvg-lv 10G
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/mapper/myvg-lv to 2621440 (4k) blocks.
The filesystem on /dev/mapper/myvg-lv is now 2621440 blocks long.
物理边界缩减
lvreduce /dev/myvg/lv -L 10G
WARNING: Reducing active logical volume to 10.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce myvg/lv? [y/n]: y
Size of logical volume myvg/lv changed from 25.00 GiB (6400 extents) to 10.00 GiB (2560 extents).
Logical volume myvg/lv successfully resized.
创建快照
-s 关键选项,创建快照snap的意思
-l 后面跟快照包含多少个PE的数量
-n 后面跟创建的快照的名字
-p r 由于快照大多为只读,改选项为为修改权限位只读(r)
lvcreate -L 10G -n myvg-lv-snap -s -p r /dev/mapper/myvg-lv
挂载lv的快照
mount /dev/mapper/myvg-myvg--lv--snap /media/
查看新创建的快照区
lvdisplay /dev/myvg/myvg-lv-snap
LV Path /dev/myvg/myvg-lv-snap
LV Name myvg-lv-snap
VG Name myvg
LV UUID AGIXY8-ok2R-ekT9-2o53-gFGD-uz4B-EwlDL1
LV Write Access read only
LV Creation host, time node.tclking.com, 2019-01-02 17:03:47 +0800
LV snapshot status active destination for lv
LV Status available
open 1
LV Size 10.00 GiB
Current LE 2560
COW-table size 10.00 GiB
COW-table LE 2560
Allocated to snapshot 0.01%
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
标签:current 存储介质 cti count files 5.0 修改 cat ted
原文地址:http://blog.51cto.com/14074807/2338125