suse上LVM管理

本文发布时间: 2019-Mar-22
1.查看当前磁盘情况。[root@Linux-entx64-T-193:~]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 1 262 2104483+ 82 Linux swap / Solaris/dev/sda2 * 263 2610 18860310 83 LinuxDisk /dev/sdb: 53.6 GB, 53687091200 bytes255 heads, 63 sectors/track, 6527 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdb doesn't contain a valid partition tableDisk /dev/sdc: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdc doesn't contain a valid partition table2.建立VG出错,如下:[root@Linux-entx64-T-193:~]# vgcreate ora_vg1 /dev/sdb No physical volume label read from /dev/sdb /dev/sdb not identified as an existing physical volume Unable to add physical volume '/dev/sdb' to volume group 'ora_vg1'.3.查看PV情况,先建立物理卷,下一步才能建立VG[root@Linux-entx64-T-193:~]# pvdisplay显示为空4.开始建立PV[root@Linux-entx64-T-193:~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created[root@Linux-entx64-T-193:~]# pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created5.显示建立好的PV[root@Linux-entx64-T-193:~]# pvdisplay --- NEW Physical volume --- PV Name /dev/sdb VG Name PV Size 50.00 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID 1HBuIT-0aUJ-F76O-DFro-eYi8-iWk8-qmSYOE --- NEW Physical volume --- PV Name /dev/sdc VG Name PV Size 60.00 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID e7QuCk-YH4F-FDsS-MA6p-I6CJ-rvbc-nqO0jW6.开始建立VG[root@Linux-entx64-T-193:~]# vgcreate ora_vg1 /dev/sdb Volume group "ora_vg1" successfully created[root@Linux-entx64-T-193:~]# vgcreate oradata_vg2 /dev/sdc Volume group "oradata_vg2" successfully created7.显示建立的VG[root@Linux-entx64-T-193:~]# vgdisplay --- Volume group --- VG Name oradata_vg2 System ID Format lvm2 Metadata Areas 1 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 1 Act PV 1 VG Size 60.00 GB PE Size 4.00 MB Total PE 15359 Alloc PE / Size 0 / 0 Free PE / Size 15359 / 60.00 GB VG UUID 1SRrSB-3tlO-m1JX-Sief-CRUW-NRUz-EHUU3T --- Volume group --- VG Name ora_vg1 System ID Format lvm2 Metadata Areas 1 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 1 Act PV 1 VG Size 50.00 GB PE Size 4.00 MB Total PE 12799 Alloc PE / Size 0 / 0 Free PE / Size 12799 / 50.00 GB VG UUID U42e6b-ml8p-YgiJ-h1lH-eqoy-zWeo-3nodPX8.建立LV[root@Linux-entx64-T-194:~]# lvcreate -L 200M -n lv-vote oradata_vg2Logical volume "lv-vote" created9显示建立的LV[root@Linux-entx64-T-193:~]# lvdisplay --- Logical volume --- LV Name /dev/oradata_vg2/lv-vote VG Name oradata_vg2 LV UUID CdwuvX-0Oes-sdUr-NWTO-see9-PAMt-3jYpYP LV Write Access read/write LV Status NOT available LV Size 200.00 MB Current LE 50 Segments 1 Allocation inherit Read ahead sectors 0关于/dev目录下的显示问题:1.建立PV和VG在/dev目录不能查找设备2.当建立完LV后,会生成一个目录名为VG名称的目录,里面包含LV[root@Linux-entx64-T-193:/dev]# lvcreate -L 200M -n crs oradata_vg2 Logical volume "crs" created如下所示:删除LV[root@Linux-entx64-T-193:~]# lvremove /dev/oradata_vg2/lv-voteDo you really want to remove active logical volume "lv-vote"? [y/n]: y Logical volume "lv-vote" successfully removed[root@Linux-entx64-T-193:~]# lvremove /dev/oradata_vg2/crsDo you really want to remove active logical volume "crs"? [y/n]: y Logical volume "crs" successfully removed如果要一次删除所有在vg里面的LV,可以使用下面方法:[root@Linux-entx64-T-193:~]# lvremove oradata_vg2直接指定VG的名称,即可删除该VG的所有LV删除VG[root@Linux-entx64-T-193:/dev]# vgremove oradata_vg2 Volume group "oradata_vg2" successfully removed请确保该VG里的LV己全部删除,再执行以上操作删除PV[root@Linux-entx64-T-193:/dev]# pvremove /dev/sdc Labels on physical volume "/dev/sdc" successfully wiped请确保该PV里己经没有VG,否则会报以下错误:Can't pvremove physical volume "/dev/sdb" of volume group "ora_vg1" without -ff


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表