Linux中國
如何在 RHEL 上設置 Linux RAID 1
設置 Linux RAID 1
配置 LINUX RAID 1 非常重要,因為它提供了冗餘性。
RAID 分區擁有高級功能,如冗餘和更好的性能。所以讓我們來說下如何實現 RAID,以及讓我們來看看不同類型的 RAID:
- RAID 0(條帶):磁碟組合在一起,形成一個更大的驅動器。這以可用性為代價提供了更好的性能。如果 RAID 中的任何一塊磁碟出現故障,則整個磁碟集將無法使用。最少需要兩塊磁碟。
- RAID 1(鏡像):磁碟從一個複製到另一個,提供了冗餘。如果一塊磁碟發生故障,則另一塊磁碟接管,它有另外一份原始磁碟的數據的完整副本。其缺點是寫入時間慢。最少需要兩塊磁碟。
- RAID 5(帶奇偶校驗的條帶):磁碟類似於 RAID 0,並且連接在一起以形成一個大型驅動器。這裡的區別是,一塊磁碟用於奇偶校驗位,這允許在單個磁碟發生故障時可以恢復磁碟。最少需要三塊盤。
讓我們繼續進行 Linux RAID 1 配置。
安裝 Linux RAID 1 的要求:
1、系統中應該安裝了 mdam,請用下面的命令確認。
[root@rhel1 ~]# rpm -qa | grep -i mdadm
mdadm-3.2.2-9.el6.x86_64
[root@rhel1 ~]#
2、 系統應該連接了 2 塊磁碟。
創建兩個分區,一個磁碟一個分區(sdc、sdd),每個分區佔據整塊磁碟。
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x67cc8cfb
Device Boot Start End Blocks Id System
/dev/sdc1 1 130 1044193+ 83 Linux
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0294382b
Device Boot Start End Blocks Id System
/dev/sdd1 1 130 1044193+ 83 Linux
現在你可以用你已經創建好的兩個分區來設置 RAID 1 了。你可以使用 mdadm 命令來創建 RAID 陣列。
Syntax: mdadm [options]
Options: -a, xx Adds a disk into a current array
-C, —create Creates a new RAID array
-D, —detail Prints the details of an array
-G, —grow Changes the size or shape of an active array
-f, xx Fails a disk in the array
-l, —level Specifies level (type) of RAID array to create
-n, —raid-devices Specifies the devices in the RAID array
-q, —quiet Species not to show output
-S, —stop Stops an array
-v, —verbose Provides verbose output
創建 Linux RAID 1 設備:
[root@rhel1 ~]# mdadm -Cv /dev/md0 --level=1 -n2 /dev/sdc1 /dev/sdd1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: size set to 1044181K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@rhel1 ~]#
使用下列命令查看新創建的 RAID 1 設備:
[root@rhel1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdd1[1] sdc1[0]
1044181 blocks super 1.2 [2/2] [UU]
unused devices: <none>
[root@rhel1 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdd1[1] sdc1[0]
1044181 blocks super 1.2 [2/2] [UU]
unused devices: <none>
使用 mdadm 命令再次確認,RAID 1 已經創建好了。
[root@rhel1 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Wed Dec 7 15:50:06 2016
Raid Level : raid1
Array Size : 1044181 (1019.88 MiB 1069.24 MB)
Used Dev Size : 1044181 (1019.88 MiB 1069.24 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Wed Dec 7 15:50:12 2016
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : rhel1.lab.com:0 (local to host rhel1.lab.com)
UUID : d5c0f82e:4e0753e6:0b28c178:e6f75af4
Events : 17
Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
1 8 49 1 active sync /dev/sdd1
[root@rhel1 ~]#
使用下列命令格式化新創建的 Linux RAID 1 設備:
[root@rhel1 ~]# mkfs.ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65280 inodes, 261045 blocks
13052 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
掛載 Linux RAID 1 設備:
[root@rhel1 ~]# mkdir /RAID1
[root@rhel1 ~]# mount /dev/md0 /RAID1
[root@rhel1 ~]# df -h /RAID1
Filesystem Size Used Avail Use% Mounted on
/dev/md0 1004M 18M 936M 2% /RAID1
[root@rhel1 ~]#
作者簡介:
大家好!我是 Manmohan Mirkar。我很高興見到你們!我在 10 多年前開始使用 Linux,我從來沒有想過我會到今天這個地步。我的激情是幫助你們獲取 Linux 知識。謝謝閱讀!
via: http://www.linuxroutes.com/linux-raid-1/
作者:Manmohan Mirkar 譯者:geekpi 校對:wxy
本文轉載來自 Linux 中國: https://github.com/Linux-CN/archive
對這篇文章感覺如何?
太棒了
0
不錯
0
愛死了
0
不太好
0
感覺很糟
0
More in:Linux中國
捐贈 Let's Encrypt,共建安全的互聯網
隨著 Mozilla、蘋果和谷歌對沃通和 StartCom 這兩家 CA 公司處罰落定,很多使用這兩家 CA 所簽發證書的網站紛紛尋求新的證書籤發商。有一個非盈利組織可以為大家提供了免費、可靠和安全的 SSL 證書服務,這就是 Let's Encrypt 項目。現在,它需要您的幫助
Let's Encrypt 正式發布,已經保護 380 萬個域名
由於 Let's Encrypt 讓安裝 X.509 TLS 證書變得非常簡單,所以這個數量增長迅猛。
關於Linux防火牆iptables的面試問答
Nishita Agarwal是Tecmint的用戶,她將分享關於她剛剛經歷的一家公司(印度的一家私人公司Pune)的面試經驗。在面試中她被問及許多不同的問題,但她是iptables方面的專家,因此她想分享這些關於iptables的問題和相應的答案給那些以後可能會進行相關面試的人。 所有的問題和相應的答案都基於Nishita Agarwal的記憶並經過了重寫。 嗨,朋友!我叫Nishita Agarwal。我已經取得了理學學士學位,我的專業集中在UNIX和它的變種(BSD,Linux)。它們一直深深的吸引著我。我在存儲方面有1年多的經驗。我正在尋求職業上的變化,並將供職於印度的P
Lets Encrypt 已被所有主流瀏覽器所信任
旨在讓每個網站都能使用 HTTPS 加密的非贏利組織 Lets Encrypt 已經得了 IdenTrust的交叉簽名,這意味著其證書現在已經可以被所有主流的瀏覽器所信任。從這個裡程碑事件開始,訪問者訪問使用了Lets Encrypt 證書的網站不再需要特別配置就可以得到 HTTPS 安全保護了。 Lets Encrypt 的兩個中級證書 ...

















