08
février 2011

INSIA - Technologies UNIX : TP N°3

Rédigé par Matthieu CERDA   11 commentaires   Mis à jour le  08/02/2011

Aujourd'hui, on fait du RAID !

Commençons par créer deux HDD pour la VM, soit via VirtualBox/QEMU/YMMV, soit via :

[code lang="shell"]
VBoxManage clonehd
VBoxManage clonehd
[/code]



On lance la VM et on obtient :

[code lang="shell"]
% dmesg

[    7.286698] sd 0:0:0:0: [sda] 16777216 512-byte hardware sectors (8590 MB)
[    7.287451] sd 0:0:0:0: [sda] Write Protect is off
[    7.287460] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    7.287757] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.289939] sd 0:0:0:0: [sda] 16777216 512-byte hardware sectors (8590 MB)
[    7.290105] sd 0:0:0:0: [sda] Write Protect is off
[    7.290114] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    7.290413] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.290447]  sda: sda1 sda2
[    7.319499] sd 0:0:0:0: [sda] Attached SCSI disk
[    7.320055] sd 1:0:0:0: [sdb] 16777216 512-byte hardware sectors (8590 MB)
[    7.320055] sd 1:0:0:0: [sdb] Write Protect is off
[    7.320055] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    7.320194] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.320644] sd 1:0:0:0: [sdb] 16777216 512-byte hardware sectors (8590 MB)
[    7.320858] sd 1:0:0:0: [sdb] Write Protect is off
[    7.320870] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    7.321269] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    7.321287]  sdb: sdb1 sdb2
[    7.325881] sd 1:0:0:0: [sdb] Attached SCSI disk

% sudo sfdisk -l /dev/sda
[sudo] password for kegeruneku:

Disk /dev/sda: 1044 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0+    248     249-   2000061   83  Linux
/dev/sda2        249     372     124     996030   82  Linux swap / Solaris
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty

[/code]

On wipe le second disque si c'est une copie du premier :

[code lang="shell"]
root@VM # dd if=/dev/zero of=/dev/sd{b,c} bs=1M count=512
512+0 enregistrements lus
512+0 enregistrements écrits
536870912 bytes (537 MB) copied, 7,62033 s, 70,5 MB/s
root@VM # sync
root@VM # # Et on crée des partitions identiques sur les deux via cfdisk, puis :
root@VM # sfdisk -d /dev/sdb | sfdisk /dev/sdc # Hop on copie la table de partitions
root@VM # aptitude install mdadm
[/code]

Petit topo sur le RAID : Wikipédia

[code lang="shell"]
% # Et c'est parti !
% sudo mdadm -C /dev/md0 --level=raid1 --raid-devices=2 /dev/sdb /dev/sdc
# On peut utiliser un disque ou une partition, au choix. Linux MD Powah !
mdadm: array /dev/md0 started.
% sudo mke2fs -j /dev/md0

% sudo mkdir /mnt/raid && sudo mount /dev/md0 /mnt/raid
% # Et voila. On a un RAID1 *magie*
% # On peut essayer de déclarer un disque cassé :
% sudo mdadm --set-faulty /dev/md0 /dev/sdc
mdadm: set /dev/sdc faulty in /dev/md0

% mail
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/kegeruneku": 1 message 1 new
>N  1 root@trollface.et  Tue Feb 08 12:43   31/1126  Fail event on /dev/md0:trollface
& 1
Message 1:
From root@trollface.etudiant.insia.org Tue Feb 08 12:43:42 2011
Envelope-to: root@trollface.etudiant.insia.org
Delivery-date: Tue, 08 Feb 2011 12:43:42 +0100
From: mdadm monitoring
To: root@trollface.etudiant.insia.org
Subject: Fail event on /dev/md0:trollface
Date: Tue, 08 Feb 2011 12:43:42 +0100

This is an automatically generated mail message from mdadm
running on trollface

A Fail event had been detected on md device /dev/md0.

It could be related to component device /dev/sdc.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdc[2](F) sdb[0]
8388544 blocks [2/1] [U_]

unused devices:
% # Whaaaaaa ... moderne et poli j'aime
% sudo mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Tue Feb  8 12:25:41 2011
Raid Level : raid1
Array Size : 8388544 (8.00 GiB 8.59 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue Feb  8 12:43:42 2011
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0

UUID : 0d09dc47:55563fbe:86ade1c2:8d372aa1 (local to host trollface)
Events : 0.8

Number   Major   Minor   RaidDevice State
0       8       16        0      active sync   /dev/sdb
1       0        0        1      removed

2       8       32        -      faulty spare   /dev/sdc
% # Saytoucassé ? zut...
% sudo mdadm --remove /dev/md0 /dev/sdc
mdadm: hot removed /dev/sdc
% sudo dd if=/dev/zero of=/dev/sdc bs=1M count=128
% # On remet le disque a blanc vite fait
% sudo mdadm --adde /dev/md0 /dev/sdc
mdadm: re-added /dev/sdc
% # Et la c'est le pied !
% cat /proc/mdstat
0.00 0.00 - 3% 0%]
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdc[2] sdb[0]
8388544 blocks [2/1] [U_]
[=>...................]  recovery =  5.1% (430016/8388544) finish=3.3min speed=39092K/sec

unused devices:
% sudo mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Tue Feb  8 12:25:41 2011
Raid Level : raid1
Array Size : 8388544 (8.00 GiB 8.59 GB)
Used Dev Size : 8388544 (8.00 GiB 8.59 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent

Update Time : Tue Feb  8 12:51:21 2011
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 8% complete

UUID : 0d09dc47:55563fbe:86ade1c2:8d372aa1 (local to host trollface)
Events : 0.14

Number   Major   Minor   RaidDevice State
0       8       16        0      active sync   /dev/sdb
2       8       32        1      spare rebuilding   /dev/sdc
% # Ooooh ... merci uncle Tom, merci !
[/code]

Bon allez la ça rigole plus, on enfile ses plus beaux poils et on se lance dans LVM la hop hop allez on se grouille, motivé les enfants !!!

Allez trêve de parlottes, fais péter le shell tonton en avant :

[code lang="shell"]
% sudo aptitude install lvm2
<I CAN HAZ LVM PLZ ? KTHXBYE>
[/code]

La suite au prochain épisode !

Classé dans : INSIA Mots clés : aucun

11 commentaires

#1 Los Angeles Web Design a dit :

Using those languages might be a bit complicated particularly if you doesn't need any background,
but one thing is made for sure it really is one of many fastest growing and a lot industrious
professions nowadays a practically new field where you'll find not
many occupations, you'll find trends and ideas being combined with everyday by prominent webmasters throughout the world.

Web design in the future is looking to be
more personalized to offer users a greater browsing experience.
Frequently when I am building a website following
your customer has checked out a number of revisions, the main topic of conversation drifts on the fonts that should be suited for the
website.

#2 GoldenTabs a dit :

JYRs04 https://goldentabs.com/

#3 Michael a dit :

I want to report a <a href=" http://ankaraestetik.com/en/can-you-take-valium-and-trazodone-together.html#exhaust ">can you mix valium and alcohol</a> JPMorgan Chase & Co and Morgan Stanley, who will address the panel later on Thursday, have both made major moves to get out of the physical commodity space.
<a href=" http://muslimsingle.org/pro-plus-garcinia-chemist-warehouse#aloft ">pro plus garcinia nz</a> He&rsquo;s trying to make me look crazy, but the only thing that made me a little crazy is him.&rdquo;

#4 Johnathon a dit :

Could I make an appointment to see ? <a href=" http://www.cizgifilmizle.org/dietrine-carb-blocker-reviews.html#alias ">dietrine phaseolamin preço</a> While the rate of long-term unemployed has dropped significantly from its peak in 2010, White House economic advisers Jason Furman and Jeff Zients noted in a blog post Monday, &ldquo;The long-term unemployment rate remains roughly double its pre-recession average, and ..

#5 Ricardo a dit :

We work together <a href=" http://cinemu.com/en/hydroxycut-platinum-directions/ ">hydroxycut platinum amazon</a> business lobby said foreign companies are increasingly concerned they are being targeted by Chinese regulators, charges the regulators deny
<a href=" http://ankaraestetik.com/en/valium-fibromialgia.html#cache ">how much valium to take to sleep</a> For example, countries with a lower perception of life satisfaction, more pollution and longer commuting times had a higher prevalence of IA.

#6 Jamar a dit :

Where do you study? <a href=" http://www.barkypetproducts.com/valium-migraine-headaches.pdf ">what happens if u smoke valium</a> The testifying police officer said Voynov&rsquo;s wife required eight stitches for a three-centimeter laceration above her eye.

#7 Micheal a dit :

Thanks for calling <a href=" http://outlet-verzeichnis.de/what-is-the-difference-between-glucotrol-and-glucotrol-xl.pdf ">what is the difference between glucotrol and glucotrol xl</a> In a 10-2 loss to Seattle on Thursday night, two more pitchers made their big league debuts for Texas

#8 Derek a dit :

I love the theatre <a href=" http://yourpetscomfort.com/index.php?valium-alcool-sevrage ">protocole valium delirium tremens</a> Since more people are choosing electronic devices for reading, communication and entertainment, particularly children and adolescents who already experience significant sleep loss, epidemiological research evaluating the long-term consequences of these devices on health and safety is urgently needed, the authors said.

#9 Leonardo a dit :

We were at school together <a href=" http://louwilliamsfoundation.com/index.php?buy-slimfy-south-africa#workshop ">buy slimfy online india</a> UPI is a global operation with offices in Beirut, Hong Kong, London, Santiago, Seoul and Tokyo

#10 Julius a dit :

How do you know each other? <a href=" http://www.blogdojorgearagao.com.br/tag/sampaio/#counteract ">uy levitra online no rx</a> John Coughlin was born in the Finger Lakes town of Waterloo, and lived in New Jersey for the last two decades of his life. The horse-trainer operated Coughlin’s Stable just across the parking lot from the football stadium where his brother worked.

#11 Branden a dit :

I'm on a course at the moment <a href=" http://gacetadominho.org/zofran-pregnancy-dose-8mg.pdf#district ">zofran side effects pregnancy</a> These new powers were announced at the launch of the Road Safety Authority and Gardai's annual Christmas and New Year Road Safety Campaign

Écrire un commentaire

Quelle est la deuxième lettre du mot nglbmu ? :