资源预览内容
第1页 / 共12页
第2页 / 共12页
第3页 / 共12页
第4页 / 共12页
第5页 / 共12页
第6页 / 共12页
第7页 / 共12页
第8页 / 共12页
第9页 / 共12页
第10页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
linux 创建 lvm 裸设备下面是在虚拟机上添加一块新硬盘,并创建 lvm 裸设备给 oracle 使用的过程,和大家一起学习,有不正确的地方希望指导,谢谢。linux 系统是 AS4 update 7实验前,先了解一些基本概念,如下:LVM(Logicl Volume Manager),逻辑卷管理器,通过使用逻辑卷管理器对硬盘存储设备进行管理,可以实现硬盘空间的动态划分和调整。一、 基本概念1、 物理卷-PV(Physical Volume)物理卷在逻辑卷管理中处于最底层,它可以是实际物理硬盘上的分区,也可以是整个物理硬盘。2、 卷组-VG(Volumne Group)卷组建立在物理卷之上,一个卷组中至少要包括一个物理卷,在卷组建立之后可动态添加物理卷到卷组中。一个逻辑卷管理系统工程中可以只有一个卷组,也可以拥有多个卷组。3、 逻辑卷-LV(Logical Volume)逻辑卷建立在卷组之上,卷组中的未分配空间可以用于建立新的逻辑卷,逻辑卷建立后可以动态地扩展和缩小空间。系统中的多个逻辑卷可以属于同一个卷组,也可以属于不同的多个卷组。4、 物理区域-PE(Physical Extent)物理区域是物理卷中可用于分配的最小存储单元,物理区域的大小可根据实际情况在建立物理卷时指定。物理区域大小一旦确定将不能更改,同一卷组中的所有物理卷的物理区域大小需要一致。5、 逻辑区域LE(Logical Extent)逻辑区域是逻辑卷中可用于分配的最小存储单元,逻辑区域的大小取决于逻辑卷所在卷组中的物理区域的大小。6、 卷组描述区域-(Volume Group Descriptor Area)卷组描述区域存在于每个物理卷中,用于描述物理卷本身、物理卷所属卷组、卷组中的逻辑卷及逻辑卷中物理区域的分配等所有信息,卷组描述区域是在使用 pvcreate 建立物理卷时建立的。二、实战操作1.在虚拟机上添加一块硬盘,进入系统创建分区rootrles # fdisk -l -查看现在有分区Disk /dev/hda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/hda1 * 1 1912 15358108+ 83 Linux/dev/hda2 1913 2173 2096482+ 82 Linux swap/dev/hda3 2174 2610 3510202+ 83 LinuxDisk /dev/hdb: 2147 MB, 2147483648 bytes -可以看到这个设备还没有分区16 heads, 63 sectors/track, 4161 cylindersUnits = cylinders of 1008 * 512 = 516096 bytesDisk /dev/hdb doesnt contain a valid partition tablerootrles # df -hFilesystem Size Used Avail Use% Mounted on/dev/hda1 15G 7.5G 6.3G 55% /none 553M 0 553M 0% /dev/shm/dev/hda3 3.3G 98M 3.1G 4% /tmprootrles # rootrles # rootrles # rootrles # fdisk /dev/hdb -为设备分区,下面是分区的过程Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent wont be recoverable.The number of cylinders for this disk is set to 4161.There is nothing wrong with that, but this is larger than 1024,and could in certain setups cause problems with:1) software that runs at boot time (e.g., old versions of LILO)2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): mCommand actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partitionl list known partition typesm print this menun add a new partitiono create a new empty DOS partition tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partitions system idu change display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only)Command (m for help): l -输入字母 L 查看分区类型0 Empty 1e Hidden W95 FAT1 75 PC/IX be Solaris boot 1 FAT12 24 NEC DOS 80 Old Minix bf Solaris 2 XENIX root 39 Plan 9 81 Minix / old Lin c1 DRDOS/sec (FAT-3 XENIX usr 3c PartitionMagic 82 Linux swap c4 DRDOS/sec (FAT-4 FAT16 /dev/mapper/oradata-system01rootrles # rootrles # lvremove /dev/oradata/system01 -删除 lvDo you really want to remove active logical volume system01? y/n: yLogical volume system01 successfully removedrootrles # rootrles # ls -l /dev/oradata/ ls: /dev/oradata/: No such file or directoryrootrles # lvcreate -n system01 -L 2040M oradataLogical volume system01 createdrootrles # ls -l /dev/oradata/ total 0lrwxrwxrwx 1 root root 28 Jun 5 22:55 system01 - /dev/mapper/oradata-system01rootrles # rootrles # 5.绑定裸设备rootrles oradata# raw /dev/raw/raw1 /dev/mapper/oradata-system01 -注意,之前是没有/dev/raw 目录的,执行后会自动创建/dev/raw/raw1: bound to major 253, minor 0rootrles oradata# rootrles oradata# ls -l /oradata/total 4drwxr-xr-x 2 root root 4096 Jun 5 23:21 system01rootrles oradata# raw -qa -查询裸设备/dev/raw/raw1: bound to major 253, minor 06.为了保证重启后,可以挂载裸设备,修改下面文件,添加内容rootrles oradata# cat /etc/sysconfig/rawdevices # This file and interface are deprecated.# Applications needing raw device access should open regular# block devices with O_DIRECT.# raw device bindings# format: # # example: /dev/raw/raw1 /dev/sda1# /dev/raw/raw2 8 5/dev/raw/raw1 /dev/mapper/oradata-system017.重启裸设备服务,验证是否能挂载rootrles oradata# /etc/init.d/rawdevices restart -重启裸设备服务Assigning devices: /dev/raw/raw1 /dev/mapper/oradata-system01/dev/raw/raw1: bound to major 253, minor 0donerootrles oradata# rootrles oradata# ls -l /dev/mapper/total 0crw- 1 root root 10, 63 Jun 5 23:24 controlbrw-rw- 1 root disk 253, 0 Jun 5 23:24 oradata-system01rootrles oradata#
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号