在linux上使用raw device一般有两个方式,下面分别测试一下:

第一种方式是非lvm方式,直接使用partion方式如下:

一,创建分区

[root@localhost ~]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes

255 heads, 63 sectors/track, 1566 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

/dev/sda1   *           1          64      514048+ 83 Linux

/dev/sda2              65        1174     8916075   83 Linux

/dev/sda3            1175        1435     2096482+ 82 Linux swap

/dev/sda4            1436        1566     1052257+   5 Extended

/dev/sda5            1436        1566     1052226   83 Linux

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdc doesn't contain a valid partition table

[root@localhost oracle]# fdisk /dev/sdb

The number of cylinders for this disk is set to 1044.

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): m

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

l   list known partition types

m   print this menu

n   add a new partition

o   create a new empty DOS partition table

p   print the partition table

q   quit without saving changes

s   create a new empty Sun disklabel

t   change a partition's system id

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

Command (m for help): n p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-1044, default 1): 65

Last cylinder or +size or +sizeM or +sizeK (65-1044, default 1044):

Using default value 1044

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

/dev/sdb1              65        1044     7871850   83 Linux

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

/dev/sdb1              65        1044     7871850   83 Linux

Command (m for help): h

h: unknown command

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

l   list known partition types

m   print this menu

n   add a new partition

o   create a new empty DOS partition table

p   print the partition table

q   quit without saving changes

s   create a new empty Sun disklabel

t   change a partition's system id

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

Command (m for help): d

Selected partition 1

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

1 p

Partition number (1-4): 1

First cylinder (1-1044, default 1): 1

Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): 65

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

/dev/sdb1               1          65      522081   83 Linux

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 2

First cylinder (66-1044, default 66):

Using default value 66

Last cylinder or +size or +sizeM or +sizeK (66-1044, default 1044): 130

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

3

Invalid partition number for type `3'

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 3

First cylinder (131-1044, default 131):

Using default value 131

Last cylinder or +size or +sizeM or +sizeK (131-1044, default 1044): 196

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Selected partition 4

First cylinder (197-1044, default 197): 4

Value out of range.

First cylinder (197-1044, default 197):

Using default value 197

Last cylinder or +size or +sizeM or +sizeK (197-1044, default 1044): 262

Command (m for help): p

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System

/dev/sdb1               1          65      522081   83 Linux

/dev/sdb2              66         130      522112+ 83 Linux

/dev/sdb3             131         196      530145   83 Linux

/dev/sdb4             197         262      530145   83 Linux

二,绑定raw device

[root@localhost oracle]# raw /dev/raw/raw1 /dev/sdb1

/dev/raw/raw1: bound to major 8, minor 18

[root@localhost oracle]# raw /dev/raw/raw2 /dev/sdb2

/dev/raw/raw2: bound to major 8, minor 18

[root@localhost oracle]# raw /dev/raw/raw3 /dev/sdb3

/dev/raw/raw3: bound to major 8, minor 18

[root@localhost oracle]# raw /dev/raw/raw4 /dev/sdb4

/dev/raw/raw4: bound to major 8, minor 18

[root@localhost oracle]#vi /etc/sysconfig/rawdevices

在文件中加入如下内容:

/dev/raw/raw1 /dev/sdb1

/dev/raw/raw2 /dev/sdb2

/dev/raw/raw3 /dev/sdb4

/dev/raw/raw4 /dev/sdb4

另执行 /etc/init.d/rawdevices restart 使配置文件中的裸设备生效,执行 /sbin/chkconfig rawdevices on 保证机器启动的时候裸设备能够加载。

三,授权

[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw1

[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw2

[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw3

[root@localhost oracle]# chown -R oracle:dba /dev/raw/raw4

另修改配置文件/etc/udev/permissions.d/50-udev.permissions

注释掉raw/*:root:disk:0660,添加新行raw/*:oracle:dba:0660

此时,如绑定raw device,则默认权限为oracle:dba了。

--另如需要可以进行相应链接,

如ln -s /dev/raw/raw1 /u1/oracle/oradata/test10g/test_raw1.dbf,然后可以直接为oracle所用了。

另一种是lvm的方式,测试如下:

一,创建pv

[root@localhost ~]# pvcreate -M2 --metadatasize 100M /dev/sdb7 /dev/sdb8 /dev/sdb9 /dev/sdb10 /dev/sdc

Physical volume "/dev/sdb7" successfully created

Physical volume "/dev/sdb8" successfully created

Physical volume "/dev/sdb9" successfully created

Physical volume "/dev/sdb10" successfully created

Physical volume "/dev/sdc" successfully created

[root@localhost ~]# lvmdiskscan

/dev/ramdisk [       16.00 MB]

/dev/ram     [       16.00 MB]

/dev/sda1    [      502.00 MB]

/dev/ram2    [       16.00 MB]

/dev/root    [        8.50 GB]

/dev/ram3    [       16.00 MB]

/dev/sda3    [        2.00 GB]

/dev/ram4    [       16.00 MB]

/dev/ram5    [       16.00 MB]

/dev/sda5    [        1.00 GB]

/dev/ram6    [       16.00 MB]

/dev/ram7    [       16.00 MB]

/dev/ram8    [       16.00 MB]

/dev/ram9    [       16.00 MB]

/dev/ram10   [       16.00 MB]

/dev/ram11   [       16.00 MB]

/dev/ram12   [       16.00 MB]

/dev/ram13   [       16.00 MB]

/dev/ram14   [       16.00 MB]

/dev/ram15   [       16.00 MB]

/dev/sdb1    [      980.50 MB]

/dev/sdb2    [      980.53 MB]

/dev/sdb3    [        1.92 GB]

/dev/sdb5    [      509.84 MB]

/dev/sdb6    [      549.07 MB]

/dev/sdb7    [      509.84 MB] LVM physical volume

/dev/sdb8    [      509.84 MB] LVM physical volume

/dev/sdb9    [      549.07 MB] LVM physical volume

/dev/sdb10   [      627.51 MB] LVM physical volume

/dev/sdb11   [     1011.88 MB]

/dev/sdc     [        8.00 GB] LVM physical volume

3 disks

23 partitions

1 LVM physical volume whole disk

4 LVM physical volumes

二,创建vg

[root@localhost ~]# vgcreate vg_db1 /dev/sdc -s 128m

Volume group "vg_db1" successfully created

[root@localhost ~]# vgcreate vg_db2 /dev/sdc -s 128m

Volume group "vg_db2" successfully created

三,创建lv

[root@localhost ~]# lvcreate -L 512m -I 64k vg_db2 -n lv_db2_02

Ignoring stripesize argument with single stripe

Logical volume "lv_db2_02" created

[root@localhost ~]# lvcreate -L 1024m -I 64k vg_db2 -n lv_db2_03

Ignoring stripesize argument with single stripe

Logical volume "lv_db2_03" created

[root@localhost ~]# lvcreate -L 512m -I 64k vg_db2 -n lv_db2_04

Ignoring stripesize argument with single stripe

Logical volume "lv_db2_04" created

[root@localhost ~]# lvcreate -L 2048m -I 64k vg_db2 -n lv_db2_05

Ignoring stripesize argument with single stripe

Logical volume "lv_db2_05" created

四,绑定

[root@localhost ~]# raw /dev/raw/raw1 /dev/mapper/vg_db2-lv_db2_01

/dev/raw/raw4: bound to major 253, minor 5

[root@localhost ~]# raw /dev/raw/raw2 /dev/mapper/vg_db2-lv_db2_02

/dev/raw/raw4: bound to major 253, minor 5

[root@localhost ~]# raw /dev/raw/raw3 /dev/mapper/vg_db2-lv_db2_03

/dev/raw/raw4: bound to major 253, minor 5

[root@localhost ~]# raw /dev/raw/raw4 /dev/mapper/vg_db2-lv_db2_04

/dev/raw/raw4: bound to major 253, minor 5

后面授权等作业和第一种方式类同,上面要注意的是lv的命名方式,命名方式分解如下:

/dev/mapper/+ vgname + '-' + lvname.

linux raw 分区 读取,在linux上使用raw device方式相关推荐

  1. linux磁盘分区什么意思,linux 磁盘分区详解

    <linux 磁盘分区详解>由会员分享,可在线阅读,更多相关<linux 磁盘分区详解(31页珍藏版)>请在人人文库网上搜索. 1.系统引导过程和硬盘分区结构讨论作者:章节来源 ...

  2. linux中分区详细步骤,Linux下硬盘分区的具体步骤

    要掌握Linux硬盘的分区,就要知道MBR.扩展分区和逻辑分区的概念,linux分区不同于windows,linux下硬盘设备名为(IDE硬盘为hdx因为IDE硬盘最多四个,SCSI,SATA,USB ...

  3. linux引导分区是什么,Linux的引导过程剖析

    大家在安装完Linux后,有没有留心过Linux的引导过程呢?本文就尝试以通俗的语言来描述这一过程和相关的各种情况,了解了Linux的引导过程后,您在面对Linux引导过 程的出现的各种问题时就能做到 ...

  4. linux主分区移动挂载,Linux磁盘分区和挂载

    Linux磁盘分区和挂载 分区 分区的方式: mbr分区 最多支持4个主分区 系统只能安装到主分区上 扩展分区要占用一个主分区 MBR最大支持2TB,但拥有最好的兼容性 gtp分区 支持无线多个主分区 ...

  5. linux交换分区的目录,linux 下的交换分区及根目录

    linux下的分区情况 Linux下的交换分区 Linux系统中的Linux交换分区是当物理内存(RAM)被充满时,作为物理内存的缓存来使用.当系统需要更多的内存资源,而物理内存已经充满,内存中不活跃 ...

  6. linux查看分区访问权限,linux查看分区是否开启acl权限

    1.为什么需要ACL权限 ACL的全称是 Access Control List (访问控制列表) .对于文件或者目录,都有相应的操作权限 r(read 读),w(write 写),x(execute ...

  7. linux 优盘分区,怎么在Linux系统下使用NTFS的U盘或者是分区以及移动硬盘-使用工具NTFS-3G...

    注释:我们在Windows是的时候我们的所使用的系统是NTFS或者移动硬盘都是NTFS,但是在Linux系统下面NTFS的分区就不能直接使用,那我们想用的话怎么办? 现在我就教大家一个简单的方法让NT ...

  8. linux创建分区_在Linux中创建分区-分步指南

    linux创建分区 In this tutorial, we'll be covering the steps to create a partition in Linux. This can hel ...

  9. linux交换分区的命令,LInux下的交换分区以及相关查看命令

    linux下SWAP为交换分区,也就是虚拟内存: 当linux系统的物理内存不够的时候,就需要将物理内存中的一些东西释放出来,以供当前程序使用: 那些被释放的空间可能来自于一些很长没有什么操作的程序, ...

最新文章

  1. python输入两个数用逗号隔开如不是两个数报错_Python数据类型
  2. 纹理mag filter不能取GL_XXX_MIPMAP_XXXX
  3. url携带的参数获取并处理demo
  4. 科技文明等级那一级有量子计算机,人类科技在宇宙中属于几级文明,最高级文明多强?...
  5. 使用Spring AOP实现活动记录模式
  6. Android开发环境准备和常用命令总结
  7. (34)VHDL实现T触发器
  8. java 获取permgen_java - Java:如何检查当前的Perm / PermGen大小? - 堆栈内存溢出
  9. 数据窗口 label_Python实现数据可视化,让你的数据清晰起来!
  10. keil交通灯c语言,用Keilc软件设计一个交通灯程序C程序
  11. Java SSM开发大众点评后端 Mybatis实战商城项目
  12. 反恐精英online单机版有各种武器
  13. Android cpu降频工具,安卓手机CPU调频/调压工具_手机CPU管理 V16.6.9 安卓版
  14. [ROS Navigation Tuning Guide]翻译
  15. 大数据24小时:腾讯云在美新增两个数据中心,依图科技与华为合作发布人工智能一体机
  16. 哪款蓝牙耳机吃鸡没延迟?游戏蓝牙耳机推荐
  17. Windows图标-Icon文件格式分析
  18. Arch Linux上使用 pandoc 将 markdown 转为 pdf 以及如何查看本机的中文字体 fc-list :lang=zh
  19. python开发微信订阅号如何申请_基于Python的微信公众平台二次开发(Python常用框架、订阅号开发、公众号开发)...
  20. Python模拟轮盘抽奖游戏 轮盘分为三部分: 一等奖, 二等奖和三等奖;轮盘转的时候是随机的, 如果范围在[0,0.08)之间,代表一等奖,如果范围在[0.08,0.3)之间,代表2等奖, 如果范围

热门文章

  1. GOOGLE搜索秘籍全攻略
  2. 阿里云使用笔记-第六篇-CentOS搭建Sentry日志监控平台
  3. 上海交通大学计算机学院郑欣,上海交通大学计算机科学与工程系(CSE)
  4. “酒咔嚓”拟借大数据之船出海
  5. “618”电商众生相,商家选择平台时考虑的是什么?
  6. java多线程实验——元气骑士走迷宫
  7. 溯源flexible的成长
  8. Java实现合并排序(归并)详细代码
  9. WeiPHP5.0 前台任意文件读取
  10. php开发架构设计,基于php的快速搭建SPA开发架构的框架设计与开发