| 1 | == identificar bien los discos == |
| 2 | |
| 3 | Usar el comando |
| 4 | {{{ |
| 5 | # hdparm -I /dev/sdb | less |
| 6 | /dev/sdb: |
| 7 | ATA device, with non-removable media |
| 8 | Model Number: Hitachi HDS721010CLA332 |
| 9 | Serial Number: JP2930HQ0WGG0H |
| 10 | Firmware Revision: JP4OA39C |
| 11 | Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5; Revision: ATA8-AST T13 Project D1697 Revision 0b |
| 12 | ..... |
| 13 | }}} |
| 14 | |
| 15 | == Agregar Nuevo Disco == |
| 16 | |
| 17 | * Copiar tabla de particiones un disco al nuevo |
| 18 | {{{ |
| 19 | # sfdisk -d /dev/sda | sfdisk --no-reread /dev/sdb --force |
| 20 | }}} |
| 21 | |
| 22 | |
| 23 | * Agregar al raid1 el nuevo disco (sdb) |
| 24 | |
| 25 | {{{ |
| 26 | # mdadm --add /dev/md0 /dev/sdb2 |
| 27 | # mdadm --add /dev/md1 /dev/sdb5 |
| 28 | # mdadm --add /dev/md2 /dev/sdb6 |
| 29 | }}} |
| 30 | |
| 31 | |
| 32 | |
| 33 | * Quitar particion al raid1 |
| 34 | |
| 35 | {{{ |
| 36 | # mdadm --fail /dev/md0 /dev/sdb2 |
| 37 | # mdadm -r /dev/md0 /dev/sdb2 |
| 38 | }}} |
| 39 | |
| 40 | * más info: |
| 41 | |
| 42 | http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/ |
| 43 | |
| 44 | http://svn.debian.org/wsvn/pkg-mdadm/mdadm/trunk/debian/README.recipes?op=file&rev=0&sc=0 |
| 45 | |
| 46 | https://wiki.koumbit.net/RaidRecovery |
| 47 | |
| 48 | * Si los discos se salen del array |
| 49 | |
| 50 | Puede ser que los cause el smartd con el kernel. http://kerneltrap.org/mailarchive/linux-scsi/2009/9/14/6409773 |
| 51 | |
| 52 | * Grub al disco (para que varios puedan bootear sin que se rompan) |
| 53 | {{{ |
| 54 | # grub |
| 55 | Probing devices to guess BIOS drives. This may take a long time. |
| 56 | [...] |
| 57 | grub> device (hd0) /dev/sdb |
| 58 | device (hd0) /dev/sdb |
| 59 | grub> root (hd0,0) |
| 60 | root (hd0,0) |
| 61 | Filesystem type is ext2fs, partition type 0xfd |
| 62 | grub> setup (hd0) |
| 63 | setup (hd0) |
| 64 | Checking if "/boot/grub/stage1" exists... yes |
| 65 | Checking if "/boot/grub/stage2" exists... yes |
| 66 | Checking if "/boot/grub/e2fs_stage1_5" exists... yes |
| 67 | Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded. |
| 68 | succeeded |
| 69 | Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,1)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded |
| 70 | Done. |
| 71 | }}} |
| 72 | |
| 73 | * Cambiar de posición el disco ( slot number ) |
| 74 | {{{ |
| 75 | mdadm --detail /dev/md1 |
| 76 | Number Major Minor RaidDevice State |
| 77 | 0 0 0 0 removed |
| 78 | 1 8 17 1 active sync /dev/sdb1 |
| 79 | What I wanted to do is to move the device /dev/sdb1 to slot 0 from slot 1. And I found I could do that by running mdadm in grow mode with the degraded Raid 1 array: |
| 80 | mdadm --grow --force -n 1 /dev/md1 |
| 81 | mdadm --detail /dev/md1 |
| 82 | Number Major Minor RaidDevice State |
| 83 | 0 8 22 0 active sync /dev/sdb1 |
| 84 | mdadm --grow -n 2 /dev/md1 |
| 85 | mdadm --detail /dev/md1 |
| 86 | Number Major Minor RaidDevice State |
| 87 | 0 8 17 0 active sync /dev/sdb1 |
| 88 | 1 0 0 1 removed |
| 89 | |
| 90 | Then add a new device into md1 |
| 91 | mdadm /dev/md1 -a /dev/sda1 |
| 92 | mdadm: hot added /dev/sda1 |
| 93 | }}} |
| 94 | |
| 95 | http://piiis.blogspot.com/2009/03/change-slot-number-of-raid-1-device-by.html |