Collection of bare Devices

Source: Internet
Author: User

 

 

Bind a bare Device
Raw/dev/raw/dev/
Delete a bare Device
Raw/dev/raw 0 0
For example, raw/dev/raw/raw1 0 0 is used to delete the raw device/dev/raw/raw1.
1. What bare devices? Character device? Block device?
Bare device: it is also called a raw partition. It is a special character device that is not formatted and not read by Unix/Linux Through the file system. A bare device can be bound to either a partition or a disk.
Character device: the read/write operations on character devices do not need to pass the OS buffer. It cannot be mounted by the file system.
Block devices: Read and Write Block devices through the OS buffer, which can be mounted to the file system.
2. How many bare devices can a system have?
This is related to the Linux version. in earlier versions, there can be up to 256 bare devices. In Linux 4, you can bind up to 8192 bare devices.
However, in Linux, a maximum of 255 partitions are allowed. Therefore, if you bind a partition to a bare device, you can only bind up to 255 bare devices.
If LVM is used, there is no such restriction.
3. How many partitions can a disk be placed on Linux?
15. 3 primary partitions + 1 extended partition + 11 logical partitions.
The recommended partitioning method is: divide the partition into three primary partitions, the fourth partition into extended partitions, and then divide the partition into 11 logical partitions.
Note: do not bind the bare device to the extended partition.
4. Do I need to bind a bare device in Linux? What about UNIX?
In Linux, You need to manually bind a bare device.
In UNIX.
In UNIX, each block device has a corresponding character device for non-cached (unbuffered) I/O, which is the corresponding bare device.
In Linux, rawio implements a set of unbound) /dev/rawn or/dev/raw/rawn and a control device/dev/rawct are used to bind them to block devices. So when you need to use a bare device, you need to match it with a real block device, in fact, this step automatically corresponds to a non-Cache character device in UNIX.
5. How to bind a bare device to Linux?
Two methods:
1) command binding
Raw/dev/raw/Raw [N]/dev/xxx
The range of N is 0-8191. The raw directory does not exist and can be created.
Run this command to generate a corresponding raw [N] File under/dev/raw.
Binding a bare device by command will become invalid after the system is restarted.
2) modify the file
Modify the/etc/sysconfig/rawdevices file as follows to automatically load the bare device upon startup, such:
/Dev/raw/raw1/dev/sdb1
In this way, you can bind a bare device by starting the service.
You can also write this command on/etc/rc. Local to execute these commands at each startup.
6. How to Use bare devices as Oracle data files? What do you need to pay attention?
1) bind a bare Device
Refer to the above
2) Change the owner of the bare Device
Two methods:
. Uninstall the command/etc/rc. Local.
Chown ORACLE: oinstall/dev/raw/raw1
. Modify the/etc/udev/permissions. d/50-udev.permissions File
Set/etc/udev/permissions. d/50-udev.permissions to row 113
Slave
Raw/*: Root: Disk: 0660
Change
Raw/*: oracle: oinstall: 0660
This means that the default owner of the bare device is Oracle: oinstall, and the default mode is 0660.
If you use LVM, you also need to bind the logical volume to the bare device. The process is similar to binding to a common partition.
7. What should I pay attention to when using bare devices as Oracle data files?
Note the following when using bare devices as Oracle data files:
1) only one data file can be placed on a bare device.
2) the data file size cannot exceed the size of the bare Device
If it is a log file, the maximum available size of the raw device is-1*512 (keep a redo lock) for the raw device)
If it is a data file, the maximum available size of the bare device = the partition size of the bare device-2 * db_block_size (retain two blocks)
For the sake of simplicity, all files can be set to 1 MB smaller than bare devices.
3) it is recommended that you do not set Automatic scaling for data files. If you set Automatic scaling for data files, you must set maxsize to a smaller value than that for bare devices.
8. Can I directly use a logical volume as an ORACLE data file?
In Linux, Oracle cannot directly use logical volumes as bare devices. It is not required in UNIX.
9. How do I know what bare devices are currently bound?
The rqw-Qa command lists all the currently bound bare devices.
10. How to know the size of a bare Device
The stupid way is to find out the actual block device corresponding to the bare device, and then use fdisk-L/dev/[H, s] Check the size of the device.
A simple method is to use the blockdev command for calculation, such:
# Blockdev -- getsize/dev/raw/raw1
11718750
11718750 indicates the number of operating systems bliock.
Generally, the size of an OS block is 512 bytes, so 11718750*512/1024/1024/1024 = 5722 (m) is the size of the bare device.
11. Can files and bare devices be used as data files in the database?
Yes. Even in the same tablespace, some data files can be used as file systems, and some files are used as bare devices.
However, we do not recommend that you do this because it will increase the management complexity.
12. Can I set the data files of bare devices to auto scaling?
Yes, but you must set maxsize at the same time, and maxsize cannot exceed: bare device size-2 * db_block_size
13. How to modify the default permissions of a bare Device
Two methods:
1) to modify the/etc/rc. d/rc. Local file, add the following:
Chown root: oinstall/dev/raw/raw1
Chown root: oinstall/dev/raw/raw2
Chown root: oinstall/dev/raw/raw3
...
Chmod 660/dev/raw/raw1
Chmod 660/dev/raw/raw2
Chmod 660/dev/raw/raw3
...
2) there is actually a simpler way to modify the/etc/udev/permissions. d/50-udev.permissions file:
Raw/*: Root: Disk: 0660
Is
Raw/*: Root: oinstall: 0660
That's all!
14. How to unbind a bare Device
You can use raw to set major and minor to 0 to unbind the bare device. For example:
Raw/dev/raw/raw1 0 0
This command unbinds a bare device./dev/raw/raw1 will be deleted.
15. What objects can a bare device bind?
You can bind a hard disk with no partitions, a partition of the hard disk, and a logical volume.

 

 

 

Bare device favorites
1. fdisk-l view each partition
2. Run DF-lH to check the usage of each region.
3. fdisk/dev/SDA
1. N (new)
2. n
3. W (write)
4. Raw/dev/raw/raw1/dev/sda8
Raw/dev/raw/raw2/dev/sda9

5. Modify VI/etc/sysconfig/rawdevices as follows:
Join
/Dev/raw/raw1/dev/sda8
/Dev/raw/raw2/dev/sda9

6. Grant liefdiy users the permission to change the bare device:
Chown-r liefdiy: liefdiy/dev/raw
Chmod-r 660/dev/raw

7. Bind is required because the system bare device is no longer available after restart.
In the/etc/raw or/etc/sysconfig/rawdevices file, associate the bare device with the corresponding partition.
For example, if SuSE is in the/etc/raw file, enter
Raw1: vgsys/lvraw1
Raw2: vgsys/lvraw2
In RedHat,/etc/sysconfig/rawdevices
/Dev/raw/raw1/dev/vgsys/lvraw1
/Dev/raw/raw2/dev/vgsys/lvraw2

The important step is to change the permission of the bare device. Whoever uses the bare device will grant the permission to whom.
Example: chown workusr: workusr/dev/raw-R
Chmod 660/dev/raw-R
These commands are added together to the startup configuration file, generally/etc/rc. Local, or/etc/rc. d/rc. Local.
Opensuse is/etc/init. d/boot. Local.

Delete a bare Device
# Raw/dev/raw/raw1 0 0
# Raw/dev/raw/raw2 0 0

Querying bare Devices
# Raw-Qa

Enable bare device service
# Chkconfig -- list | grep raw
# Chkconfig -- level 2 raw on
# Service rawdevices start

-------------------------------------------------

Bare Oracle Devices
Create a bare device in Linux:

I have never found a method for creating bare devices in Linux. I thought that the LV was created, and it was actually a bare device. I didn't need to do anything else. Later I created a library in Oracle.

When, do not recognize LV.

On Aix, the LV is a bare device, but on Linux, You need to bind it with the raw command. For example:

Use fdisk to create a partition/dev/sdb1

Then bind it with raw, raw/dev/raw/raw1/dev/sdb1

After binding, a file/dev/raw/raw1 is generated to record the bound information. If you do not want to delete the file directly, you can.

However, this file does not exist after OS reboot. Therefore, you need to record raw information to the/etc/sysconfig/rawdevices file.

The raw information can be retained after restart.

Format:/dev/raw/raw1/dev/sdb1

If the LV is created, it is also possible to bind the LV with raw.

Linux LVM raw devices are generally used as follows:
1. Use fdisk to separate an LVM. The size is 10 GB and the device file is/dev/CCISS/c0d0p8.
2. Create PV pvcreate/dev/CCISS/c0d0p8
3. Create VG vgcreate oradata/dev/CCISS/c0d0p8
4. Create LV lvcreate-N system01-l 300 m oradata
5. Create LV lvcreate-N undo01-l 500 m oradata
6. Create LV lvcreate-N temp01-L 200 m oradata
7. Create LV ........ (Including redofile and control file)
8. Add the following content to-/etc/sysconfig/rawdevices:
/Dev/raw/raw25/dev/oradata/system01
/Dev/raw/raw26/dev/oradata/temp01
/Dev/raw/raw27/dev/oradata/undo01
.....

9. edit/etc/rc. Local
Ln-S/dev/raw/raw25/oradata/system01.dbf
Ln-S/dev/raw/raw26/oradata/temp01.dbf
Ln-S/dev/raw/raw27/oradata/undo01.dbf
.....

10. VI $ ORACLE_HOME/dbca_raw_config
System01 =/oradata/system01.dbf
Temp01 =/oradata/temp01.dbf
Undotbs01 =/oradata/undo01.dbf

 

 

 

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/zhouooooo/archive/2009/10/01/4625141.aspx

And http://linux.chinaunix.net/bbs/thread-1041507-1-1.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.