天天看點

【Oracle】裸裝置和塊裝置的差別

raw device 與 block device有什麼差別呢?

以下内容引自 401132.1 文檔

•What is a raw device?

Raw device are character devices...

[@[email protected]]

•What is a raw device?

Raw device are character devices which allows byte level access to the device. Character devices (/dev/raw/raw9) are *UN-BUFFERRED** devices. This means that there is not need to pass attributes like O_DIRECT when accessing character devices since all I/O is unbufferred IO.

•What is block device?

Block devices provide block level access to the device. Block devices unlike character devices (/dev/sde9) are **BUFFERED** devices. This means the application program has to explicitly pass the O_DIRECT attribute to turn off caching. If the O_DIRECT attribute is not passed, I/O will be cached (linux buffer cache).

•How are raw devices created? 

On linux, raw devices have to be created before it can be used. This is done by mapping the block device to the raw device by adding an entry in the /etc/sysconfig/rawdevices file and bind the mapping. Detailed instructions are in the Oracle installation guide.

•So which one (RAW or Block) is recommended?

Oracle 10g supports both raw devices and block devices for OCR, Voting disk & Database files so it is really a matter of choice. Raw devices need to be manually created each time a new file needs to be added. There is no performance benefits of Raw devices versus Block devices or vice versa. It should be pointed out that Linux vendors are planning on removing raw devices from future linux distributions and hence for the long term, Customers may want to go with block devices.