Mdadm

From Halfface
Revision as of 12:43, 26 February 2014 by Ekaanbj (talk | contribs) (→‎sgdisk)
Jump to navigation Jump to search

Software raid management under linux.

  1. look at healt of mirror.
mdadm --detail /dev/md127
  1. reattach device to raid device.
mdadm --manage /dev/md126 --re-add /dev/vdb1
  1. Add partition to raid device.
mdadm /dev/md127 --add /dev/vdb2
  1. Remove disk from raid device.
mdadm --manage /dev/md0 --fail /dev/sdc
mdadm --manage /dev/md3 --remove /dev/vdd2
  1. If disk has been part of raid then wipe it.
mdadm --zero-superblock /dev/sdb3
  1. Create raid device.
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sda2 /dev/sdb2
  1. Create raid1 with one initial disk.
mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/vdd1

Remove raid device.

  1. Deactivate raid device.
mdadm --stop /dev/md2
  1. Once deactivated, remove the RAID device itself:
mdadm --remove /dev/md2
  1. Finally, zero superblocks on all devices that were associated with the particular array:
mdadm --zero-superblock /dev/md2

sgdisk

  1. Whiping partition.
sgdisk -oz /dev/sda
  1. copy non gpt disk layout.
sfdisk -d /dev/vda | sfdisk /dev/vdb
  1. Copy partition layout.
sgdisk --replicate=/dev/target /dev/source
  1. Create a new UID
sgdisk -G /dev/target
  1. Information about disk.
gdisk -l /dev/sda