Linux: Ubuntu создаем софтварный raid 5 Сегодня расскажем как в Linux сделать массив RAID-5. Показывать будем на Ubuntu установленной на виртуальной машине VMWare.

[ad#ad-2]
Сначала расскажем почему RAID-5. RAID-5, действительно, самый популярный из уровней – в первую очередь благодаря своей экономичности. Жертвуя ради избыточности емкостью всего одного диска из массива, мы получаем защиту от выхода из строя любого из винчестеров тома. На запись информации на том RAID-5 тратятся дополнительные ресурсы, так как требуются дополнительные вычисления, зато при чтении (по сравнению с отдельным винчестером) имеется выигрыш, потому что потоки данных с нескольких накопителей массива распараллеливаются.
Недостатки RAID-5 проявляются при выходе из строя одного из дисков – весь том переходит в критический режим, все операции записи и чтения сопровождаются дополнительными манипуляциями, резко падает производительность, диски начинают греться. Если срочно не принять меры – можно потерять весь том. Поэтому, (см. выше) с томом RAID5 следует обязательно использовать диск Hot Spare.

Итак создаем RAID-5 на Ubuntu.
В нашем компьютере установлено 4ре диска
Один 20Г и еще 3 по 500Г
мы оставим 20Г под системой а 3 по 50Г объединим в софтварный RAID-5

Для начала установим mdadm

sudo aptitude install mdadm

Потом при помощи fdisk создадим на наших дисках первичные разделы

rroot@desktop:~# fdisk /dev/sdc
Устройство не содержит ни верной таблицы разделов DOS, ни метки диска Sun, SGI или OSF
Building a new DOS disklabel with disk identifier 0x0882f1d2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Количество цилиндров для этого диска установлено в 65270.
С этим все в порядке, но значение больше, чем 1024,
и в отдельных установках могут возникнуть проблемы с:
1) программами, запускаемым при загрузке (напр., старые версии LILO)
2) загрузкой и программами разметки из других ОС
   (напр., DOS FDISK, OS/2 FDISK)
Предупреждение: неверный флаг 0x0000 таблицы разделов 4 будет исправлен записью

Команда (m для справки): n
Действие команды
   e   расширенный
   p   основной раздел (1-4)
p
Номер раздела (1-4): 1
Первый цилиндр (1-65270, по умолчанию 1):
Используется значение по умолчанию 1
Last цилиндр, +цилиндры or +size{K,M,G} (1-65270, по умолчанию 65270):
Используется значение по умолчанию 65270

Команда (m для справки): w
Таблица разделов была изменена!

Вызывается ioctl() для перечитывания таблицы разделов.
Синхронизируются диски.
root@:~# fdisk /dev/sdd


Действие второе: При помощи mdadm создадим устройство нашего RAID-5

root@desktop:~# mdadm --create /dev/md0 --chunk=64 --level=raid5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: array /dev/md0 started.

Действие третье: форматируем нашу дисковую систему

root@desktop:~#mkfs.ext3 /dev/md0
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 262140576 blocks
13107028 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
8000 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
	102400000, 214990848

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Монтируем наш массив

mount /storage/ /dev/md0

Проверяем что все хорошо

root@desktop:~# df -k
Файловая система           1K-блоков      Исп  Доступно  Исп% смонтирована на
/dev/sda1             19734388   3318268  15413668  18% /
udev                    254668       252    254416   1% /dev
none                    254668       220    254448   1% /dev/shm
none                    254668        92    254576   1% /var/run
none                    254668         0    254668   0% /var/lock
none                    254668         0    254668   0% /lib/init/rw
/dev/md0             1032109440    204264 979477064   1% /storage

Смотрим детальную информацию по нашему массиву

root@desktop:~# mdadm --detail /dev/md0
/dev/md0:
        Version : 00.90
  Creation Time : Tue Feb  2 20:22:44 2010
     Raid Level : raid5
     Array Size : 1048562304 (999.99 GiB 1073.73 GB)
  Used Dev Size : 524281152 (499.99 GiB 536.86 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Tue Feb  2 20:27:42 2010
          State : clean, degraded, recovering
 Active Devices : 2
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 64K

 Rebuild Status : 3% complete

           UUID : babb7f34:f0994a2a:29c59303:2f54af85 (local to host ioann-desktop)
         Events : 0.7

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       3       8       49        2      spare rebuilding   /dev/sdd1

Создаем запись в /etc/fstabfstab для монтирования массива при загрузке

root@desktop:~# cat >> /etc/fstab
/dev/md0	/storage	ext3	defaults	0	1

Если очень хочется проверить что получилось и все ли работает — перезагружаем Linux.

Теги:
 

148 Responses to Linux: Ubuntu создаем софтварный RAID-5

  1. hardwood floor installers:

    Very nice post. I simply stumbled upon your weblog and wished to say that I have really enjoyed surfing around your weblog posts. After all I’ll be subscribing on your feed and I’m hoping you write again very soon!|

  2. Hello, I check your blog on a regular basis. Your writing style is awesome, keep up the good work!

  3. Excellent blog here! Also your web site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol

  4. My developer is trying to convince me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on various websites for about a year and am anxious about switching to another platform. I have heard excellent things about blogengine.net. Is there a way I can import all my wordpress content into it? Any kind of help would be really appreciated!|

  5. Merely wanna input that you have a very nice internet site , I the design and style it really stands out.

  6. I think this is among the most significant info for me. And i’m glad reading your article. But want to remark on some general things, The site style is great, the articles is really nice : D. Good job, cheers|

  7. hot tub installations:

    Truly no matter if someone doesn’t know then its up to other people that they will assist, so here it occurs.|

  8. lida:

    Aw, this was quite a great post. In concept I’ve to location in writing similar to this moreover — spending time and actual effort to make a exceptional article… but what / points I say… I procrastinate alot and no indicates often get something carried out.

  9. Thanks for some other informative website. The place else may I get that type of information written in such an ideal manner? I have a mission that I am simply now running on, and I have been at the look out for such info.|

  10. Absolutely indited written content, Really enjoyed looking at.

  11. Hi, just wanted to mention, I liked this post. It was helpful. Keep on posting!|

  12. Tumblr article

    I saw someone writing about this on Tumblr and it linked to

  13. Hi! I just would like to give you a huge thumbs up for your great information you have right here on this post. I am returning to your web site for more soon.|

  14. Hello! I’ve been following your web site for some time now and finally got the courage to go ahead and give you a shout out from Atascocita Tx! Just wanted to mention keep up the fantastic work!|

  15. kitchen design:

    I am not sure where you’re getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for wonderful info I was looking for this info for my mission.|

  16. What i don’t understood is in truth how you’re no longer really much more neatly-favored than you might be now. You are so intelligent. You realize therefore considerably relating to this subject, produced me for my part believe it from a lot of various angles. Its like men and women are not fascinated until it is one thing to do with Girl gaga! Your personal stuffs excellent. All the time take care of it up!|

  17. It’s a shame you don’t have a donate button! I’d certainly donate to this superb blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to new updates and will talk about this website with my Facebook group. Talk soon!|

  18. It is actually almost close to impossible to find well-updated individual on this subject, nonetheless you come across as like you know whatever you’re revealing! Excellent

  19. CDK Geomatics provides our clients with a complete spectrum of integrated land surveying and consulting services. Throughout our history, we’ve worked to provide our customers with a level of comfort, service and trust that exceeds their expectations.

  20. An impressive share, I just given this onto a colleague who was doing a bit evaluation on this. And he in reality bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I truly feel strongly about it and love studying extra on this topic. If potential, as you develop into expertise, would you mind updating your weblog with extra particulars? It is very valuable for me. Huge thumb up for this weblog submit!

  21. excellent points altogether, you simply received a logo new reader. What would you recommend about your publish that you simply made some days in the past? Any certain?|

  22. Perhaps you can write subsequent articles regarding this article.

  23. I went over this site and I believe you might have a lot of excellent info , saved to bookmarks (:.

  24. Ahaa, its fastidious discussion regarding this paragraph at this place at this website, I have read allthat, so now me also commenting here.|

  25. As I website possessor I believe the subject material here is rattling fantastic , appreciate it for your efforts.

  26. Howdy, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me crazy so any help is very much appreciated.|

  27. Please permit me realize so that I may subscribe.

  28. Greetings from Ohio! I’m bored at work so I decided to browse your site on my iphone during lunch break. I love the knowledge you present here and can’t wait to take a look when I get home. I’m shocked at how fast your blog loaded on my phone .. I’m not even using WIFI, just 3G .. Anyhow, very good blog!|

  29. What a material of un-ambiguity and preserveness of valuable know-how concerning unpredicted feelings.|

  30. You actually make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I am looking forward for your next post, I’ll try to get the hang of it!|

  31. Apple now has Rhapsody as an app, which is a great start, but it is currently hampered by the inability to store locally on your iPod, and has a dismal 64kbps bit rate. If this changes, then it will somewhat negate this advantage for the Zune, but the 10 songs per month will still be a big plus in Zune Pass’ favor.

  32. You actually make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complex and extremely broad for me. I am looking forward for your next post, I’ll try to get the hang of it!|

  33. You ought to join in a contest first with the greatest blogs on the web. I will recommend this internet site!

  34. I am curious to discover out what weblog platform you are employing? I’m experiencing some minor security troubles with my latest website and I’d like to uncover something much more secure. Do you’ve any recommendations?

  35. Pretty nice post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed browsing your blog posts. After all I’ll be subscribing to your rss feed and I hope you write again very soon!|

  36. Magnificent beat ! I wish to apprentice whilst you amend your site, how can i subscribe for a weblog site? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided vibrant transparent idea|

  37. not if they definitely dont care about our survival which they dont it may be bullshit but when it does occur it would in all probability be somthing such as this . NO warning in any way, thats why all the important governments in the world are already constructing underground bunkers which in all probability want do the job anyhow

  38. Wow, suprisingly I never knew this. Maintain up with great posts.

  39. Displays Commitment to Core Values

    Good write-up, I’m normal visitor of one’s site, maintain up the nice operate, and It’s going to be a regular visitor for a lengthy time.

  40. Efficient Administrative Support

    I don’t usually comment but I gotta state regards for the post on this special one :D.

  41. I am regular reader, how are you everybody? This paragraph posted at this site is in fact good.|

  42. Hello to all, how is everything, I think every one is getting more from this website, and your views are nice designed for new viewers.|

  43. musica romantica, canciones romanticas, baladas romanticas,

  44. the issues you might have raised in this posting iw worth looking at. I recognize the value of your time and energy.

  45. Superb post but I was wanting to know if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit more. Cheers!|

  46. There are some interesting time limits in this article however I don’t know if I see all of them heart to heart. There is some validity however I’ll take maintain opinion until I look into it further. Good article , thanks and we would like more! Added to FeedBurner as nicely

  47. v6uSZ8 Hi! I’ve been reading your site for a long time now and finally got the courage to go ahead and give you a shout out from Atascocita Texas! Just wanted to tell you keep up the fantastic work!

  48. I got this site from my pal who shared with me concerning this website and at the moment this time I am visiting this site and reading very informative content here.|

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Можно использовать следующие HTML-теги и атрибуты: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>