Linux Add a bare device

Source: Internet
Author: User

1, what bare equipment? Character device? Block device?

Bare devices: Also called bare partitions (raw partitions), is a special character device that is not formatted and is not unix/linux by the file system to read. A bare device, also called a bare partition (raw partition), is a special character device that is not formatted to be read by UNIX through the file system. It is the responsibility of the application to read and write to it. Not buffered by the file system. A bare device can bind to a partition or bind to a disk.
Character device: The read/write to the character device does not need to pass through the OS buffer. It cannot be mount by the file system.
Block device: Read and write to the block device through the OS buffer, it can be mount to the file system.

What are the benefits of using a bare device in Oracle?
Since the use of bare devices avoids the UNIX operating system layer, the data directly from disk to Oracle seamless transfer , so the use of bare devices for read-write frequent database applications, can greatly improve the performance of the database system, of course, this is the disk i/ o Very large, disk I/O has become a system bottleneck in the case of the ability, if the disk read and write is very frequent, so that the disk read and write become a system bottleneck, then the use of bare devices can really greatly improve performance, the maximum can even increase to 40%, very obvious. Moreover, because the original partition was used, the file system was not managed, and the cost of maintaining the FileSystem for Unix was lost. For example, there is no need to maintain i-node, idle blocks, etc., which can also lead to improved performance.



2. How many bare devices can a system have?
This is related to the Linux version, in the older version, there can be up to 256 bare devices, and Linux 4 can bind 8,192 bare devices.
However, under Linux, there can be up to 255 partitions, so if you are using a bare device to bind partitions, you can only bind up to 255 bare devices.
If you are using LVM, there is no such restriction.

3. How many partitions can a single disk in Linux have?
15 of them. 3 primary partitions + one extended partition + 11 logical partitions.
The recommended partitioning method is to divide 3 primary partitions, the fourth partition as an extended partition, and then divide the extended partition into 11 logical partitions.
Note that the bare device is not bound on the extended partition .

4. Do I need to bind bare devices under Linux? What about UNIX?
If you need to use a bare device under Linux, you need to bind it manually.
It is not used under UNIX.

Because every block device in Unix has a corresponding character device for non-cached (unbuffered) I/O, this is his corresponding bare device.
Linux Rawio implements a set of non-binding (unbound) bare devices/dev/rawn or/dev/raw/rawn and a control device/DEV/RAWCT used to bind them to a block device. So when a bare device needs to be used, it is necessary to match him with a real-life block device, which in fact completes the automatic correspondence of a non-cached character device in Unix.

5, how does Linux bind bare devices?
Two ways:
1) command binding
Raw/dev/raw/raw[n]/dev/xxx
where the range of n is 0-8191. If the raw directory does not exist, it will be created automatically.
Execute this command, a corresponding raw[n] file will be generated under/dev/raw
. Binding a bare device with a command is invalidated after the system restarts.

2) Modify the file
Modify the/etc/sysconfig/rawdevices file as follows to automatically load the bare device when booting, such as:
/dev/ RAW/RAW1/DEV/SDB1
This is a way to bind a bare device by starting the service.


6, how do I use a bare device as an Oracle data file? What do you need to be aware of?
1) Bind bare device
refer to
2 above) to change the raw device owner
Two methods:
to uninstall the command/etc/rc.local
chown oracle:oinstall/dev/raw/raw1
Modify/ The Etc/udev/permissions.d/50-udev.permissions file
/etc/udev/permissions.d/50-udev.permissions 113 lines
from the
raw/ *:root:disk:0660
Modified to
raw/*:oracle:oinstall:0660

This means modifying the default owner of a bare device to Oracle:oinstall, the default mode is 0660.

If you are using LVM, you also need to bind the logical volume to a bare device, and the procedure is similar to binding to a normal partition.

7, what do you need to be aware of when using a bare device as an Oracle data file?
data files using bare devices as Oracle must be aware of the following:
1) A bare device can only place one data file
2) The size of the data file cannot exceed the size of the bare device
If it is a log file, the maximum usable size of the bare device = the size of the bare device-1 * 512 (keep a redo lock)
If it is a data file, the maximum usable size of the bare device = size of the bare device-2 * db_block_size (two blocks)
for the sake of simplicity, all files are set to 1M smaller than bare devices.
3) The data file is best not set to scale automatically, if the settings are called auto-scaling, be sure to set the MAXSIZE setting to be smaller than the bare device

8. Is it possible to use logical volumes directly as Oracle data files?
Under Linux, Oracle cannot directly use logical volumes as bare devices or bind them. You don't need it under UNIX.

9, how to know what is currently tied to the bare device?
The RQW-QA command lists all the bare devices that are currently bound.

10, how to know the size of a bare device
The more stupid way is to find out that the bare device corresponds to the actual block device, and then use Fdisk-l/dev/[h,s]dxn look at the size of the piece of equipment is good.
The simpler approach is to use the Blockdev command to calculate, such as:
#blockdev--GETSIZE/DEV/RAW/RAW1
11718750
11718750 indicates how many OS Bliock are there.
Typically an OS block size is 512 bytes, so 11718750*512/1024/1024/1024 = 5722 (M) is the size of the bare device.

11. Can files and raw devices be used as data files in the database?
OK. Even in the same table space, you can also part of the data file with the file system, some files with bare devices.
However, this is not recommended because it increases the complexity of management.

12. Can you set the data file for the bare device to be expanded automatically?
Yes, but set maxsize at the same time, and maxsize cannot exceed: Bare Device Size-2*db_block_size

13. How to modify the default permissions for bare devices
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
For
raw/*:root:oinstall:0660

That's it!


14, how to cancel the binding of the bare device
Using raw to set major and minor to 0 can cancel the binding of the bare device. Such as:
RAW/DEV/RAW/RAW1 0 0
This command cancels binding of the bare device,/DEV/RAW/RAW1 will be deleted

15. What can an object that the bare device can bind to?
You can bind a whole disk without partitions, a partition that can bind a hard disk, a logical volume, and so on.

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.