欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
mdadm使用詳解及RAID 5簡(jiǎn)單分析
mdadm使用詳解及RAID 5簡(jiǎn)單分析 收藏
本文是《用raidtools創(chuàng )建Linux Soft RAID》的續篇,關(guān)于如何使用raidtools在Linux下創(chuàng )建軟RAID請參考原文
關(guān)于RAID原理、常用的RAID級別和參數以及各種RAID之間的對比可參考以下鏈接:
RAID Calculator ( en | ch ) & RAID Summary Comparison ( en | ch ) beta @ my googlepage
★什么是mdadm?
mdadm是multiple devices admin的簡(jiǎn)稱(chēng),它是Linux下的一款標準的軟件 RAID 管理工具,作者是Neil Brown。
★為什么選擇mdadm?
我們知道raidtools是Linux下一款經(jīng)典的用于管理軟件 RAID 的工具,但是因為配置/etc/raidtab比較繁瑣,而且其功能有限,所以現在越來(lái)越多的人選擇mdadm。
mdadm 和 raidtools 主要有以下幾點(diǎn)不同:
mdadm能夠診斷、監控和收集詳細的陣列信息
mdadm是一個(gè)單獨集成化的程序而不是一些分散程序的集合,因此對不同RAID管理命令有共通的語(yǔ)法
mdadm能夠執行幾乎所有的功能而不需要配置文件(也沒(méi)有默認的配置文件)
當然,如果需要一個(gè)配置文件,mdadm將幫助管理它的內容
★準備工作
QUOTE:
首先我們在虛擬機中添加四塊SCSI硬盤(pán)(我們仍然直接使用只有一個(gè)分區的硬盤(pán)(sdb、sdc、sdd、sde)來(lái)作為RAID設備的成員,每個(gè)盤(pán)大小為8G)并分區格式化,具體步驟可參考用raidtools創(chuàng )建Linux Soft RAID,這里從略
★下載、安裝mdadm
你可以到mdadm的官方網(wǎng)站(http://www.cse.unsw.edu.au/~neilb/source/mdadm/)下載最新的壓縮包。目前最新的版本是mdadm-2.6.2(LATEST.tgz or mdadm-2.6.2.tgz)。 推薦下載tgz格式的壓縮包自行編譯然后安裝mdadm和它的文檔、手冊和示例文件。
安裝步驟如下:
login as: eric4ever
eric4ever@192.168.254.30's password:
Last login: Thu May 24 10:59:06 2007 from 192.168.254.1
[root@localhost eric4ever]# ls -lh
total 208K
-rw-r--r--    1 root     root         201K May 24 11:01 LATEST.tgz
[root@localhost eric4ever]# tar zxvf LATEST.tgz
mdadm-2.6.2/
mdadm-2.6.2/mdadm.conf-example
mdadm-2.6.2/misc/
mdadm-2.6.2/misc/syslog-events
mdadm-2.6.2/md_u.h
mdadm-2.6.2/TODO
mdadm-2.6.2/ANNOUNCE-2.0
mdadm-2.6.2/kernel-patch-2.6.18
mdadm-2.6.2/Query.c
mdadm-2.6.2/ReadMe.c
mdadm-2.6.2/super0.c
mdadm-2.6.2/SHA1.c
mdadm-2.6.2/ANNOUNCE-2.6
mdadm-2.6.2/ANNOUNCE-2.6.1
mdadm-2.6.2/Monitor.c
mdadm-2.6.2/md_p.h
mdadm-2.6.2/mdassemble.c
mdadm-2.6.2/mdadm.h
mdadm-2.6.2/mdadm.spec
mdadm-2.6.2/mdadm.c
mdadm-2.6.2/Assemble.c
mdadm-2.6.2/Kill.c
mdadm-2.6.2/ANNOUNCE-2.1
mdadm-2.6.2/pwgr.c
mdadm-2.6.2/Incremental.c
mdadm-2.6.2/mapfile.c
mdadm-2.6.2/Grow.c
mdadm-2.6.2/tests/
mdadm-2.6.2/tests/00raid4
mdadm-2.6.2/tests/05r6-bitmapfile
mdadm-2.6.2/tests/02r6grow
mdadm-2.6.2/tests/03r5assem
mdadm-2.6.2/tests/07testreshape5
mdadm-2.6.2/tests/05r1-internalbitmap-v1c
mdadm-2.6.2/tests/02r5grow
mdadm-2.6.2/tests/05r1-re-add
mdadm-2.6.2/tests/00raid6
mdadm-2.6.2/tests/01r5fail
mdadm-2.6.2/tests/06update-uuid
mdadm-2.6.2/tests/05r1-bitmapfile
mdadm-2.6.2/tests/02r1grow
mdadm-2.6.2/tests/05r1-n3-bitmapfile
mdadm-2.6.2/tests/06wrmostly
mdadm-2.6.2/tests/05r1-re-add-nosuper
mdadm-2.6.2/tests/00raid5
mdadm-2.6.2/tests/03r5assemV1
mdadm-2.6.2/tests/00multipath
mdadm-2.6.2/tests/05r1-internalbitmap-v1b
mdadm-2.6.2/tests/06name
mdadm-2.6.2/tests/05r1-grow-internal-1
mdadm-2.6.2/tests/01r1fail
mdadm-2.6.2/tests/00raid0
mdadm-2.6.2/tests/05r1-grow-external
mdadm-2.6.2/tests/06r5swap
mdadm-2.6.2/tests/07autodetect
mdadm-2.6.2/tests/05r1-internalbitmap
mdadm-2.6.2/tests/02lineargrow
mdadm-2.6.2/tests/00raid1
mdadm-2.6.2/tests/testdev
mdadm-2.6.2/tests/05r5-internalbitmap
mdadm-2.6.2/tests/00raid10
mdadm-2.6.2/tests/ToTest
mdadm-2.6.2/tests/05r5-bitmapfile
mdadm-2.6.2/tests/04r0update
mdadm-2.6.2/tests/02r1add
mdadm-2.6.2/tests/03r0assem
mdadm-2.6.2/tests/check
mdadm-2.6.2/tests/06sysfs
mdadm-2.6.2/tests/05r1-grow-internal
mdadm-2.6.2/tests/04r1update
mdadm-2.6.2/tests/00linear
mdadm-2.6.2/tests/05r1-internalbitmap-v1a
mdadm-2.6.2/mdassemble.8
mdadm-2.6.2/restripe.c
mdadm-2.6.2/Manage.c
mdadm-2.6.2/md.4
mdadm-2.6.2/ANNOUNCE-2.5
mdadm-2.6.2/ChangeLog
mdadm-2.6.2/Examine.c
mdadm-2.6.2/ANNOUNCE-2.5.1
mdadm-2.6.2/sha1.h
mdadm-2.6.2/inventory
mdadm-2.6.2/ANNOUNCE-2.3
mdadm-2.6.2/sha1.c
mdadm-2.6.2/raid5extend.c
mdadm-2.6.2/bitmap.c
mdadm-2.6.2/ANNOUNCE-2.6.2
mdadm-2.6.2/ANNOUNCE-2.5.3
mdadm-2.6.2/dlink.c
mdadm-2.6.2/md5.h
mdadm-2.6.2/config.c
mdadm-2.6.2/mdadm.conf.5
mdadm-2.6.2/mkinitramfs
mdadm-2.6.2/swap_super.c
mdadm-2.6.2/bitmap.h
mdadm-2.6.2/test
mdadm-2.6.2/mdopen.c
mdadm-2.6.2/ANNOUNCE-2.5.5
mdadm-2.6.2/Create.c
mdadm-2.6.2/kernel-patch-2.6.19
mdadm-2.6.2/mdadm.8
mdadm-2.6.2/ANNOUNCE-2.2
mdadm-2.6.2/ANNOUNCE-2.5.4
mdadm-2.6.2/COPYING
mdadm-2.6.2/sysfs.c
mdadm-2.6.2/super1.c
mdadm-2.6.2/Makefile
mdadm-2.6.2/util.c
mdadm-2.6.2/INSTALL
mdadm-2.6.2/mdstat.c
mdadm-2.6.2/ANNOUNCE-2.4.1
mdadm-2.6.2/dlink.h
mdadm-2.6.2/ANNOUNCE-2.5.6
mdadm-2.6.2/ANNOUNCE-2.3.1
mdadm-2.6.2/makedist
mdadm-2.6.2/kernel-patch-2.6.18.6
mdadm-2.6.2/ANNOUNCE-2.5.2
mdadm-2.6.2/ANNOUNCE-2.4-pre1
mdadm-2.6.2/Detail.c
mdadm-2.6.2/README.initramfs
mdadm-2.6.2/ANNOUNCE-2.4
mdadm-2.6.2/Build.c
[root@localhost eric4ever]# ls -lh
total 212K
-rw-r--r--    1 root     root         201K May 24 11:01 LATEST.tgz
drwxr-xr-x    4 1000     1000         4.0K May 21 12:25 mdadm-2.6.2
[root@localhost eric4ever]# cd mdadm-2.6.2/
[root@localhost mdadm-2.6.2]# make install
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o mdadm.o mdadm.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o config.o config.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o mdstat.o mdstat.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o ReadMe.o ReadMe.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o util.o util.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Manage.o Manage.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Assemble.o Assemble.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Build.o Build.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Create.o Create.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Detail.o Detail.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Examine.o Examine.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Grow.o Grow.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Monitor.o Monitor.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o dlink.o dlink.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Kill.o Kill.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Query.o Query.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o Incremental.o Incremental.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o mdopen.o mdopen.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o super0.o super0.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o super1.o super1.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o bitmap.o bitmap.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o restripe.o restripe.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -c -o sysfs.o sysfs.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DHAVE_STDINT_H -o sha1.o -c sha1.c
gcc -Wall -Werror -Wstrict-prototypes -ggdb -DSendmail=\""/usr/sbin/sendmail -t
/usr/bin/install -D -m 644 mdadm.8 /usr/share/man/man8/mdadm.8
/usr/bin/install -D -m 644 md.4 /usr/share/man/man4/md.4
/usr/bin/install -D -m 644 mdadm.conf.5 /usr/share/man/man5/mdadm.conf.5
/usr/bin/install -D  -m 755 mdadm /sbin/mdadm
[root@localhost mdadm-2.6.2]#
你也可以使用基于RPM的發(fā)布包,你可以從這里下載,不過(guò)最新的RPM為2.6-1版本:
[root@localhost mdadm-2.6.2]# rpm -ihv mdadm-1.4.0-1.i386.rpm
★mdadm簡(jiǎn)介
我們可以使用man mdadm命令來(lái)查看mdadm的幫助信息:
[root@localhost mdadm-2.6.2]# man mdadm
關(guān)于man mdadm的詳細信息請查看4樓
☆mdadm用法
基本語(yǔ)法:
mdadm [mode] <raid-device> [options] <component-devices>
目前支持:
LINEAR, RAID0(striping), RAID1(mirroring), RAID4, RAID5, RAID6, RAID10, MULTIPATH和FAULTY
模式(7種):
Assemble:加入一個(gè)以前定義的陣列
Build:創(chuàng )建一個(gè)沒(méi)有超級塊的陣列
Create:創(chuàng )建一個(gè)新的陣列,每個(gè)設備具有超級塊
Manage: 管理陣列(如添加和刪除)
Misc:允許單獨對陣列中的某個(gè)設備進(jìn)行操作(如停止陣列)
Follow or Monitor:監控RAID的狀態(tài)
Grow:改變RAID的容量或陣列中的設備數目
選項:
-A, --assemble:加入一個(gè)以前定義的陣列
-B, --build:創(chuàng )建一個(gè)沒(méi)有超級塊的陣列(Build a legacy array without superblocks.)
-C, --create:創(chuàng )建一個(gè)新的陣列
-F, --follow, --monitor:選擇監控(Monitor)模式
-G, --grow:改變激活陣列的大小或形態(tài)
-I, --incremental:添加一個(gè)單獨的設備到合適的陣列,并可能啟動(dòng)陣列
--auto-detect:請求內核啟動(dòng)任何自動(dòng)檢測到的陣列
-h, --help:幫助信息,用在以上選項后,則顯示該選項信息
--help-options:顯示更詳細的幫助
-V, --version:打印mdadm的版本信息
-v, --verbose:顯示細節
-b, --brief:較少的細節。用于 --detail 和 --examine 選項
-Q, --query:查看一個(gè)device,判斷它為一個(gè) md device 或是 一個(gè) md 陣列的一部分
-D, --detail:打印一個(gè)或多個(gè) md device 的詳細信息
-E, --examine:打印 device 上的 md superblock 的內容
-c, --config= :指定配置文件,缺省為 /etc/mdadm.conf
-s, --scan:掃描配置文件或 /proc/mdstat以搜尋丟失的信息。配置文件/etc/mdadm.conf
★使用mdadm創(chuàng )建RAID5
Create (mdadm --create)模式用來(lái)創(chuàng )建一個(gè)新的陣列。 在這里我們首先使用mdadm --create --help查看一下幫助:
[root@localhost mdadm-2.6.2]# mdadm --create --help
Usage:  mdadm --create device -chunk=X --level=Y --raid-devices=Z devices
This usage will initialise a new md array, associate some
devices with it, and activate the array.   In order to create an
array with some devices missing, use the special word 'missing' in
place of the relevant device name.
Before devices are added, they are checked to see if they already contain
raid superblocks or filesystems.  They are also checked to see if
the variance in device size exceeds 1%.
If any discrepancy is found, the user will be prompted for confirmation
before the array is created.  The presence of a '--run' can override this
caution.
If the --size option is given then only that many kilobytes of each
device is used, no matter how big each device is.
If no --size is given, the apparent size of the smallest drive given
is used for raid level 1 and greater, and the full device is used for
other levels.
Options that are valid with --create (-C) are:
--bitmap=          : Create a bitmap for the array with the given filename
--chunk=      -c   : chunk size of kibibytes
--rounding=        : rounding factor for linear array (==chunk size)
--level=      -l   : raid level: 0,1,4,5,6,linear,multipath and synonyms
--parity=     -p   : raid5/6 parity algorithm: {left,right}-{,a}symmetric
--layout=          : same as --parity
--raid-devices= -n : number of active devices in array
--spare-devices= -x: number of spares (eXtras) devices in initial array
--size=       -z   : Size (in K) of each drive in RAID1/4/5/6/10 - optional
--force       -f   : Honour devices as listed on command line.  Don't
: insert a missing drive for RAID5.
--run         -R   : insist of running the array even if not all
: devices are present or some look odd.
--readonly    -o   : start the array readonly - not supported yet.
--name=       -N   : Textual name for array - max 32 characters
--bitmap-chunk=    : bitmap chunksize in Kilobytes.
--delay=      -d   : bitmap update delay in seconds.
接下來(lái)我們使用mdadm創(chuàng )建在/dev/md0上創(chuàng )建一個(gè)由sdb、sdc、sdd3塊盤(pán)組成(另外1塊盤(pán)sde為熱備)的RAID5:
[root@localhost mdadm-2.6.2]# mdadm --create --verbose /dev/md0 --level=raid5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd --spare-devices=1 /dev/sde
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 8388544K
mdadm: array /dev/md0 started.
每個(gè)mdadm的選項都有一個(gè)縮寫(xiě)的形式,例如,上面我們創(chuàng )建RAID 5的命令可以使用下列的縮寫(xiě)形式:
[root@localhost mdadm-2.6.2]# mdadm -Cv /dev/md0 -l5 -n3 /dev/sdb /dev/sdc /dev/sdd -x1 /dev/sde
二者的效果是相同的。
★查看RAID狀態(tài)
接下來(lái)我們使用cat /proc/mdstat命令來(lái)查看一下RAID的狀態(tài),我們也可以利用watch命令來(lái)每隔一段時(shí)間刷新/proc/mdstat的輸出。使用CTRL+C可以取消。
[root@localhost mdadm-2.6.2]# watch -n 10 'cat /proc/mdstat'
Every 10s: cat /proc/mdstat                             Thu May 24 11:53:46 2007
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 sdd[4] sde[3] sdc[1] sdb[0]
16777088 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
[====>................]  recovery = 24.0% (2016364/8388544) finish=10.2min
speed=10324K/sec
unused devices: <none>
[root@localhost mdadm-2.6.2]#
接下來(lái)我們?yōu)殛嚵袆?chuàng )建文件系統:
[root@localhost mdadm-2.6.2]# mkfs.ext3 /dev/md0
mke2fs 1.34 (25-Jul-2003)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2097152 inodes, 4194272 blocks
209713 blocks (5.00%) reserved for the super user
First data block=0
128 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
You have new mail in /var/spool/mail/root
我們嘗試向RAID中寫(xiě)入一個(gè)test2文件:
[root@localhost eric4ever]# vi test2
copy succeed!
eric@tlf
[url]http://eric4ever.googlepages.com/[/url]
done!
[root@localhost eric4ever]# ls
LATEST.tgz  mdadm-2.6.2  test2
[root@localhost eric4ever]# mount /dev/md0 /mnt/md0
[root@localhost eric4ever]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             2.9G  1.8G  1.1G  63% /
/dev/sda3             4.6G   33M  4.3G   1% /opt
none                  125M     0  125M   0% /dev/shm
/dev/md0               16G   33M   15G   1% /mnt/md0
[root@localhost eric4ever]# ls /mnt/md0
lost+found
[root@localhost eric4ever]# cp ./test2 /mnt/md0
[root@localhost eric4ever]# ls /mnt/md0
lost+found  test2
[root@localhost eric4ever]# ls -lh /mnt/md0
total 20K
drwx------    2 root     root          16K May 24 11:55 lost+found
-rw-r--r--    1 root     root           63 May 24 11:56 test2
使用mdadm --detail /dev/md0(或mdadm -D /dev/md0)命令以及cat /proc/mdstat命令可以查看RAID設備的狀態(tài):
[root@localhost eric4ever]# mdadm -D /dev/md0  (或mdadm --detail /dev/md0)
/dev/md0:
Version : 00.90.00
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Array Size : 16777088 (16.00 GiB 17.18 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 24 13:45:36 2007
State : active, degraded, recovering
Active Devices : 2
Working Devices : 4
Failed Devices : 1
Spare Devices : 2
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 16% complete
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Events : 0.2
Number   Major   Minor   RaidDevice State
0       8       16        0      active sync   /dev/sdb
1       8       32        1      active sync   /dev/sdc
2       0        0        2      removed
3       8       64        3      spare   /dev/sde
4       8       48        4      spare   /dev/sdd
通過(guò)mdadm -D命令,我們可以查看RAID的版本、創(chuàng )建的時(shí)間、RAID級別、陣列容量、可用空間、設備數量、超級塊、更新時(shí)間、各個(gè)設備的狀態(tài)、RAID算法以及塊大小等信息,通過(guò)上面的信息我們可以看到目前RAID正處于重建過(guò)程之中,進(jìn)度為16%,其中/dev/sdb和/dev/sdc兩塊盤(pán)已經(jīng)同步。使用watch命令每個(gè)30秒刷新一下查看的進(jìn)度:
[root@localhost eric4ever]# watch -n 30 'cat /proc/mdstat'
Every 30s: cat /proc/mdstat                             Thu May 24 13:55:56 2007
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 sdd[4] sde[3] sdc[1] sdb[0]
16777088 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
[==============>......]  recovery = 72.3% (6067444/8388544) finish=3.7min
speed=10324K/sec
unused devices: <none>
當進(jìn)度進(jìn)行到100%時(shí),顯示如下:
Every 30s: cat /proc/mdstat                             Thu May 24 14:00:57 2007
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 sdd[2] sde[3] sdc[1] sdb[0]
16777088 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>
這是我們再使用mdadm -D命令查看一下:
[root@localhost eric4ever]# mdadm -D /dev/md0  (或mdadm --detail /dev/md0)
/dev/md0:
Version : 00.90.00
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Array Size : 16777088 (16.00 GiB 17.18 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 24 13:59:48 2007
State : active
Active Devices : 3
Working Devices : 4
Failed Devices : 1
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Events : 0.3
Number   Major   Minor   RaidDevice State
0       8       16        0      active sync   /dev/sdb
1       8       32        1      active sync   /dev/sdc
2       8       48        2      active sync   /dev/sdd
3       8       64        3      spare   /dev/sde
這時(shí)我們可以發(fā)現sdb、sdc、sdd三塊盤(pán)均已經(jīng)同步。
一般來(lái)說(shuō),一個(gè)新陣列被創(chuàng )建后我們最好創(chuàng )建一個(gè)/etc/mdadm.conf文件。沒(méi)有該文件在激活陣列時(shí)我們就得指定更詳細的信息,為方便,我們使用下列命令:
[root@localhost eric4ever]# mdadm --detail --scan
ARRAY /dev/md0 level=raid5 num-devices=3 spares=1 UUID=4b15050e:7d0c477d:98ed7d00:0f3c29e4
[root@localhost eric4ever]# mdadm --detail --scan >> /etc/mdadm.conf
[root@localhost eric4ever]# cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid5 num-devices=3 spares=1 UUID=4b15050e:7d0c477d:98ed7d00:0f3c29e4
★啟動(dòng)停止RAID
使用--stop或-S命令選項可以停止運行的陣列(注意: 停止前必須先umount):
[root@localhost eric4ever]# umount /mnt/md0
[root@localhost eric4ever]# mdadm -S /dev/md0  (或mdadm --stop /dev/md0)
mdadm: stopped /dev/md0
重新啟動(dòng)可以使用:
[root@localhost eric4ever]# mdadm -As /dev/md0
mdadm: /dev/md0 has been started with 3 drives and 1 spare.
★模擬故障
同raidtools一樣,mdadm也可以軟件模擬故障,命令選項為--fail或--set-faulty:
[root@localhost eric4ever]# mdadm --set-faulty --help
Usage: mdadm arraydevice options component devices...
This usage is for managing the component devices within an array.
The --manage option is not needed and is assumed if the first argument
is a device name or a management option.
The first device listed will be taken to be an md array device, and
subsequent devices are (potential) components of that array.
Options that are valid with management mode are:
--add         -a   : hotadd subsequent devices to the array
--remove      -r   : remove subsequent devices, which must not be active
--fail        -f   : mark subsequent devices a faulty
--set-faulty       : same as --fail
--run         -R   : start a partially built array
--stop        -S   : deactivate array, releasing all resources
--readonly    -o   : mark array as readonly
--readwrite   -w   : mark array as readwrite
[root@localhost eric4ever]# mdadm --fail --help
Usage: mdadm arraydevice options component devices...
This usage is for managing the component devices within an array.
The --manage option is not needed and is assumed if the first argument
is a device name or a management option.
The first device listed will be taken to be an md array device, and
subsequent devices are (potential) components of that array.
Options that are valid with management mode are:
--add         -a   : hotadd subsequent devices to the array
--remove      -r   : remove subsequent devices, which must not be active
--fail        -f   : mark subsequent devices a faulty
--set-faulty       : same as --fail
--run         -R   : start a partially built array
--stop        -S   : deactivate array, releasing all resources
--readonly    -o   : mark array as readonly
--readwrite   -w   : mark array as readwrite
接下來(lái)我們模擬/dev/sdb故障:
[root@localhost eric4ever]# mdadm --manage --set-faulty /dev/md0 /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0
查看一下系統日志,如果你配置了冗余磁盤(pán),可能會(huì )顯示如下信息:
kernel: raid5: Disk failure on sdb, disabling device.
kernel: md0: resyncing spare disk sde to replace failed disk
檢查/proc/mdstat,如果配置的冗余磁盤(pán)可用,陣列可能已經(jīng)開(kāi)始重建。
首先我們使用mdadm --detail /dev/md0命令來(lái)查看一下RAID的狀態(tài):
[root@localhost eric4ever]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.00
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Array Size : 16777088 (16.00 GiB 17.18 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 24 14:07:55 2007
State : active, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 2
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 3% complete
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Events : 0.6
Number   Major   Minor   RaidDevice State
0       8       16        0      faulty spare   /dev/sdb
1       8       32        1      active sync   /dev/sdc
2       8       48        2      active sync   /dev/sdd
3       8       64        3      spare rebuilding   /dev/sde
查看/proc/mdstat:
[root@localhost eric4ever]# cat /proc/mdstat
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 sdb[4] sde[3] sdd[2] sdc[1]
16777088 blocks level 5, 64k chunk, algorithm 2 [3/2] [_UU]
[==>..................]  recovery = 10.2% (858824/8388544) finish=12.4min speed=10076K/sec
unused devices: <none>
再查看一下RAID狀態(tài):
[root@localhost eric4ever]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.00
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Array Size : 16777088 (16.00 GiB 17.18 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 24 14:08:27 2007
State : active, degraded, recovering
Active Devices : 2
Working Devices : 4
Failed Devices : 1
Spare Devices : 2
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 11% complete
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Events : 0.8
Number   Major   Minor   RaidDevice State
0       0        0        0      removed
1       8       32        1      active sync   /dev/sdc
2       8       48        2      active sync   /dev/sdd
3       8       64        3      spare   /dev/sde
4       8       16        4      spare   /dev/sdb
已經(jīng)完成到11%了。查看一下日志消息:
[root@localhost eric4ever]# tail /var/log/messages
May 24 14:08:27 localhost kernel:  --- rd:3 wd:2 fd:1
May 24 14:08:27 localhost kernel:  disk 0, s:0, o:0, n:0 rd:0 us:0 dev:[dev 00:00]
May 24 14:08:27 localhost kernel:  disk 1, s:0, o:1, n:1 rd:1 us:1 dev:sdc
May 24 14:08:27 localhost kernel:  disk 2, s:0, o:1, n:2 rd:2 us:1 dev:sdd
May 24 14:08:27 localhost kernel: RAID5 conf printout:
May 24 14:08:27 localhost kernel:  --- rd:3 wd:2 fd:1
May 24 14:08:27 localhost kernel:  disk 0, s:0, o:0, n:0 rd:0 us:0 dev:[dev 00:00]
May 24 14:08:27 localhost kernel:  disk 1, s:0, o:1, n:1 rd:1 us:1 dev:sdc
May 24 14:08:27 localhost kernel:  disk 2, s:0, o:1, n:2 rd:2 us:1 dev:sdd
May 24 14:08:27 localhost kernel: md: cannot remove active disk sde from md0 ...
使用mdadm -E命令查看一下/dev/sdb的情況:
[root@localhost eric4ever]# mdadm -E /dev/sdb
/dev/sdb:
Magic : a92b4efc
Version : 00.90.00
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Array Size : 16777088 (16.00 GiB 17.18 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Update Time : Thu May 24 14:08:27 2007
State : active
Active Devices : 2
Working Devices : 4
Failed Devices : 1
Spare Devices : 2
Checksum : a6a19662 - correct
Events : 0.8
Layout : left-symmetric
Chunk Size : 64K
Number   Major   Minor   RaidDevice State
this     4       8       16        4      spare   /dev/sdb
0     0       0        0        0      faulty removed
1     1       8       32        1      active sync   /dev/sdc
2     2       8       48        2      active sync   /dev/sdd
3     3       8       64        3      spare   /dev/sde
4     4       8       16        4      spare   /dev/sdb
自動(dòng)修復完成后,我們再查看一下RAID的狀態(tài):
[root@localhost eric4ever]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.00
Creation Time : Thu May 24 13:45:35 2007
Raid Level : raid5
Array Size : 16777088 (16.00 GiB 17.18 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 3
Total Devices : 5
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Thu May 24 14:21:54 2007
State : active
Active Devices : 3
Working Devices : 4
Failed Devices : 1
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
UUID : 4b15050e:7d0c477d:98ed7d00:0f3c29e4
Events : 0.9
Number   Major   Minor   RaidDevice State
0       8       64        0      active sync   /dev/sde
1       8       32        1      active sync   /dev/sdc
2       8       48        2      active sync   /dev/sdd
4       8       16        4      spare   /dev/sdb
[root@localhost eric4ever]# cat /proc/mdstat
Personalities : [raid5]
read_ahead 1024 sectors
md0 : active raid5 sdb[4] sde[0] sdd[2] sdc[1]
16777088 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>
我們可以看到/dev/sde已經(jīng)替換了/dev/sdb??纯聪到y的日志消息:
[root@localhost eric4ever]# tail /var/log/messages
May 24 14:21:54 localhost kernel:  --- rd:3 wd:3 fd:0
May 24 14:21:54 localhost kernel:  disk 0, s:0, o:1, n:0 rd:0 us:1 dev:sde
May 24 14:21:54 localhost kernel:  disk 1, s:0, o:1, n:1 rd:1 us:1 dev:sdc
May 24 14:21:54 localhost kernel:  disk 2, s:0, o:1, n:2 rd:2 us:1 dev:sdd
May 24 14:21:54 localhost kernel: md: updating md0 RAID superblock on device
May 24 14:21:54 localhost kernel: md: sdb [events: 00000009]<6>(write) sdb's sb offset: 8388544
May 24 14:21:54 localhost kernel: md: sde [events: 00000009]<6>(write) sde's sb offset: 8388544
May 24 14:21:54 localhost kernel: md: sdd [events: 00000009]<6>(write) sdd's sb offset: 8388544
May 24 14:21:54 localhost kernel: md: sdc [events: 00000009]<6>(write) sdc's sb offset: 8388544
May 24 14:21:54 localhost kernel: md: recovery thread got woken up ...
recovery thread got woken up ...
這時(shí)我們可以從/dev/md0中移除/dev/sdb設備:
[root@localhost eric4ever]# mdadm /dev/md0 -r /dev/sdb
mdadm: hot removed /dev/sdb
類(lèi)似地,我們可以使用下列命令向/dev/md0中添加一個(gè)設備:
[root@localhost eric4ever]# mdadm /dev/md0 --add /dev/sdf
★監控RAID
mdadm的監控模式提供一些實(shí)用的功能,你可以使用下列命令來(lái)監控/dev/md0,delay參數意味著(zhù)檢測的時(shí)間間隔,這樣緊急事件和嚴重的錯誤會(huì )及時(shí)發(fā)送給系統管理員:
[root@localhost eric4ever]# mdadm --monitor --mail=eric4ever@localhost --delay=300 /dev/md0
當使用監控模式時(shí),mdadm不會(huì )退出,你可以使用下列命令:
[root@localhost eric4ever]# nohup mdadm --monitor --mail=eric4ever@localhost --delay=300 /dev/md0 &
[1] 3113
[root@localhost eric4ever]# nohup: appending output to `nohup.out'
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
how to sovle the common problem of raid
軟RAID管理命令mdadm詳解 | 旺旺知識庫
RAID磁盤(pán)陣列的原理與搭建
7.1磁盤(pán)陣列
Soft RAID/mdadm配置指南
CentOS 7配置軟RAID
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久