Le but de cette opération et donc d'étendre le stockage actuel en RAID1 de 2x 2To, soit 2To de stockage pour passer à un RAID5 avec 4x 2To, soit environ 6To.
Afin de gagner du temps, nous n'allons pas transférer les données présentes sur le RAID1 vers un disque externe en USB, mais faire un RAID1 et un RAID5 dégradés afin de transférer les données.
L'ajout des nouveaux HDD dans la bête s'est passé sans encombre. Nous pouvons donc maintenant vérifier la présence de ces nouveaux HDD via “fdisk -l” :

Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sde doesn't contain a valid partition table

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sdf doesn't contain a valid partition table



Nous voyons bien “/dev/sde” & “/dev/sdf” qui ne disposent d'aucune partition.


Création de la partition

Nous allons donc commencer par créer une partition complète sur l'un de nos nouveaux HDD. Il va nous servir d'étalonnage pour le reste.
thallium:~# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x200a1ce9.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-243201, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-243201, default 243201):
Using default value 243201

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.



Nous pouvons vérifier l'état de nos deux HDD :
thallium:~# fdisk -l

Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x200a1ce9

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/sdf doesn't contain a valid partition table



Copie de la partition

Afin de gagner du temps, et surtout d'avoir des tailles de partitions identiques, nous allons dupliquer celle de notre premier disque (/dev/sde) sur le second (/dev/sdf) :
thallium:~# sfdisk -d /dev/sde | sfdisk /dev/sdf
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdf: 243201 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdf: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdf1            63 3907024064 3907024002  fd  Linux raid autodetect
/dev/sdf2             0         -          0   0  Empty
/dev/sdf3             0         -          0   0  Empty
/dev/sdf4             0         -          0   0  Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)



Nous pouvons vérifier le bon accomplissement de cette modification :
thallium:~# fdisk -l

Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x200a1ce9

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.



Les deux disques disposent d'un partitionnement identique.


Identification du RAID1

Nous allons maintenant devoir trouver les HDD qui composent notre RAID1 de 2To :
thallium:~# fdisk -l | grep md |grep 2000
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/md1 doesn't contain a valid partition table
Disk /dev/md2 doesn't contain a valid partition table
Disk /dev/md4 doesn't contain a valid partition table
Disk /dev/md4: 2000.4 GB, 2000396222464 bytes



Nous avons identifié le “/dev/md4”, maintenant, trouvons les disques qui le composent via “cat /proc/mdstat” :
md4 : active raid1 sdb1[0] sdd1[1]
      1953511936 blocks [2/2] [UU]



Nous savons que ce sont les disques “/dev/sdb” & “/dev/sdd”.


Extraction à chaud d'un HDD du RAID1

Pour se faire, nous allons déjà le passer dans le status FAIL, puis ensuite le REMOVE de sa grappe :
mdadm --manage /dev/md4 --fail /dev/sdd1
mdadm --manage /dev/md4 --remove /dev/sdd1



Nous pouvons vérifier qu'il ne fait plus partie de notre grappe RAID via “cat /proc/mdstat” :
md4 : active raid1 sdb1[0]
      1953511936 blocks [2/1] [U_]




Copie de la partition (bis)

Nous allons comme précédemment faire exactement le même partitionnement :
thallium:~# sfdisk -d /dev/sde | sfdisk /dev/sdd
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdd: 243201 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdd1          0+ 243200  243201- 1953512001   fd  Linux raid autodetect
/dev/sdd2          0       -       0          0    0  Empty
/dev/sdd3          0       -       0          0    0  Empty
/dev/sdd4          0       -       0          0    0  Empty
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdd1            63 3907024064 3907024002  fd  Linux raid autodetect
/dev/sdd2             0         -          0   0  Empty
/dev/sdd3             0         -          0   0  Empty
/dev/sdd4             0         -          0   0  Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1



Nous vérifions que cela est bien pris en compte via “fdisk -l” :
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xa5552bcd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x200a1ce9

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.



Nos 3 HDD sont identiques.


Vérification des MD

Comme nous avons pu le constater une grappe RAID est un MD. Il faut donc en avoir de disponible, et si cela n'est pas le cas, en créer un.
Vérifions ce que nous avons en stock :
thallium:~# ll /dev/ |grep md
drwxr-xr-x  2 root root          40 10 janv. 21:31 md
brw-rw----  1 root disk      9,   0 10 janv. 21:32 md0
brw-rw----  1 root disk      9,   1 10 janv. 21:32 md1
brw-rw----  1 root disk      9,   2 10 janv. 21:32 md2
brw-rw----  1 root disk      9,   4 10 janv. 21:32 md4
drwxr-xr-x  2 root root          60 10 janv. 21:31 .mdadm
lrwxrwxrwx  1 root root           3 10 janv. 21:32 root -> md0



Les 4 présents sont déjà utilisés. Nous allons donc devoir en créer un nouveau :
thallium:~# mknod -m 640 /dev/md3 b 9 3



Vérification que celui-ci est bien présent :
thallium:~# ll /dev/ |grep md
drwxr-xr-x  2 root root          40 10 janv. 21:31 md
brw-rw----  1 root disk      9,   0 10 janv. 21:32 md0
brw-rw----  1 root disk      9,   1 10 janv. 21:32 md1
brw-rw----  1 root disk      9,   2 10 janv. 21:32 md2
brw-r-----  1 root root      9,   3 11 janv. 10:39 md3
brw-rw----  1 root disk      9,   4 10 janv. 21:32 md4
drwxr-xr-x  2 root root          60 10 janv. 21:31 .mdadm
lrwxrwxrwx  1 root root           3 10 janv. 21:32 root -> md0




Création du RAID5

Nous allons donc nous lancer dans la création de notre nouveau RAID5 avec 4HDD au final. Par contre, comme indiqué au début, nous allons partir sur du dégradé, afin de faire nos transferts de fichiers entre l'ancien et le nouveau RAID.
Pour ce faire, nous allons donc créer notre RAID5 en précisant qu'un disque est absent :
thallium:~# mdadm --create --verbose /dev/md3 --level=5 --assume-clean --raid-devices=4 missing /dev/sdd1 /dev/sde1 /dev/sdf1
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: /dev/sdd1 appears to contain a reiserfs file system
    size = 1953511936K
mdadm: /dev/sdd1 appears to be part of a raid array:
    level=raid1 devices=2 ctime=Sat Oct  8 17:41:53 2011
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: size set to 1953510400K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md3 started.



Nous pouvons vérifier que notre nouveau RAID5 est présent, et fonctionnel :
thallium:~# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md3 : active (auto-read-only) raid5 sdf1[3] sde1[2] sdd1[1]
      5860531200 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [_UUU]

md4 : active raid1 sdb1[0]
      1953511936 blocks [2/1] [U_]

md2 : active raid1 sda3[2] sdc3[1]
      943560550 blocks super 1.2 [2/2] [UU]

md1 : active (auto-read-only) raid1 sdc2[0] sda2[1]
      3903680 blocks [2/2] [UU]

md0 : active raid1 sdc1[0] sda1[1]
      29294400 blocks [2/2] [UU]

unused devices: <none>



Au passage, nous pouvons noter que les “md3” & “md4” sont tous les deux en dégradés.


Formatage du volume RAID5

Afin d'avoir un maximum d'espace disque, et un système de fichier qui tient la route, nous allons formater le volume en ReiserFS :
thallium:~# mkfs.reiserfs /dev/md3
mkfs.reiserfs 3.6.21 (2009 www.namesys.com)

A pair of credits:
Nikita Danilov  wrote  most of the core  balancing code, plugin infrastructure,
and directory code. He steadily worked long hours, and is the reason so much of
the Reiser4 plugin infrastructure is well abstracted in its details.  The carry
function, and the use of non-recursive balancing, are his idea.

Joshua Macdonald wrote the first draft of the transaction manager. Yuri Rupasov
did testing  and benchmarking,  plus he invented the r5 hash  (also used by the
dcache  code).  Yura  Rupasov,  Anatoly Pinchuk,  Igor Krasheninnikov,  Grigory
Zaigralin,  Mikhail  Gilula,   Igor  Zagorovsky,  Roman  Pozlevich,  Konstantin
Shvachko, and Joshua MacDonald are former contributors to the project.


Guessing about desired format.. Kernel 2.6.32-5-686-bigmem is running.
Format 3.6 with standard journal
Count of blocks on the device: 1465132800
Number of blocks consumed by mkreiserfs formatting process: 52924
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 72b2d86f-e51c-4fb9-aff9-73e054253d81
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
        ALL DATA WILL BE LOST ON '/dev/md3'!
Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok
ReiserFS is successfully created on /dev/md3.




Mise à jour config RAID

Nous devons informer MDADM qu'il doit prendre en compte ce nouveau RAID.
Nous allons commencer par effectuer une copie de sauvegarde du fichier de configuration :
thallium:~# cp -p /etc/mdadm/mdadm.conf /root/mdadm.conf.20130111-1054



Puis relancer un scan avec injection du résultat dans la configuration :
thallium:~# mdadm --misc --detail --brief /dev/md* 2> /dev/null | tee -a /etc/mdadm/mdadm.conf
ARRAY /dev/md0 metadata=0.90 UUID=9d4abe9b:45b62929:7a1a79cd:68e069cf
ARRAY /dev/md1 metadata=0.90 UUID=ed9b1fc4:37d4b75e:7a1a79cd:68e069cf
ARRAY /dev/md2 metadata=1.2 name=thallium:2 UUID=1239bbfa:736a2971:611b4e5a:e9148b29
ARRAY /dev/md3 metadata=1.2 name=thallium:3 UUID=819a977f:37b45a5c:4a67cbb4:8598414f
ARRAY /dev/md4 metadata=0.90 UUID=8019adce:a5db0e7a:7167efe2:badc658a



Nous vérifions que la mise à jour du fichier s'est bien passée, en comparant avec l'ancien fichier :
thallium:~# diff -Nru /root/mdadm.conf.20130111-1054 /etc/mdadm/mdadm.conf
--- /root/mdadm.conf.20130111-1054      2012-01-28 14:59:30.000000000 +0100
+++ /etc/mdadm/mdadm.conf       2013-01-11 10:59:50.000000000 +0100
@@ -33,4 +33,5 @@
 ARRAY /dev/md0 metadata=0.90 UUID=9d4abe9b:45b62929:7a1a79cd:68e069cf
 ARRAY /dev/md1 metadata=0.90 UUID=ed9b1fc4:37d4b75e:7a1a79cd:68e069cf
 ARRAY /dev/md2 metadata=1.2 name=thallium:2 UUID=1239bbfa:736a2971:611b4e5a:e9148b29
+ARRAY /dev/md3 metadata=1.2 name=thallium:3 UUID=819a977f:37b45a5c:4a67cbb4:8598414f
 ARRAY /dev/md4 metadata=0.90 UUID=8019adce:a5db0e7a:7167efe2:badc658a




Création et mise en ligne du point de montage

Il nous faut dans un premier temps créer un point de montage pour effectuer le transfert.
Disposant d'une imagination débordante, nous allons le nommer “md3” :
thallium:~# mkdir /mnt/md3



Nous pouvons dès à présent effectuer le montage :
thallium:~# mount /dev/md3 /mnt/md3



Nous vérifions que le montage s'est bien effectué :
thallium:~# mount
/dev/md0 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/md2 on /mnt/commun type reiserfs (rw)
/dev/md4 on /mnt/nas type reiserfs (rw)
/dev/md3 on /mnt/md3 type reiserfs (rw)



Vérifions de combien d'espace disque nous allons bénéficier suite à cet ajout de disques :
thallium:~# df -h | grep md3
/dev/md3              5,5T   33M  5,5T   1% /mnt/md3




Transfert des données

Maintenant que tout est en place, nous pouvons lancer le transfert des données présentes sur notre RAID1 dégradé (/dev/md4) qui est sur le montage “/mnt/nas”, et transférer tout ça sur notre RAID5 dégradé (/dev/md3) qui lui est sur le montage “/mnt/md3” :
thallium:~# cd /mnt/nas
thallium:~# cp -dpRx . /mnt/md3/



Le transfert va prendre un certain temps, voir même un temps certain … Il faut donc être patient.
Nous pouvons pour plus de sécurité, vérifier que toutes les données sont bien présentes. Pour se faire, nous allons simplement lister les fichiers des deux montages dans un fichier texte, puis les comparer :
thallium:~# cd /mnt/md3
thallium:/mnt/md3# ll -R >> fichiers.hdd
thallium:/mnt/md3# cd /mnt/nas
thallium:/mnt/nas# ll -R >> fichiers.hdd
thallium:/mnt/nas# diff -Nru fichiers.hdd /mnt/md3/fichiers.hdd



N'ayant pas de différence, nous pouvons donc passer à la suite du programme.


Destruction RAID1

Etant donné que tout est transféré, nous pouvons maintenant supprimer notre ancien RAID1. Avant de faire cela, il faut démonter le point de montage :
thallium:~# umount /mnt/nas



Nous allons déjà le passer dans le status FAIL, puis ensuite le REMOVE de sa grappe :
mdadm --manage /dev/md4 --fail /dev/sdb1



Ensuite, nous allons arrêter la grappe en question :
mdadm --manage --stop /dev/md4



Pour finir, nous allons supprimer toutes les informations qui pourraient subsister sur le dernier disque :
mdadm --zero-superblock /dev/sdb1




Copie de la partition (ter)

Nous allons comme précédemment faire exactement le même partitionnement, avec le dernier HDD qui va rejoindre le RAID5 (pour rappel “/dev/sdb”) :
thallium:~# sfdisk -d /dev/sde | sfdisk /dev/sdb
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 243201 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+ 243200  243201- 1953512001   fd  Linux raid autodetect
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdb1            63 3907024064 3907024002  fd  Linux raid autodetect
/dev/sdb2             0         -          0   0  Empty
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)



Nous vérifions que cela est bien pris en compte via “fdisk -l” :
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xa5552bcd

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sde: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x200a1ce9

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.

Disk /dev/sdf: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      243201  1953512001   fd  Linux raid autodetect
Partition 1 does not start on physical sector boundary.



Nos 4 HDD sont identiques.


Intégration du HDD dans le RAID5

Nous allons ajouter notre dernier HDD dans la grappe du RAID5, ce qui va avoir pour conséquence reconstruire le RAID et donc de durer très longtemps.
Effectivement, maintenant que le RAID5 va disposer de tous ses disques, il va donc devoir répartir les données et les bits de parités sur l’ensemble des disques de la grappe.
thallium:~# mdadm --manage /dev/md3 --add /dev/sdb1
mdadm: added /dev/sdb1



Nous pouvons vérifier la reconstruction de celui-ci :
thallium:~# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md3 : active raid5 sdb1[4] sdf1[3] sde1[2] sdd1[1]
      5860531200 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [_UUU]
      [>....................]  recovery =  0.0% (289536/1953510400) finish=337.2min speed=96512K/sec

md2 : active raid1 sda3[2] sdc3[1]
      943560550 blocks super 1.2 [2/2] [UU]

md1 : active (auto-read-only) raid1 sdc2[0] sda2[1]
      3903680 blocks [2/2] [UU]

md0 : active raid1 sdc1[0] sda1[1]
      29294400 blocks [2/2] [UU]

unused devices: <none>




Modifications finales

Maintenant que tout est presque terminé, nous pouvons finaliser les configurations.
Nous devons indiquer le nouveau point de montage dans le fichier “/etc/fstab” afin que celui-ci se monte lors du démarrage.
Nous allons donc avoir un fichier final qui va ressembler à ça :
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/md0        /               ext3    errors=remount-ro 0       1
/dev/md1        none            swap    sw              0       0
/dev/md2        /mnt/commun     reiserfs        defaults        0       0
/dev/md3        /mnt/nas     reiserfs        defaults        0       0
#/dev/md4        /mnt/nas        reiserfs        defaults        0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0



Il nous faut également modifier la configuration de MDADM afin de lui indiquer de ne plus chercher de MD4. Notre fichier de configuration “/etc/mdadm/mdadm.conf” sera donc comme celui-ci :
ARRAY /dev/md0 metadata=0.90 UUID=9d4abe9b:45b62929:7a1a79cd:68e069cf
ARRAY /dev/md1 metadata=0.90 UUID=ed9b1fc4:37d4b75e:7a1a79cd:68e069cf
ARRAY /dev/md2 metadata=1.2 name=thallium:2 UUID=1239bbfa:736a2971:611b4e5a:e9148b29
ARRAY /dev/md3 metadata=1.2 name=thallium:3 UUID=819a977f:37b45a5c:4a67cbb4:8598414f
#ARRAY /dev/md4 metadata=0.90 UUID=8019adce:a5db0e7a:7167efe2:badc658a