Introduction to Linux RAW Device management

Source: Internet
Author: User
Tags bind linux

1, what is the bare Linux device? Character devices? Block device?

Bare devices: Also known as bare partitions (raw partitions), is a special character device that is not formatted and is not read by Unix/linux through a file system. A raw device can bind a partition, or it can bind a disk.

Character devices: Reading and writing to character devices does not require buffer through the OS. It cannot be mount by the file system.

Block device: Read and write to a block device through the OS buffer, it can be mount to the file system.

2. How many bare devices can a system have?

This is related to the Linux version, in the old version, up to only 256 bare devices, Linux 4 to do more to bind 8,192 bare devices.

But under Linux, you can only have 255 partitions, so if you bind partitions with a bare device, you can only bind up to 255 bare devices.

If you are using LVM, there is no limit.

3, Linux under the maximum number of individual disks can have a partition?

15 A. 3 primary partitions + one extended partition + 11 logical partitions.

The proposed partitioning method consists of 3 primary partitions, a fourth partition as an extended partition, and then another 11 logical partitions in the extended partition.

Note that the naked device is not bound to the extended partition.

4. Is it necessary to bind bare devices under Linux? What about UNIX?

If you need to use a bare device under Linux, you need to bind manually.

UNIX is not.

Because every block device in Unix has a corresponding character device for non-cache (unbuffered) I/O, this is the bare device he corresponds to.

This article URL address: http://www.bianceng.cn/OS/Linux/201410/45425.htm

In Linux, Rawio implements a set of unbound (unbound) bare devices/dev/rawn or/dev/raw/rawn and a control device/DEV/RAWCT to bind them to a block device. So when you need to use a bare device, you need to match it to a real-world piece of equipment, which is actually the automatic equivalent of a non cached character device in Unix.

5. How does Linux bind to bare devices?

Two ways:

1) Command binding

Raw/dev/raw/raw[n]/dev/xxx

Where the range of n is 0-8191. The raw directory does not exist to create.

By executing this command, a corresponding raw[n file will be generated under/dev/raw

Binding a raw device in a command mode will fail after the system restarts.

2) Modify the file

Modify the/etc/sysconfig/rawdevices file as follows to automatically load raw devices when powered on, such as:

/dev/raw/raw1/dev/sdb1

This approach is to bind the bare devices by starting the service.

You can also write this command on the/etc/rc.local so that the commands are executed each time you start.

6. How to use raw devices as Oracle data files? Is there anything you need to be aware of?

1) Binding raw devices

Refer to the above

2) Change the raw equipment owner

Two ways:

. Unload the command on the/etc/rc.local.

Chown ORACLE:OINSTALL/DEV/RAW/RAW1

. modifying/etc/udev/permissions.d/50-udev.permissions files

113 lines that will/etc/udev/permissions.d/50-udev.permissions

From

raw/*:root:disk:0660

Amended to

raw/*:oracle:oinstall:0660

This means that the default owner of the naked device is Oracle:oinstall, and the default mode is 0660.

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

7, the use of raw devices as Oracle data files what need to pay attention to?

The following points must be noted when using raw devices as Oracle data files:

1 A raw device can only place a data file

2 the size of the data file cannot exceed the size of the raw device

If this is a log file, the maximum available size for the bare device = partition size for the bare device-1 * 512 (keep one redo lock)

If it is a data file, the maximum usable size of the bare device = the partition size of the bare device-2 * db_block_size (two blocks are reserved)

For simplicity, all files are set to 1M smaller than bare devices.

3 The data file is best not to set the automatic expansion, if the set said automatic expansion, be sure to set the maxsize set to smaller than the bare device

8. Is it possible to use logical volumes directly as Oracle data files?

Under Linux, Oracle cannot directly take logical volumes as raw devices, but also bind them. You don't need it under UNIX.

9, how to know what is currently bound to the naked device?

The RAW-QA command lists all the raw devices currently bound.

10, how to know the size of a bare device

The more stupid way is to find out how the naked device corresponds to the actual block device, and then use Fdisk-l/DEV/[H,S]DXN to see the size of that piece of equipment is good.

The simpler approach is to use the Blockdev command to calculate, for example:

#blockdev--GETSIZE/DEV/RAW/RAW1

11718750

11718750 indicates how many OS Bliock are available.

Generally one OS block size is 512 bytes, so 11718750*512/1024/1024/1024 = 5722 (M) is the size of the bare device.

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.