rhce 133
lvm逻辑卷管理器 考点
是一种把硬盘驱动器空间分配成逻辑卷的方法
这样硬盘就不需要分区 就可使用
物理卷无法跨越一个以上驱动器
物理卷被合并成逻辑卷 例外的是 /boot分区 不能位于逻辑卷 因为引导装载程序无法读取它
所以如果要把/分区方式逻辑卷上 需创建一个分开的/boot分区
物理卷
pvcreate 设备/dev/sdb1
vgcreate 卷组名 物理卷1,物理卷2
lvcreate -l le值 -n 逻辑卷名 卷组名
-L 大写指定size
调整逻辑卷大小
注:每次调整逻辑卷后切记调整文件系统大小
lvextend -L +**m 逻辑卷 lvreduce -L +|- **m 逻辑卷
常用用法:
减少:
[1]卸载
[2]lvresize 修改逻辑卷
[3]resize2fs 修改文件系统大小
[4]lvdisplay
ex:
[root@rac2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/lvm_disk/lvm_disks
VG Name lvm_disk
LV UUID c9vAHX-TvKA-e8az-KzFw-tbhL-jRhw-g7e1HH
LV Write Access read/write
LV Status available
# open 0
LV Size 160.00 MB
Current LE 40
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
[root@rac2 ~]# resize2fs /dev/lvm_disk/lvm_disks 80m
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/lvm_disk/lvm_disks to 81920 (1k) blocks.
The filesystem on /dev/lvm_disk/lvm_disks is now 81920 blocks long.
[root@rac2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/lvm_disk/lvm_disks
VG Name lvm_disk
LV UUID c9vAHX-TvKA-e8az-KzFw-tbhL-jRhw-g7e1HH
LV Write Access read/write
LV Status available
# open 0
LV Size 160.00 MB
Current LE 40
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
[root@rac2 ~]# lvresize -L 80m /dev/lvm_disk/lvm_disks
WARNING: Reducing active logical volume to 80.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvm_disks? [y/n]: y
Reducing logical volume lvm_disks to 80.00 MB
Logical volume lvm_disks successfully resized
[root@rac2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/lvm_disk/lvm_disks
VG Name lvm_disk
LV UUID c9vAHX-TvKA-e8az-KzFw-tbhL-jRhw-g7e1HH
LV Write Access read/write
LV Status available
# open 0
LV Size 80.00 MB
Current LE 20
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0
[root@rac2 ~]# e2fsck -f /dev/lvm_disk/lvm_disks
e2fsck 1.39 (29-May-2006)
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/lvm_disk/lvm_disks: 11/20480 files (9.1% non-contiguous), 8257/81920 blocks
扩展:
ex:
[root@rac2 ~]# lvresize -L 160m /dev/lvm_disk/lvm_disks
Extending logical volume lvm_disks to 160.00 MB
Logical volume lvm_disks successfully resized
[root@rac2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/lvm_disk/lvm_disks
VG Name lvm_disk
LV UUID c9vAHX-TvKA-e8az-KzFw-tbhL-jRhw-g7e1HH
LV Write Access read/write
LV Status available
# open 0
LV Size 160.00 MB
Current LE 40
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
[root@rac2 ~]# e2fsck /dev/lvm_disk/lvm_disks
e2fsck 1.39 (29-May-2006)
/dev/lvm_disk/lvm_disks: clean, 11/38912 files, 10579/155648 blocks
[root@rac2 ~]# e2fsck -f /dev/lvm_disk/lvm_disks
e2fsck 1.39 (29-May-2006)
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/lvm_disk/lvm_disks: 11/38912 files (9.1% non-contiguous), 10579/155648 blocks
[root@rac2 ~]# resize2fs /dev/lvm_disk/lvm_disks 160m
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/lvm_disk/lvm_disks to 163840 (1k) blocks.
The filesystem on /dev/lvm_disk/lvm_disks is now 163840 blocks long.
[root@rac2 ~]# e2fsck -f /dev/lvm_disk/lvm_disks
e2fsck 1.39 (29-May-2006)
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/lvm_disk/lvm_disks: 11/40960 files (9.1% non-contiguous), 10837/163840 blocks
excoption:
如果只修改逻辑卷 不改文件系统则会损坏硬盘
报错如下:
[root@rac2 ~]# e2fsck -f /dev/lvm_disk/lvm_disks
e2fsck 1.39 (29-May-2006)
The filesystem size (according to the superblock) is 188416 blocks
The physical size of the device is 155648 blocks
Either the superblock or the partition table is likely to be corrupt!
查看逻辑卷
lv display
每个步骤的查询都是**display
ex:
[root@rac2 ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdc1
VG Name lvm_disk
PV Size 95.98 MB / not usable 3.98 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 23
Free PE 23
Allocated PE 0
PV UUID gjfGRe-v1SF-AEAT-pPoU-ZQSW-D2Un-vGpfpY
--- Physical volume ---
PV Name /dev/sdc2
VG Name lvm_disk
PV Size 96.00 MB / not usable 4.00 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 23
Free PE 23
Allocated PE 0
PV UUID 81paIW-5lV8-4UmR-VzJq-bvnt-yHAx-5xqF8E
ex:
Logical volume "lvm_disks" created
[root@rac2 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/lvm_disk[卷组]/lvm_disks[逻辑卷]
VG Name lvm_disk
LV UUID c9vAHX-TvKA-e8az-KzFw-tbhL-jRhw-g7e1HH
LV Write Access read/write
LV Status available
# open 0
LV Size 184.00 MB
Current LE 46
Segments 2
Allocation inherit
Read ahead sectors 0
Block device 253:0
卸载 逻辑 卷组 物理卷
[1]卸载 逻辑卷
[2]lvremove 逻辑卷
[root@rac2 ~]# lvremove /dev/lvm_disk/lvm_disks
Do you really want to remove active logical volume "lvm_disks"? [y/n]: y
Logical volume "lvm_disks" successfully removed
remove后就找不到相应的目录
[3]vgremove 卷组名
[root@rac2 ~]# vgremove lvm_disk
/dev/cdrom: open failed: Read-only file system
Volume group "lvm_disk" successfully removed
[4]pvremove
防火墙
分高中无防火墙
iptables
service iptables start|stop|start|restart
ex:
[root@rac2 home]# service iptables status
Firewall is stopped.
安装过程中 窗口切换
alt + f1 安装对话框
alt + f2 一个bash
alt + f3 安装日志
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21993926/viewspace-671017/
,如需转载,请注明出处,否则将追究法律责任。