标签:lvm
lvm讲解设备 Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 8e Linux LVM
/dev/sdb2 2099200 4196351 1048576 8e Linux LVM
/dev/sdb3 4196352 6293503 1048576 8e Linux LVM
用yum provides ”/*/pvcreate“命令查找lvm包,yum install -y lvm2安装
- 可以用partprobe命令生成/dev/sdb1文件
- 使用pvreate /dev/sdb1 命令分别创建三个物理卷
[root@aminglinux-02 ~]# pvcreate /dev/sdb1 WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y Wiping ext4 signature on /dev/sdb1. Physical volume “/dev/sdb1” successfully created. [root@aminglinux-02 ~]# pvcreate /dev/sdb2 Physical volume ”/dev/sdb2“ successfully created. [root@aminglinux-02 ~]# pvcreate /dev/sdb3 WARNING: dos signature detected on /dev/sdb3 at offset 510. Wipe it? [y/n]: y Wiping dos signature on /dev/sdb3. Physical volume “/dev/sdb3” successfully created.
- 使用pvdisplay查看系统中的物理卷
[root@aminglinux-02 ~]# pvdisplay ”/dev/sdb1“ is a new physical volume of ”1.00 GiB“ --- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 1.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID qrwO8j-8kOv-OfEh-bNed-9TcG-5Qyq-scRpyb “/dev/sdb2” is a new physical volume of “1.00 GiB” --- NEW Physical volume --- PV Name /dev/sdb2 VG Name PV Size 1.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID hPPtFs-Dfmo-zrnZ-mYUA-41Sy-wgfy-Zz0M4P “/dev/sdb3” is a new physical volume of “1.00 GiB” --- NEW Physical volume --- PV Name /dev/sdb3 VG Name PV Size 1.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID HrV293-eP3T-YJTM-vakP-eKXR-ykLg-xoFq66
- pvs查看物理卷
[root@aminglinux-02 ~]# pvs PV VG Fmt Attr PSize PFree /dev/sdb1 lvm2 --- 1.00g 1.00g /dev/sdb2 lvm2 --- 1.00g 1.00g /dev/sdb3 lvm2 --- 1.00g 1.00g
[root@aminglinux-02 ~]# vgcreate vg1 /dev/sdb1 /dev/sdb2
Volume group ”vg1“ successfully created
[root@aminglinux-02 ~]# vgdisplay
--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.99 GiB
PE Size 4.00 MiB
Total PE 510
Alloc PE / Size 0 / 0
Free PE / Size 510 / 1.99 GiB
VG UUID ufmtbK-zC4s-wsL2-mBEP-HlMy-Vg2Q-dPnkgV
[root@aminglinux-02 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg1 2 0 0 wz--n- 1.99g 1.99g
[root@aminglinux-02 ~]#
[root@aminglinux-02 ~]# lvcreate -L 100M -n lv1 vg1
Logical volume ”lv1“ created.
[root@aminglinux-02 ~]# mount /dev/vg1/lv1 /mnt/
[root@aminglinux-02 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda3 28G 1.2G 27G 5% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 493M 0 493M 0% /dev/shm
tmpfs 493M 6.8M 486M 2% /run
tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/sda1 197M 109M 88M 56% /boot
tmpfs 99M 0 99M 0% /run/user/0
/dev/mapper/vg1-lv1 93M 1.6M 85M 2% /mnt
[root@aminglinux-02 ~]# lvresize -L 200M /dev/vg1/lv1
Size of logical volume vg1/lv1 changed from 100.00 MiB (25 extents) to 200.00 MiB (50 extents).
Logical volume vg1/lv1 successfully resized.
[root@aminglinux-02 ~]# e2fsck -f /dev/vg1/lv1
e2fsck 1.42.9 (28-Dec-2013)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/vg1/lv1: 11/25688 files (9.1% non-contiguous), 8896/102400 blocks
root@aminglinux-02 ~]# resize2fs /dev/vg1/lv1
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/vg1/lv1 to 204800 (1k) blocks.
The filesystem on /dev/vg1/lv1 is now 204800 blocks long.
标签:lvm
原文地址:http://blog.51cto.com/akui2521/2097224