Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
deb9:mdadm [2023/01/14 16:46] – [Prepare RAID with single disk] Bernard Condraudeb9:mdadm [2024/04/03 15:07] – [Move RAID to a new machine] Bernard Condrau
Line 34: Line 34:
 | sdh |  sdh1      md3  | vg2            | /backup      | | sdh |  sdh1      md3  | vg2            | /backup      |
  
-see also [[deb720:apsys|Hardware configuration]]+see also [[hw:machines#apollo|Hardware configuration]]
  
 ==== Replace a failed RAID disk ==== ==== Replace a failed RAID disk ====
Line 111: Line 111:
  
 ===== Prepare RAID with single disk ===== ===== Prepare RAID with single disk =====
 +==== Prepare new disk ====
 +  - If the new disk contains partitions
 +    - Stop any Raid partitions with<code>mdadm --stop /dev/md1
 +mdadm --remove /dev/md1</code>
 +    - Remove the superblocks<code>mdadm --zero-superblock /dev/sdX1</code>
 +    - Remove existing partitions with ''fdisk /dev/sdX''
 +  - Create a new partition utilizing the full disk space. When asked, remove the existing signature. Change partition type to ''Linux RAID''<code>sudo fdisk /dev/sdX
 +Command (m for help): d
 +Command (m for help): n
 +Command (m for help): t,29</code>
 +  - Create the RAID<code>mdadm --create /dev/mdX --level=raid1 --raid-devices=2 /dev/sdX1 missing</code>
 +  - Check the RAID was created<code>cat /proc/mdstat
 +ls /dev/md*</code>
 ==== Links ==== ==== Links ====
   * [[https://unix.stackexchange.com/questions/63928/can-i-create-a-software-raid-1-with-one-device|Can I create a software RAID 1 with one device]]   * [[https://unix.stackexchange.com/questions/63928/can-i-create-a-software-raid-1-with-one-device|Can I create a software RAID 1 with one device]]
   * [[https://wiki.archlinux.org/title/Convert_a_single_drive_system_to_RAID|Convert a single drive system to RAID]]   * [[https://wiki.archlinux.org/title/Convert_a_single_drive_system_to_RAID|Convert a single drive system to RAID]]
 +  * [[https://bobcares.com/blog/removal-of-mdadm-raid-devices/|Removal of mdadm RAID Devices – How to do it quickly?]]
  
 ===== Move RAID to a new machine ===== ===== Move RAID to a new machine =====
Line 121: Line 135:
   - Append info to mdadm.conf<code>mdadm --detail --scan >> /etc/mdadm/mdadm.conf</code>   - Append info to mdadm.conf<code>mdadm --detail --scan >> /etc/mdadm/mdadm.conf</code>
   - Update initramfs<code>update-initramfs -u</code>   - Update initramfs<code>update-initramfs -u</code>
 +  - Copy entire disk to new RAID (add ''-z'' for network transfers)<code>rsync --progress -arHAX <source dir> <destination dir></code>
 +  - Check size of directory<code>du -sh</code>
  
 ==== Troubleshooting ==== ==== Troubleshooting ====
Line 130: Line 146:
   * [[https://unix.stackexchange.com/questions/23879/using-mdadm-examine-to-write-mdadm-conf/52935#52935|Using mdadm --examine to write mdadm.conf]]   * [[https://unix.stackexchange.com/questions/23879/using-mdadm-examine-to-write-mdadm-conf/52935#52935|Using mdadm --examine to write mdadm.conf]]
   * [[https://askubuntu.com/questions/729370/can-i-transfer-my-mdadm-software-raid-to-a-new-system-in-case-of-hardware-failur|Can I transfer my mdadm Software raid to a new system in case of hardware failure?]]   * [[https://askubuntu.com/questions/729370/can-i-transfer-my-mdadm-software-raid-to-a-new-system-in-case-of-hardware-failur|Can I transfer my mdadm Software raid to a new system in case of hardware failure?]]
 +  * [[https://unix.stackexchange.com/questions/324662/how-to-bring-up-an-inactive-mdadm-raid-after-a-reboot-while-adding-a-drive-to-a|How to bring up an inactive mdadm RAID after a reboot while adding a drive to a raid-6?]] 
 +  * [[https://support.hpe.com/hpesc/public/docDisplay?docId=c02101717&docLocale=en_US|RedHat Enterprise Linux 5: How to Activate a Software Raid Device Manually]] 
 +  * [[https://www.diskinternals.com/raid-recovery/how-to-remove-software-raid-with-mdadm/|Remove mdadm RAID Devices – How to do it?]]
 ===== Links ===== ===== Links =====
   * [[https://raid.wiki.kernel.org/index.php/Resync|Resync]]   * [[https://raid.wiki.kernel.org/index.php/Resync|Resync]]