Cloning raid1 boot disks: Difference between revisions

From DaqWiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 35: Line 35:
</pre>
</pre>
* wait until raid1 resync completes: watch -d -n1 "cat /proc/mdstat" or watch the grass grow
* wait until raid1 resync completes: watch -d -n1 "cat /proc/mdstat" or watch the grass grow
* TBW
* cat /proc/mdstat ### should look like this:
<pre>
[root@deap02 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[2] sda1[1]
      15635996 blocks super 1.0 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk
 
unused devices: <none>
</pre>
* install GRUB on new disks: (remember to substitute /dev/sdX !!!)
** echo -e "device (hd0) /dev/sdX\nroot (hd0,0)\nsetup (hd0)\n" | grub --batch --no-floppy
* done

Revision as of 20:09, 4 January 2012

Cloning raid1 boot disks

  • starting point:
    • xxx
  • disconnect one of the 2 boot disks
  • connect a new blank disk
  • fdisk -l ### to see which /dev/sdX device it will be
  • fdisk -H224 -S56 /dev/sdX
    • for 8/16GB USB disk: create one partition spanning the whole device, type 0xfd, set "active/bootable" flag
    • for SSD or high capacity disk: omit the -H and -S flags, create partitions 1 and 2 to match the boot and swap partitions on the active boot disk
  • result should look like this:
Disk /dev/sdb: 16.0 GB, 16013852672 bytes
224 heads, 56 sectors/track, 2493 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeccedcd8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        2493    15636068   fd  Linux raid autodetect
  • mdadm --add /dev/md0 /dev/sdX1
  • cat /proc/mdstat ### should look like this:
[root@deap02 ~]# cat /proc/mdstat
Personalities : [raid1] 
md0 : active raid1 sdb1[2] sda1[1]
      15635996 blocks super 1.0 [2/1] [_U]
      [>....................]  recovery =  0.5% (92288/15635996) finish=14.0min speed=18457K/sec
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>
  • wait until raid1 resync completes: watch -d -n1 "cat /proc/mdstat" or watch the grass grow
  • cat /proc/mdstat ### should look like this:
[root@deap02 ~]# cat /proc/mdstat
Personalities : [raid1] 
md0 : active raid1 sdb1[2] sda1[1]
      15635996 blocks super 1.0 [2/2] [UU]
      bitmap: 1/1 pages [4KB], 65536KB chunk

unused devices: <none>
  • install GRUB on new disks: (remember to substitute /dev/sdX !!!)
    • echo -e "device (hd0) /dev/sdX\nroot (hd0,0)\nsetup (hd0)\n" | grub --batch --no-floppy
  • done