Mdadm: Difference between revisions

From Halfface
Jump to navigation Jump to search
 
Line 33: Line 33:
  mdadm --readwrite /dev/md127
  mdadm --readwrite /dev/md127


==sgdisk==
=sgdisk=
# Whiping partition.
# Whiping partition.
  sgdisk -oz /dev/sda
  sgdisk -oz /dev/sda
Line 47: Line 47:
# Information about disk.
# Information about disk.
  gdisk -l /dev/sda
  gdisk -l /dev/sda
=Create partition to build mirrors on=
sudo gdisk /dev/sdf
n
FD00
sudo gdisk -l /dev/sdf
Number  Start (sector)    End (sector)  Size      Code  Name
    1            2048      7814037134  3.6 TiB    FD00  Linux RAID

Latest revision as of 19:01, 31 October 2016

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

force sync disks

mdadm --readwrite /dev/md127

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

Create partition to build mirrors on

sudo gdisk /dev/sdf
n
FD00
sudo gdisk -l /dev/sdf
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      7814037134   3.6 TiB     FD00  Linux RAID