Oracle Linux Server 6.9下Oracle与ogg的挂载
准备工作:打开虚拟机端的Oracle Linux Server 6.9的系统,然后使用root用户登录。打开终端界面,输入ifconfig -a查看IP地址。
然后在本地打开XShell软件使用以下命令进入虚拟机的终端。
ssh [email protected]
192.168.91.129为自己的IP地址。
查看硬盘分区
[root@linuxidc ~]# fdisk -l
得到以下内容:其中/dev/sdb用来挂载oracle,/dev/sdc用来挂载ogg。
Disk /dev/sdc: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
第一步:创建物理空间,分别运行以下命令
1 [root@linuxidc ~]# pvcreate /dev/sdb
2 [root@linuxidc ~]# pvcreate /dev/sdc
运行pvdisplay查看创建是否成功
--- Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 80.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 20479
Free PE 0
Allocated PE 20479
PV UUID 68xjYx-EhLY-1W9m-2XJ9-FXJI-CnnM-5218YP
--- Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 80.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 20479
Free PE 0
Allocated PE 20479
PV UUID ddjPX3-t9dE-Z0XW-2cnF-Zd9E-1M6Q-zNAmoe
第二步:创建卷组,分别运行以下命令
1 [root@linuxidc ~]# vgcreate vg_oracle /dev/sdb
2 [root@linuxidc ~]# vgcreate vg_ogg /dev/sdc
运行vgdisplay查看创建是否成功
--- Volume group ---
VG Name vg_ogg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 80.00 GiB
PE Size 4.00 MiB
Total PE 20479
Alloc PE / Size 20479 / 80.00 GiB
Free PE / Size 0 / 0
VG UUID bv7LMk-cOzr-Phzu-VDe3-6odo-82Fs-WupLgs
--- Volume group ---
VG Name vg_oracle
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 80.00 GiB
PE Size 4.00 MiB
Total PE 20479
Alloc PE / Size 20479 / 80.00 GiB
Free PE / Size 0 / 0
VG UUID j4BdLM-Mdwf-D4m4-gKFD-rYi6-M5hD-Yc26SF
第三步:创建逻辑空间,运行以下命令
1 [root@linuxidc ~]# lvcreate -l 20479 vg_oracle -n lv_oracle
2 [root@linuxidc ~]# lvcreate -l 20479 vg_ogg -n lv_ogg
其中20479是vgdisplay查询下的Total PE的值,可以全部分配也可以部分分配。
运行lvdisplay查看是否创建成功
--- Logical volume ---
LV Path /dev/vg_ogg/lv_ogg
LV Name lv_ogg
VG Name vg_ogg
LV UUID du1GSY-44gc-3k2U-V7Ey-nk4p-GFqu-DbVSFx
LV Write Access read/write
LV Creation host, time linuxidc, 2019-03-18 09:31:31 +0800
LV Status available
# open 1
LV Size 80.00 GiB
Current LE 20479
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:2
--- Logical volume ---
LV Path /dev/vg_oracle/lv_oracle
LV Name lv_oracle
VG Name vg_oracle
LV UUID C2fO4y-AHhl-l7oI-MAo2-smXp-pmIw-kzhGA0
LV Write Access read/write
LV Creation host, time linuxidc, 2019-03-18 09:37:24 +0800
LV Status available
# open 1
LV Size 80.00 GiB
Current LE 20479
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:3
第四步:格式化创建好的磁盘,依次运行下列命令
1 [root@linuxidc ~]# mkfs.ext4 /dev/vg_oracle/lv_oracle
2 [root@linuxidc ~]# mkfs.ext4 /dev/vg_ogg/lv_ogg
至此,oracle和ogg的创建就完成了,下面开始挂载
第五步:创建/u01和/ogg空间,依次运行以下命令,在根目录下创建这两个文件夹。
1 [root@linuxidc ~]# mkdir /u01
2 [root@linuxidc ~]# mkdir /ogg
第六步:添加挂载信息并挂载lv,vi编辑fstab文件
[root@linuxidc ~]# vi /etc/fstab
在fstab文件中的最底部添加挂载信息
/dev/vg_oracle/lv_oracle /u01 ext4 defaults 1 3
/dev/vg_ogg/lv_ogg /ogg ext4 defaults 1 4
添加完后可以运行以下命令查看
[root@linuxidc ~]# cat /etc/fstab
会出现下列内容
#
# /etc/fstab
# Created by anaconda on Mon Mar 18 17:00:20 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_linuxidc-lv_root / ext4 defaults 1 1
UUID=af3104ec-a4cb-4c90-b406-70de3f6a2260 /boot ext4 defaults 1 2
/dev/mapper/vg_linuxidc-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_linuxidc-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vg_oracle/lv_oracle /u01 ext4 defaults 1 3
/dev/vg_ogg/lv_ogg /ogg ext4 defaults 1 4
然后开始挂载lv,运行下列命令,运行完后不会出现任何信息,代表挂载成功。
[root@linuxidc ~]# mount -a
查看挂载信息。
[root@linuxidc ~]# df -h
出现下列内容中含有oracle和ogg表示挂载成功
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_linuxidc-lv_root
50G 3.3G 44G 7% /
tmpfs 1.9G 76K 1.9G 1% /dev/shm
/dev/sda1 477M 85M 363M 19% /boot
/dev/mapper/vg_linuxidc-lv_home
26G 9.8G 15G 42% /home
/dev/mapper/vg_oracle-lv_oracle
79G 11G 64G 15% /u01
/dev/mapper/vg_ogg-lv_ogg
79G 285M 75G 1% /ogg
/dev/sr0 3.8G 3.8G 0 100% /media/OL6.9 x86_64 Disc 1 20170324
OK,Oracle和ogg挂载完毕!