LVM的应用

1.LVM的应用
问题
1)逻辑卷的管理
准备两个10GB的分区,建立卷组vgnsd
再准备一个10GB的分区,建立卷组vgdata
从卷组vgnsd中划出一个15GB的逻辑卷lvhome
从卷组vgdata中划出一个4GB的逻辑卷lvswap
2)逻辑卷的实际使用
将/home目录迁移到逻辑卷lvhome上
将逻辑卷lvswap扩展到交换空间
确保上述卷开机后自动挂载
方案
LVM是在Linux中特殊的磁盘卷,它可以整合多个小的磁盘或分区,并且空间能够实现伸缩。创建及使用LVM过程:创建PV --> 创建VG --> 创建LVM --> 格式化LVM --> mount。
用来管理LVM命令主要命令的语法:
pvcreate 设备名…
vgcreate 卷组名 物理卷…
lvcreate -L 大小 -n 逻辑卷名 卷组名
步骤
实现此案例需要按照如下步骤进行。
步骤一:逻辑卷的管理
准备两个10GB的分区,建立卷组vgnsd,命令操作如下所示:
[root@localhost /]# parted /dev/sdb print //输出sdb分区表
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system 标志
1 512B 1000MB 1000MB primary ext4
2 1000MB 2000MB 999MB primary ext4
3 2000MB 85.9GB 83.9GB extended lba
5 2001MB 3000MB 999MB logical

[root@localhost /]# parted /dev/sdb mktable gpt //将sdb分区方式更改为gpt
警告: 正在使用 /dev/sdb 上的分区。
忽略/Ignore/放弃/Cancel? i
警告: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
是/Yes/否/No? y
警告: WARNING: the kernel failed to re-read the partition table on /dev/sdb (设备或资源忙). As a result, it may not reflect all of your changes until after reboot.
[root@localhost /]# parted /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name 标志

[root@localhost /]# parted /dev/sdb mkpart primary 0 10G //划分10G分区
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? i
警告: WARNING: the kernel failed to re-read the partition table on /dev/sdb (设备或资源忙). As a
result, it may not reflect all of your changes until after reboot.
[root@localhost /]# parted /dev/sdb print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name 标志
1 17.4kB 10.0GB 10000MB primary

[root@localhost /]# parted /dev/sdb mkpart primary 10G 20G
警告: WARNING: the kernel failed to re-read the partition table on /dev/sdb (设备或资源忙). As a
result, it may not reflect all of your changes until after reboot.
[root@localhost /]# parted /dev/sdb mkpart primary 20G 30G
警告: WARNING: the kernel failed to re-read the partition table on /dev/sdb (设备或资源忙). As a
result, it may not reflect all of your changes until after reboot.
[root@

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值