parted 分区及LVM挂载(BASE ON SUSE Enterpres 11 SP4)
Posted chenfuhai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了parted 分区及LVM挂载(BASE ON SUSE Enterpres 11 SP4)相关的知识,希望对你有一定的参考价值。
#创建gpt分区表
parted /dev/sdb mklabel gpt
#创建新分区sdb1、sdb2、sdb3
parted /dev/sdb mkpart sdb1 ext3 1G 350G
parted /dev/sdb mkpart sdb2 ext3 351G 700G
parted /dev/sdb mkpart sdb3 ext3 701G 950G
#创建物理卷(可以是整个硬盘、也可以是单个分区)
linux-le62:~ # pvcreate /dev/sdb{1,2,3}
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb2" successfully created
Physical volume "/dev/sdb3" successfully created
#创建卷组vgbels
linux-le62:~ # vgcreate vgbels /dev/sdb{1,2,3}
Volume group "vgbels" successfully created
#创建逻辑卷data、bels、mosdb
lvcreate -L 300G -n data vgbels
lvcreate -L 300G -n bels vgbels
lvcreate -L 200G -n mosdb vgbels
#格式化逻辑卷data、bels、mosdb
linux-le62:~ # mkfs.ext3 /dev/vgbels/data
linux-le62:~ # mkfs.ext3 /dev/vgbels/bels
linux-le62:~ # mkfs.ext3 /dev/vgbels/mosdb
#编辑 vim /etc/fstab,实现开机自动挂载/etc/fstab,实现开机自动挂载
在最后加入以下内容:
/dev/vgbels/data /data ext3 defaults 0 0
/dev/vgbels/bels /bels ext3 defaults 0 0
/dev/vgbels/mosdb /mosdb ext3 defaults 0 0
#挂载所有
linux-le62:~ # mount -a
#查看挂载结果
linux-le62:~ # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-root 9.9G 4.7G 4.7G 50% /
udev 253G 212K 253G 1% /dev
tmpfs 253G 80K 253G 1% /dev/shm
/dev/mapper/system-boot 1008M 67M 891M 7% /boot
/dev/sda1 157M 14M 144M 9% /boot/efi
/dev/mapper/system-home 350G 195M 332G 1% /home
/dev/mapper/vgbels-data 296G 191M 281G 1% /data
/dev/mapper/vgbels-bels 296G 191M 281G 1% /bels
/dev/mapper/vgbels-mosdb 197G 188M 187G 1% /mosdb
# 查看LVM相关信息
[root@devstack ~]# pvdisplay
[root@devstack ~]# vgdisplay
[root@devstack ~]# lvdisplay
# 删除LVM
删除LV
[root@devstack ~]# lvremove /dev/mapper/vgbels-data
[root@devstack ~]# lvremove /dev/mapper/vgbels-bels
[root@devstack ~]# lvremove /dev/mapper/vgbels-mosdb
删除vg
[root@devstack ~]# vgremove /dev/mapper/vgbels
删除pv
pvremove /etc/sdb{1,2,3}
以上是关于parted 分区及LVM挂载(BASE ON SUSE Enterpres 11 SP4)的主要内容,如果未能解决你的问题,请参考以下文章