yatoula
16/12/2013, 13h37
Envoyé par badabou
Mon disque changé est le sda1 je ne fait que ces manips et tout est ok si pas d'erreur
Merci
Pour la dernère commande à effectuer j'ai un doute (dans mon cas sda est le disque remplacé) :
Citation:
mkswap /dev/sda3
swapon -a
On copie la partition sur sda :
# sfdisk -d /dev/sdb | sfdisk --force /dev/sda
On lance la reconstruction de md1 :
# mdadm --manage /dev/md1 --add /dev/sda1
On lance la reconstruction de md2 :
# mdadm --manage /dev/md2 --add /dev/sda2
On suit le processus de reconstrucion de md2 (très long) :
# cat /proc/mdstat
mkswap /dev/sda3
swapon -a
On voit qu'on a un RAID 1 de 3Go qui est en mode degradé car il manque le disque sdb1
mdadm --misc --detail /dev/md1
# sfdisk -d /dev/sdb | sfdisk --force /dev/sda
Checking that no-one is using this disk right now ...
OK
Disk /dev/sda: 243201 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sda: 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/sda1 4096 20482048 20477953 fd Linux raid autodetect
/dev/sda2 20482049 2929221632 2908739584 fd Linux raid autodetect
/dev/sda3 2929221633 2930268160 1046528 82 Linux swap / Solaris
/dev/sda4 0 - 0 0 Empty
Warning: partition 1 does not end at a cylinder boundary
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).)
# fdisk -l
Disk /dev/sda: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 1275 10238976+ fd Linux raid autodetect
/dev/sda2 1275 182336 1454369792 fd Linux raid autodetect
/dev/sda3 182336 182401 523264 82 Linux swap / Solaris
Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00053703
Device Boot Start End Blocks Id System
/dev/sdb1 1 1275 10238976+ fd Linux raid autodetect
/dev/sdb2 1275 182336 1454369792 fd Linux raid autodetect
/dev/sdb3 182336 182401 523264 82 Linux swap / Solaris
Disk /dev/md2: 1489.2 GB, 1489274601472 bytes
2 heads, 4 sectors/track, 363592432 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md2 doesn't contain a valid partition table
Disk /dev/md1: 10.4 GB, 10484645888 bytes
2 heads, 4 sectors/track, 2559728 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md1 doesn't contain a valid partition table
# mdadm /dev/md1 --manage --add /dev/sdb1
# sfdisk -d /dev/sdb | sfdisk /dev/sda
Checking that no-one is using this disk right now ...
OK
Disk /dev/sda: 243201 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sda: 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/sda1 4096 20482048 20477953 fd Linux raid autodetect
/dev/sda2 20482049 2929221632 2908739584 fd Linux raid autodetect
/dev/sda3 2929221633 2930268160 1046528 82 Linux swap / Solaris
/dev/sda4 0 - 0 0 Empty
Warning: partition 1 does not end at a cylinder boundary
sfdisk: I don't like these partitions - nothing changed.
(If you really want this, use the --force option.)
sfdisk -d /dev/sdb | sfdisk /dev/sda
# fdisk -l
Disk /dev/sda: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sda doesn't contain a valid partition table
Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00053703
Device Boot Start End Blocks Id System
/dev/sdb1 1 1275 10238976+ fd Linux raid autodetect
/dev/sdb2 1275 182336 1454369792 fd Linux raid autodetect
/dev/sdb3 182336 182401 523264 82 Linux swap / Solaris
Disk /dev/md2: 1489.2 GB, 1489274601472 bytes
2 heads, 4 sectors/track, 363592432 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md2 doesn't contain a valid partition table
Disk /dev/md1: 10.4 GB, 10484645888 bytes
2 heads, 4 sectors/track, 2559728 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000
Disk /dev/md1 doesn't contain a valid partition table
# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] md1 : active raid1 sdb1[1] 10238912 blocks [2/1] [_U] md2 : active raid1 sdb2[1] 1454369728 blocks [2/1] [_U] unused devices: