中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Linux上關(guān)于raw device的使用方式

2019-08-01    來(lái)源:愛站科技

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬(wàn)Linux鏡像隨意使用

Linux上關(guān)于raw device的使用方式你了解多少呢?其實(shí)在Linux上使用raw device方式主要有兩種,不知道有多少朋友們了解呢?現(xiàn)在我們就去看看如何在Linux中使用rawdevice的內(nèi)容。

在Linux上使用raw device一般有兩個(gè)方式,下面分別測(cè)試一下:

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

一,創(chuàng)建分區(qū)
[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
在文件中加入如下內(nèi)容:
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
/dev/raw/raw3 /dev/sdb4
/dev/raw/raw4 /dev/sdb4
另執(zhí)行 /etc/init.d/rawdevices restart 使配置文件中的裸設(shè)備生效,執(zhí)行 /sbin/chkconfig rawdevices on 保證機(jī)器啟動(dòng)的時(shí)候裸設(shè)備能夠加載。

三,授權(quán)
[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
此時(shí),如綁定raw device,則默認(rèn)權(quán)限為oracle:dba了。
--另如需要可以進(jìn)行相應(yīng)鏈接,
如ln -s /dev/raw/raw1 /u1/oracle/oradata/test10g/test_raw1.dbf,然后可以直接為oracle所用了。


另一種是lvm的方式,測(cè)試如下:
一,創(chuàng)建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

二,創(chuàng)建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

三,創(chuàng)建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
后面授權(quán)等作業(yè)和第一種方式類同,上面要注意的是lv的命名方式,命名方式分解如下:
/dev/mapper/+ vgname + '-' +?

以上就是Linux上關(guān)于raw device的使用方式的全部?jī)?nèi)容,本文主要是為了方便初學(xué)者理解rawdevice的使用過(guò)程,切忌在生產(chǎn)環(huán)境中使用哦。

標(biāo)簽: Linux raw device

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:Linux實(shí)現(xiàn)redmine自動(dòng)啟動(dòng)的方法

下一篇:如何實(shí)現(xiàn)Linux和windows系統(tǒng)跨平臺(tái)恢復(fù)