Character devices, block devices, raw devices, raw devices

Source: Internet
Author: User

First, a character device is a device, such as a keyboard, printer, that is transmitted as a character in the I/O transfer process. Note that the character unit does not necessarily imply a byte, because some encoding rules specify that 1 characters are 16 bits and 2 bytes.
In Unix systems, character devices occupy positions in the file directory tree in a special file and have corresponding I nodes. The file type in the I node indicates that the file is a character device file. You can use the same file manipulation commands as normal files to manipulate character device files, such as opening, closing, reading, writing, and so on.
When a character device is connected to the host on the hardware, you must create a character special file for this device. The Mknod command for the operating system is used to create device-specific files. For example, create a command named/dev/tty03 for a terminal as follows (set the main device number is 2, the secondary device is 13, and the character type is labeled C):
MKNOD/DEV/TTY03 C 2 13
After that, open, close, read, write and other system calls apply to device file/DEV/TTY03.
The way the device communicates with the driver depends on the hardware interface. When the data transfer on the device is complete, the hardware sends an interrupt signal through the bus causing the system to execute an interrupt handler. The interrupt handler works in conjunction with the device driver to complete the underlying control of the data transfer.
Second, the bare device, also known as the raw partition, is a special character device that is not formatted and is not read by UNIX through the file system. This article collects the bare devices and Oracle Quiz 20 cases.
1. What is called a bare device.
A bare device, also called a bare partition (raw partition), is a special character device that is not formatted and is not read by UNIX through a file system. It is the responsibility of the application to read and write it. Does not pass the file system buffer.
2. How to identify the bare devices.
In the Unix/dev directory, there are a number of files, including two large classes: Character device files and block device files.
Character device special files I/O operations do not go through the operating system's buffer, and the block device special files are used for fixed-length packet transmission with the peripherals. Character special files and peripherals for I/O operations, each time only transfer one
Characters. And for the block device special file, it uses the cache mechanism, between the peripheral and memory can transmit a whole block of data. The bare devices use character special files. In/dev
directory, you can see many of these files.
3. Benefits of using bare devices
Because the use of bare devices to avoid another layer of UNIX operating system, data directly from disk to Oracle transmission, so the use of raw devices for read and write frequent database applications, can greatly
To improve the performance of the database system. Of course, this is with disk I/O
Very large, disk I/O is already known as a system bottleneck in the case of the establishment. If disk reads and writes are very frequent, so that disk reads and writes become a system bottleneck, then using a bare device can actually greatly improve
Performance, the maximum can even be raised to 40%, very obvious.
Moreover, because the use of the original partition, no file system management, for UNIX maintenance of the file system is not the cost, such as no longer maintain i-node, free block, etc., which can also lead to improved performance.
4. How to decide if you should use a bare device.
To determine whether to use a bare device is to consider the following: first, the database system itself needs to have been better optimized. Optimization is a very technical topic, it is difficult to simply tell. Second, use
Unix command to identify disk read/write bottlenecks. Like the Vmstat of Unix, SAR.
Such commands can be better to identify. If you decide to adopt a bare device, you need a free partition on the disk. Otherwise, new disks will be added, or the original system should be redesigned.
5. What systems must use bare devices.
If you use the Oracle Parallel server option, you must use a bare device to store all the data files, control the files, and redo the log files. It is only possible to put these files on a bare device to ensure that all Oracle instances can read the database files. This is determined by the characteristics of the UNIX operating system.
In another case, if you want to use asynchronous I/O, you must also use a bare device on some UNIX. This requires reference to specific UNIX-related documentation.
6. Can you use the first partition of a disk as a bare device?
OK, but not recommended. The older version of UNIX is the bank, where the first partition of the disk often contains some information about the disk and some control information about the logical volume. If these parts are covered by a bare device, the disk becomes unrecognizable, causing the system to crash.
This is not the case with newer versions of UNIX because they employ more sophisticated techniques to manage disk, and some information about logical volumes.
However, unless you are confident that you do not use the first partition of the disk as a raw device.
7. Can I use the entire bare device as an Oracle data file?
No way. The size of the data file must be slightly smaller than the actual size of the raw device. At least two Oracle blocks should be empty.
8. The bare device should belong to that user.
The bare device should be created by root and then assigned to an Oracle user for use. It also has to be included in the same group as the Oracle user (usually DBAs).
9. How to specify a bare device when creating data files.
and ordinary files are not much different, the same is in single quotes inside the bare device to write the detailed path to it. As an example: to create a tablespace, using two bare devices, each 30M size, the size of the Oracle block is 4K, you can use the following command:
CREATE tablespace Raw_ts
DataFile '/dev/raw1 ' size 30712k
DataFile '/dev/raw2 ' size 30712k;
Is the size of the 10.Oracle block related to the bare device?
Oracle will have to be a multiple of the physical block size on the bare device.
11. How to make a backup on a raw device.
On a bare device, you cannot use the Unix utility for backup, the only way is to use the most basic UNIX command: DD for backup. For example: DD IF=/DEV/RAW1
Of=/dev/rmt0
bs=16k. The specific syntax for DD can refer to the UNIX manual or online Help. You can also use DD to back up the data files on the bare device to disk, and then use the Unix utility to enter a
Step processing.
12. If I am not using the Oracle parallel server option, I can have some data files on the database using the file system and the other part using bare devices.
OK. However, this can complicate the backup process.
13. Should I put the online redo log files on the bare device?
This is an excellent choice. Online redo log files are very frequently written files and are very suitable for bare devices. If you use the parallel server option, then the online redo log file must be placed on the bare device.
14. Can you put the archive log file on the bare device?
No way. The archive log file must be placed on the regular UNIX file system or directly onto the tape.
15. Can I put multiple data files on the top of a bare device?
No way. So you have to be very careful when setting up your bare devices. Too small, will lead to space quickly run out, too big words, space is wasted.
16. Because you should put a few bare devices on the same physical disk.
It's not good to do that. Because the use of bare devices is to improve disk read and write speed. Placing multiple bare devices on the same physical disk can result in a read-write competition, which is detrimental to increasing I/O speed. You should try to disperse the bare devices to different physical disks, preferably on different disk controllers. This is the best choice.
17. Do you need to define all the bare devices to be the same size?
This is not necessary, but dividing it into the same size is good for managing the database.
18. In order to use bare devices on UNIX, I need to change the UNIX core parameters.
No need. However, you can choose to reduce the size of the buffer, if no other applications are running on the same UNIX machine. The UNIX system buffers are no longer used after the bare devices have been used.
19. In order to improve read and write speed, at the operating system level, is there any way to take it.
The use of RAID (inexpensive redundant array of disks) is also a very effective way, especially the system that reads and writes very frequently.
20. After considering all of the above, is there any way to improve performance?
This requires the optimization of Oracle and the purchase of more disk and disk controllers to distribute I/O to different disks.
Third, raw equipment (same as 2, refers to bare equipment)






This article from the Chinaunix blog, if you view the original please point:Http://blog.chinaunix.net/u3/100692/showart_2178991.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.