2009年11月12日星期四

_blank开新窗口不符合标准?

本文参考了以下文章:
Kevin Yank的《New-Window links in a Standards-Compliant World》
《Standards-based Replacement for target="_blank" in External links》

我们要在新窗口中打开链接通常的做法是在链接后面加target="_blank",我们采用过渡型的DOCTYPE(xh tml1-transitional. dtd)时没有问题,但是当我们使用严格的DOCTYPE(xhtml1-strict.dtd)时,这个方法 将通不过W3C的校验,会出现如下错误提示:

"there is no attribute target for this element(in this HTML version)"

原来在HTML4.01/XHTML1.0/XHTML1.1严格DOCTYPE下,target="_blank"、target="_self"等等语法都是 无效的,我们只能通过JavaScript来变通实现。

有朋友问为什么不允许使用target="_blank"?这个属性很方便啊。呵呵,不知道W3C的专家们是怎么想 的,据我所知,主要是“易用性、友好性”的问题,因为老外觉得不经过用户同意,没有明确提示就打开一 个新窗口是不礼貌的。先不管这个取消是否合理,我们来看看解决办法。
rel属性

HTML4.0增加了一个新属性:rel,这个属性用来说明链接和包含此链接页面的关系,以及链接打开的目 标。rel有许多的属性值,比如next、previous,、chapter、section等等。我们要使用的就是rel="externa l"属性。原来这样写的代码:

打开一个新窗口

现在要写成这样:

打开一个 新窗口

这是符合strict标准的方法。当然还必须配合一个javascript才有效。
javascript

完整的代码JS如下:

function externallinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externallinks;

你可以把它保存成一个.js文件(比如external.js),然后通过外部联接方法调用:



就是这样。

最后补充一句,我网站采用的target="new"在过渡型DOCTYPE下是允许的,但也不符合strict标准。下次 改版时我将采用strict模式,将所有target="new"改成rel="external"。

2009年11月11日星期三

Quick HOWTO : Ch09 : Linux Users and Sudo

Contents [hide]
1 Sponsors
2 Introduction
3 Who Is the Super User?
4 How To Add Users
5 How to Change Passwords
5.1 How to Delete Users
5.2 How to Tell the Groups to Which a User Belongs
5.3 How to Change the Ownership of a File
6 Using sudo
6.1 Simple Sudo Examples
6.1.1 Temporarily Gaining root Privileges
6.1.2 Becoming root for a Complete Login Session
6.2 Downloading and Installing the sudo Package
6.3 The /etc/sudoers File
6.3.1 Table 9-1 Format of the /etc/sudoers File
6.4 Simple /etc/sudoers Examples
6.4.1 Granting All Access to Specific Users
6.4.2 Granting Access To Specific Users To Specific Files
6.4.3 Granting Access to Specific Files as Another User
6.4.4 Granting Access Without Needing Passwords
6.4.5 Using Aliases in the sudoers File
6.4.6 Other Examples
6.5 Using syslog To Track All sudo Commands
7 Conclusion

Introduction

Before we proceed, it would be best to cover some basic user administration topics that will be very useful in later chapters. Adding Users

One of the most important activities in administering a Linux box is the addition of users. Here you'll find some simple examples to provide a foundation for future chapters. It is not intended to be comprehensive, but is a good memory refresher. You can use the command man useradd to get the help pages on adding users with the useradd command or the man usermod to become more familiar with modifying users with the usermod command.
Who Is the Super User?

The super user with unrestricted access to all system resources and files in Linux is the user named root. This user has a user ID, of 0 which is universally identified by Linux applications as belonging to a user with supreme privileges. You will need to log in as user root to add new users to your Linux server.

Debian Note: When installing Ubuntu Linux systems, you are prompted to create a primary user that is not root. A root user is created but no password is set, so you initially cannot log in as this user. The primary user can become the root user using the sudo su - command that will be discussed later.
How To Add Users

Adding users takes some planning; read through these steps below before starting:

1) Arrange your list of users into groups by function. In this example there are three groups "parents", "children" and "soho".


Parents Children Soho

Paul Alice Accounts
Jane Derek Sales

2) Add the Linux groups to your server:

[[email protected] tmp]# groupadd parents
[[email protected] tmp]# groupadd children
[[email protected] tmp]# groupadd soho

3) Add the Linux users and assign them to their respective groups

[[email protected] tmp]# useradd -g parents paul
[[email protected] tmp]# useradd -g parents jane
[[email protected] tmp]# useradd -g children derek
[[email protected] tmp]# useradd -g children alice
[[email protected] tmp]# useradd -g soho accounts
[[email protected] tmp]# useradd -g soho sales

If you don't specify the group with the -g, RedHat/Fedora Linux creates a group with the same name as the user you just created; this is also known as the User Private Group Scheme. When each new user first logs in, they are prompted for their new permanent password.

4) Each user's personal directory is placed in the /home directory. The directory name will be the same as their user name.

[[email protected] tmp]# ll /home
drwxr-xr-x 2 root root 12288 Jul 24 20:04 lost+found
drwx------ 2 accounts soho 1024 Jul 24 20:33 accounts
drwx------ 2 alice children 1024 Jul 24 20:33 alice
drwx------ 2 derek children 1024 Jul 24 20:33 derek
drwx------ 2 jane parents 1024 Jul 24 20:33 jane
drwx------ 2 paul parents 1024 Jul 24 20:33 paul
drwx------ 2 sales soho 1024 Jul 24 20:33 sales
[[email protected] tmp]#

How to Change Passwords

You need to create passwords for each account. This is done with the passwd command. You are prompted once for your old password and twice for the new one.
User root changing the password for user paul.

[[email protected] root]# passwd paul
Changing password for user paul.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] root]#

Users might wish to change their passwords at a future date. Here is how unprivileged user paul would change his own password.

[[email protected] paul]$ passwd
Changing password for paul
Old password: your current password
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
New password: your new password
Re-enter new password: your new password
Password changed.
[[email protected] paul]$

How to Delete Users

The userdel command is used to remove the user's record from the /etc/passwd and /etc/shadow used in the login process. The command has a single argument, the username.

[[email protected] tmp]# userdel paul

There is also an optional -r switch that additionally removes all the contents of the user's home directory. Use this option with care. The data in a user's directory can often be important even after the person has left your company.

[[email protected] tmp]# userdel -r paul

How to Tell the Groups to Which a User Belongs

Use the groups command with the username as the argument.

[[email protected] root]# groups paul
paul : parents
[[email protected] root]#


How to Change the Ownership of a File

You can change the ownership of a file with the chown command. The first argument is the desired username and group ownership for the file separated by a colon (:) followed by the filename. In the next example we change the ownership of the file named text.txt from being owned by user root and group root to being owned by user testuser in the group users:

[[email protected] tmp]# ll test.txt
-rw-r--r-- 1 root root 0 Nov 17 22:14 test.txt
[[email protected] tmp]# chown testuser:users test.txt
[[email protected] tmp]# ll test.txt
-rw-r--r-- 1 testuser users 0 Nov 17 22:14 test.txt
[[email protected] tmp]#


You can also use the chown command with the -r switch for it to doe recursive searches down into directories to change permissions.

Using sudo

If a server needs to be administered by a number of people it is normally not a good idea for them all to use the root account. This is because it becomes difficult to determine exactly who did what, when and where if everyone logs in with the same credentials. The sudo utility was designed to overcome this difficulty.

The sudo utility allows users defined in the /etc/sudoers configuration file to have temporary access to run commands they would not normally be able to due to file permission restrictions. The commands can be run as user "root" or as any other user defined in the /etc/sudoers configuration file.

The privileged command you want to run must first begin with the word sudo followed by the command's regular syntax. When running the command with the sudo prefix, you will be prompted for your regular password before it is executed. You may run other privileged commands using sudo within a five-minute period without being re-prompted for a password. All commands run as sudo are logged in the log file /var/log/messages.

Simple Sudo Examples

Using sudo is relatively simple as we can see from these examples.
Temporarily Gaining root Privileges

In this example, user bob attempts to view the contents of the /etc/sudoers file, which is an action that normally requires privileged access. Without sudo, the command fails:

[[email protected] bob]$ more /etc/sudoers
/etc/sudoers: Permission denied
[[email protected] bob]$

Bob tries again using sudo and his regular user password and is successful:

[[email protected] bob]$ sudo more /etc/sudoers
Password:
...
...
[[email protected] bob]$

The details of configuring and installing sudo are covered in later sections.
Becoming root for a Complete Login Session

The su command allows a regular user to become the system's root user if they know the root password. A user with sudo rights to use the su command can become root, but they only need to know their own password, not that of root as seen here.

[email protected]:~$ sudo su -
Password:
[email protected]:~#

Some systems administrators will use sudo to grant root privileges to their own personal user account without the need to provide a password.

Later sections describe how to disable sudo su ability and also how to use sudo without password prompts.
Downloading and Installing the sudo Package

Fortunately the package is installed by default by RedHat/Fedora which eliminates the need to anything more in this regard. The visudo Command

The visudo command is a text editor that mimics the vi editor that is used to edit the /etc/sudoers configuration file. It is not recommended that you use any other editor to modify your sudo parameters because the sudoers file isn't located in the same directory on all versions of Linux. visudo uses the same commands as the vi text editor. The visudo command must run as user root and should have no arguments:

[[email protected] tmp]# visudo

The /etc/sudoers File

The /etc/sudoers file contains all the configuration and permission parameters needed for sudo to work. There are a number of guidelines that need to be followed when editing it with visudo. General /etc/sudoers Guidelines

The /etc/sudoers file has the general format shown in Table 9-1.

Table 9-1 Format of the /etc/sudoers File

General sudoers File Record Format

usernames/group servername = (usernames command can be run as) command

There are some general guidelines when editing this file:
Groups are the same as user groups and are differentiated from regular users by a % at the beginning. The Linux user group "users" would be represented by %users.
You can have multiple usernames per line separated by commas.
Multiple commands also can be separated by commas. Spaces are considered part of the command.
The keyword ALL can mean all usernames, groups, commands and servers.
If you run out of space on a line, you can end it with a back slash (\) and continue on the next line.
sudo assumes that the sudoers file will be used network wide, and therefore offers the option to specify the names of servers which will be using it in the servername position in Table 9-1. In most cases, the file is used by only one server and the keyword ALL suffices for the server name.
The NOPASSWD keyword provides access without prompting for your password.

Simple /etc/sudoers Examples

This section presents some simple examples of how to do many commonly required tasks using the sudo utility.
Granting All Access to Specific Users

You can grant users bob and bunny full access to all privileged commands, with this sudoers entry.

bob, bunny ALL=(ALL) ALL

This is generally not a good idea because this allows bob and bunny to use the su command to grant themselves permanent root privileges thereby bypassing the command logging features of sudo. The example on using aliases in the sudoers file shows how to eliminate this prob
Granting Access To Specific Users To Specific Files

This entry allows user peter and all the members of the group operator to gain access to all the program files in the /sbin and /usr/sbin directories, plus the privilege of running the command /usr/local/apps/check.pl. Notice how the trailing slash (/) is required to specify a directory location:

peter, %operator ALL= /sbin/, /usr/sbin, /usr/local/apps/check.pl

Notice also that the lack of any username entries within parentheses () after the = sign prevents the users from running the commands automatically masquerading as another user. This is explained further in the next example.
Granting Access to Specific Files as Another User

The sudo -u entry allows allows you to execute a command as if you were another user, but first you have to be granted this privilege in the sudoers file.

This feature can be convenient for programmers who sometimes need to kill processes related to projects they are working on. For example, programmer peter is on the team developing a financial package that runs a program called monthend as user accounts. From time to time the application fails, requiring "peter" to stop it with the /bin/kill, /usr/bin/kill or /usr/bin/pkill commands but only as user "accounts". The sudoers entry would look like this:

peter ALL=(accounts) /bin/kill, /usr/bin/kill, /usr/bin/pkill


User peter is allowed to stop the monthend process with this command:


[[email protected] peter]# sudo -u accounts pkill monthend

Granting Access Without Needing Passwords

This example allows all users in the group operator to execute all the commands in the /sbin directory without the need for entering a password. This has the added advantage of being more convenient to the user:

%operator ALL= NOPASSWD: /sbin/

Using Aliases in the sudoers File

Sometimes you'll need to assign random groupings of users from various departments very similar sets of privileges. The sudoers file allows users to be grouped according to function with the group and then being assigned a nickname or alias which is used throughout the rest of the file. Groupings of commands can also be assigned aliases too.

In the next example, users peter, bob and bunny and all the users in the operator group are made part of the user alias ADMINS. All the command shell programs are then assigned to the command alias SHELLS. Users ADMINS are then denied the option of running any SHELLS commands and su:

Cmnd_Alias SHELLS = /usr/bin/sh, /usr/bin/csh, \
/usr/bin/ksh, /usr/local/bin/tcsh, \
/usr/bin/rsh, /usr/local/bin/zsh

User_Alias ADMINS = peter, bob, bunny, %operator
ADMINS ALL = !/usr/bin/su, !SHELLS

This attempts to ensure that users don't permanently su to become root, or enter command shells that bypass sudo's command logging. It doesn't prevent them from copying the files to other locations to be run. The advantage of this is that it helps to create an audit trail, but the restrictions can be enforced only as part of the company's overall security policy.
Other Examples

You can view a comprehensive list of /etc/sudoers file options by issuing the command man sudoers.
Using syslog To Track All sudo Commands

All sudo commands are logged in the log file /var/log/messages which can be very helpful in determining how user error may have contributed to a problem. All the sudo log entries have the word sudo in them, so you can easily get a thread of commands used by using the grep command to selectively filter the output accordingly.

Here is sample output from a user bob failing to enter their correct sudo password when issuing a command, immediately followed by the successful execution of the command /bin/more sudoers.


[[email protected] tmp]# grep sudo /var/log/messages
Nov 18 22:50:30 bigboy sudo(pam_unix)[26812]: authentication failure; logname=bob uid=0 euid=0 tty=pts/0 ruser= rhost= user=bob
Nov 18 22:51:25 bigboy sudo: bob : TTY=pts/0 ; PWD=/etc ; USER=root ; COMMAND=/bin/more sudoers
[[email protected] tmp]#


Conclusion

It is important to know how to add users, not just so they can log in to our system. Most server based applications usually run via a dedicated unprivileged user account, for example the MySQL database application runs as user mysql and the Apache Web server application runs as user apache. These accounts aren't always created automatically, especially if the software is installed using TAR files.

Finally, the sudo utility provides a means of dispersing the responsibility of systems management to multiple users. You can even give some groups of users only partial access to privileged commands depending on their roles in the organization. This makes sudo a valuable part of any company's server administration and security policy.

http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch09_:_Linux_Users_and_Sudo#How_To_Add_Users

2009年11月9日星期一

商业英文书信常用开头语

(1)特此奉告……  To inform one of; To say; To state; To communicate; To advise one of; To bring to one's notice (knowledge); To lay before one; To point out; To indicate; To mention; To apprise one of; To announce; To remark; To call one's attention to; To remind one of; etc.

  1. We are pleased to inform you that

  2. We have pleasure in informing you that

  3. We have the pleasure to apprise you of

  4. We have the honour to inform you that (of)

  5. We take the liberty of announcing to you that

  6. We have to inform you that (of)

  7. We have to advise you of (that)

  8. We wish to inform you that (of)

  9. We think it advisable to inform you that (of)

  10. We are pleased to have this opportunity of reminding you that (of)

  11. We take the advantage of this opportunity to bring before your notice

  12. Please allow us to call your attention to

  13. Permit us to remind you that (of)

  14. May we ask your attention to

  15. We feel it our duty to inform you that (of)

  (2)为(目的)奉告某某事项……

  1. The purpose of this letter is to inform you that (of)

  2. The purport of this line is to advise you that (of)

  3. The object of the present is to report you that

  4. The object of this letter is to tell you that

  5. By this letter we Purpose to inform you that (of)

  6. Through the present we wish to intimate to you that

  7. The present serves to acquaint you that

  (3)惠请告知某某事项……

  1. Please inform me that (of)

  2. Kindly inform me that (of)

  3. Be good enough to inform me that (of)

  4. Be so good as to inform me that (of)

  5. Have the goodness to inform me that (of)

  6. Oblige me by informing that (of)

  7. I should be obliged if you would inform me that (of)

  8. I should be glad if you would inform me that (of)

  9. I should esteem it a favour if you would inform me that (of)

  10. I will thank you to inform me that (of)

  11. You will greatly oblige me by informing that (of)

  12. We shall be obliged if you will inform us that (of)

  13. We shall be pleased to have your information regarding (on, as to; about)

  14. We shall deem it a favour if you will advise us of

  15. We shall esteem it a high favour if you will inform us that (of)

  (4)特确认,本公司某月某日函件……

  1. We confirm our respects of the l0th May

  2. We confirm our letter of the l0th of this month

  3. We confirm our last letter of the l0th June

  4. We had the pleasure of writing you last on the l0th of this month

  5. We confirm our respects of the l0th June

  6. We confirm the remarks made in our respects of the l0th July

  7. We confirm the particulars of our enquiry by telephone of this morning

  8. In confirming our telegram of this morning, ——

  9. Confirming our respects of the 10th May,——

  10. Confirming our last of the 10th June,——

  (5)贵公司某月某日函电,敬悉……

  l. We have pleasure in acknowledging receipt of your esteemed favour of the 3rd May

  2. We are pleased to acknowledge receipt of your favour of the lst June

  3. We have to acknowhedge receipt of your favour of the 5th July

  4. Your letter of May 5 was very welcome

  5. Your letter of April l0 gave me much pleasure

  6. Your esteemed favour of 7th May was duly received by us

  7. Your favour of the 5th June is duly to hand

  8. Your favour of the l0th is to (at) hand

  9. We are in due receipt of your favour dated the 7th June

  10. We are in receipt of your letter of the 7th July

  11. We are in possession of your letter of the 5th April

  12. We have duly received your favour of the 5th March

  13. Your letter of yesterday's date is duly to (at) hand

  14. Your esteemed communication of yesterday's date is just to (at) hand

  15. We thank you for your favour of the 5th May

  16. We are obliged for your letter of the 5th May

  17. Many thanks for your latter of the 5th June

  18. Very many thanks for your letter of May 5

  19. In acknowledging receipt of your letter of the 5th June, ……

  20. Your favour of the 5th May has just reached me

  21. Your favour of the 5th May is duly received

  22. Your favour of the 5th May is now before me

  23. Your promised letter under date (of) the 5th June has just reached us

  (6)特回答贵公司某月某日函所叙述有关事项……

  1. I have the pleasure of stating, in answer to your inquiry of the 4th inst, that

  2. In reply to your letter of the 5th of May, I have to inform you that (of)

  3. I hasten to answer your inquiry of the l5th May, by stating that

  4. We are in receipt of yours of the 5th June, in reply to which we are pleased to state that

  5. In reply to yours of the l0th May, relative to……, I would say that

  6. I am in receipt of your favour of the 7th May, and in response I inform you that (of)

  7. In response to your letter of l0th May, I wish to say that

  8. In answer to your favour of the 5th May regarding…… I reply as follows:

  9. Answering your letter of the 8th of February re……, I would say that

  10. In reply to your letter of February 8th, I inform you that (of)

  11. Replying to yours of the 8th of February regarding……, I would say that

  12. Replying to your favour under date of February 8th re……, I say that

  (7)非常遗憾,我们奉告您关于……

  l. We regret to inform you that (of)

  2. We are sorry to have to draw your attention to

  3. We regret to have to say that

  4. We regret to advise you that

  5. We very much regret to announce you that

  6. It is most regrettable that we have to inform you that (of)

  7. It is with our greatest regret that we must inform you that (of)

  8. To our greatest regret we must herewith inform you that (of)

  9. It is a matter for regret that I have to inform you that (of)

  10. It is to be regretted that I must inform you that (of)

  11. It is with regret and reluctance that we have to inform you that (of)

  12. It gives us a deep sorrow that we have to announce you that

  13. It causes me much sorrow to have to say that

  14. I feel sorry for having to announce you that

  15. I express my sorrow for announcing you that

  (8)当我们得悉……甚为遗憾……

  1. We are very sorry to hear (know) that

  2. we are grieved to hear of (about)

  3. We are indeed sorry to hear that

  4. We very much regret to hear that

  5. We regret to hear of (that)

  6. It is with great regret that we just learn that

  7. Much to our regret we have heard that

  8. We regret to receive your information re

  9. We regret that we have been informed that (of)

  10. To our deep regret we were informed that (of)

  (9)我们对于您某月某日来函的询价,深表谢意……

  1. We thank you very much for your inquiry of the l0th of May

  2. I thank you for your inquiry of the 10th May

  3. We are very much obliged by your enquiry dated the 10th May

  4. We are indebted to your inquiry under date (of) the 10th May for

  5. I thank you for your inquiry of July 10

  6. Thanks for your kind enquiry of May 5

  (10)兹函附某某,请查收……

  1. Enclosed please find

  2. Enclosed we hand you

  3. We enclose herewith

  4. Herewith we have the pleasure to hand you

  5. We have pleasure in enclosing herewith

  6. We take the liberty to enclose herein

  7. We are pleased to enclose herewith

  8. We are pleased to hand you enclosed

  (11)遵照某月某日来函指示……

  1. In accordance with the instructions given (contained) in your favour of the 10th May

  2. According to the directions contained in yours of the 6th May

  3. According to the instructions given in your letter under date of the 10th of last month

  4. In conformity with (to) your instructions of the l0th ult.

  5. Pursuant to your instructions of May 10

  (12)关于详情,下次叙述……

  1. I will write you particulars in my next.

  2. Particulars will be related in the following.

  3. I will relate further details in the following.

  4. I will inform you more fully in my next.

  5. I will go (enter) into further details in my next.

  (13)如下列所记,如附件所述……

  1. As stated below,

  2. Annexed hereto,

  3. Attached you will find……

  4. As shown on the next page

  5. As indicated overleaf(下页,背面)

  6. As at foot hereof,

  7. Sent with this,

  8. As the drawings attached,

  9. As shown in the enclosed documents,

  10. As already mentioned,

  11. As particularized on the attached sheet,

  12. As detailed in the previous letter,

  (14)因电文不太明确……

  1. Your telegram just received is quite unintelligible.

  2. Please repeat your wire on receipt of this, stating your meaning more clearly.

  3. Your telegram is not clear; explain the third and fourth words.

  4. Your telegram is unintelligible; repeat more fully in plain language.

  5. Your cable is not clear, repeat, using the codes agreed upon (on)。

  6. We cannot understand your telegram; state the code used and which edition.

  7. Your telegram is not signed with cipher as agreed on; confirm if correct.

  8. We cannot trace the code you used; please repeat the telegram in plain words.

  9. Your telegram is too short to be understood. Please repeat it more fully.

  l0. The telegram was vague (pointless), and they requested them to explain in plain words.

RAID0、RAID1、RAID0+1、RAID5原理介绍

RAID 0又称为Stripe或Striping,它代表了所有RAID级别中最高的存储性能。RAID 0提高存储性能的原理是把连续的数据分散到多个磁盘上存取,这样,系统有数据请求就可以被多个磁盘并行的执行,每个磁盘执行属于它自己的那部分数据请求。这种数据上的并行操作可以充分利用总线的带宽,显著提高磁盘整体存取性能。

RAID 1又称为Mirror或Mirroring,它的宗旨是最大限度的保证用户数据的可用性和可修复性。 RAID 1的操作方式是把用户写入硬盘的数据百分之百地自动复制到另外一个硬盘上。由于对存储的数据进行百分之百的备份,在所有RAID级别中,RAID 1提供最高的数据安全保障。同样,由于数据的百分之百备份,备份数据占了总存储空间的一半,因而,Mirror的磁盘空间利用率低,存储成本高。

Mirror虽不能提高存储性能,但由于其具有的高数据安全性,使其尤其适用于存放重要数据,如服务器和数据库存储等领域。

RAID 5 是一种存储性能、数据安全和存储成本兼顾的存储解决方案。RAID 5不对存储的数据进行备份,而是把数据和相对应的奇偶校验信息存储到组成RAID5的各个磁盘上,并且奇偶校验信息和相对应的数据分别存储于不同的磁盘上。当RAID5的一个磁盘数据发生损坏后,利用剩下的数据和相应的奇偶校验信息去恢复被损坏的数据。

RAID 5可以理解为是RAID 0和RAID 1的折衷方案。RAID 5可以为系统提供数据安全保障,但保障程度要比Mirror低而磁盘空间利用率要比Mirror高。RAID 5具有和RAID 0相近似的数据读取速度,只是多了一个奇偶校验信息,写入数据的速度比对单个磁盘进行写入操作稍慢。同时由于多个数据对应一个奇偶校验信息,RAID 5的磁盘空间利用率要比RAID 1高,存储成本相对较低。

RAID0+1:正如其名字一样RAID 0+1是RAID 0和RAID 1的组合形式,也称为RAID 10。

RAID 0+1是存储性能和数据安全兼顾的方案。它在提供与RAID 1一样的数据安全保障的同时,也提供了与RAID 0近似的存储性能。

由于RAID 0+1也通过数据的100%备份提供数据安全保障,因此RAID 0+1的磁盘空间利用率与RAID 1相同,存储成本高。

RAID 0+1的特点使其特别适用于既有大量数据需要存取,同时又对数据安全性要求严格的领域,如银行、金融、商业超市、仓储库房、各种档案管理等。

RAID是通过磁盘阵列与数据条块化方法相结合, 以提高数据可用率的一种结构。IBM早于1970年就开始研究此项技术 。RAID 可分为RAID级别1到RAID级别6, 通常称为: RAID 0, RAID 1, RAID 2, RAID 3,RAID 4,RAID 5,RAID6。每一个RAID级别都有自己的强项和弱项. “奇偶校验”定义为用户数据的冗余信息, 当硬盘失效时, 可以重新产生数据。

RAID 0: RAID 0 并不是真正的RAID结构, 没有数据冗余。 RAID 0 连续地分割数据并并行地读/写于多个磁盘上。 因此具有很高的数据传输率。 但RAID 0在提高性能的同时,并没有提供数据可靠性,如果一个磁盘失效, 将影响整个数据.因此RAID 0 不可应用于需要数据高可用性的关键应用。

RAID 1: RAID 1通过数据镜像实现数据冗余, 在两对分离的磁盘上产生互为备份的数据。 RAID 1可以提高读的性能,当原始数据繁忙时, 可直接从镜像拷贝中读取数据.RAID 1是磁盘阵列中费用最高的, 但提供了最高的数据可用率。当一个磁盘失效, 系统可以自动地交换到镜像磁盘上, 而不需要重组失效的数据。

RAID 2: 从概念上讲, RAID 2 同RAID 3类似, 两者都是将数据条块化分布于不同的硬盘上, 条块单位为位或字节。然而RAID 2 使用称为“加重平均纠错码”的编码技术来提供错误检查及恢复。这种编码技术需要多个磁盘存放检查及恢复信息, 使得RAID 2技术实施更复杂。因此,在商业环境中很少使用。

RAID 3:不同于RAID 2, RAID 3使用单块磁盘存放奇偶校验信息。 如果一块磁盘失效, 奇偶盘及其他数据盘可以重新产生数据。 如果奇偶盘失效,则不影响数据使用。RAID 3对于大量的连续数据可提供很好的传输率, 但对于随机数据, 奇偶盘会成为写操作的瓶颈。

RAID 4: 同RAID 2, RAID 3一样, RAID 4, RAID 5也同样将数据条块化并分布于不同的磁盘上, 但条块单位为块或记录。 RAID 4使用一块磁盘作为奇偶校验盘, 每次写操作都需要访问奇偶盘, 成为写操作的瓶颈。 在商业应用中很少使用。

RAID 5:RAID 5没有单独指定的奇偶盘, 而是交叉地存取数据及奇偶校验信息于所有磁盘上。 在RAID5 上, 读/写指针可同时对阵列设备进行操作, 提供了更高的数据流量。 RAID 5更适合于小数据块,随机读写的数据.RAID 3与RAID 5相比, 重要的区别在于RAID 3每进行一次数据传输,需涉及到所有的阵列盘。而对于RAID 5来说, 大部分数据传输只对一块磁盘操作, 可进行并行操作。在RAID 5中有“写损失”, 即每一次写操作,将产生四个实际的读/写操作, 其中两次读旧的数据及奇偶信息, 两次写新的数据及奇偶信息。

RAID 6:RAID 6 与RAID 5相比,增加了第二个独立的奇偶校验信息块。 两个独立的奇偶系统使用不同的算法, 数据的可靠性非常高. 即使两块磁盘同时失效,也不会影响数据的使用。 但需要分配给奇偶校验信息更大的磁盘空间,相对于RAID 5有更大的“写损失”。RAID 6 的写性能非常差, 较差的性能和复杂的实施使得RAID 6很少使用。