Linux bare device Summary-Linux Enterprise Application-Linux server application information. The following is a detailed description. In the past few days, I have looked at the management of bare devices in linux, made some notes, and did not dare to share them as follows:
(The content of the note is not necessarily correct. If any error occurs, please point it out)
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 [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.
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.