Table of Contents
Certainly! Here’s a quick cheat sheet for managing software RAID using mdadm
:
View RAID Information:
- List all RAID arrays:
sudo mdadm --detail --scan
- Check the status of RAID arrays:
cat /proc/mdstat
Create and Manage RAID:
- Create a new RAID 1 array:
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdX1 /dev/sdY1
- Add a spare drive to an existing array:
sudo mdadm /dev/md0 --add /dev/sdZ1
- Remove a drive from an array:
sudo mdadm /dev/md0 --remove /dev/sdX1
Monitor and Manage RAID:
- Monitor RAID in real-time:
watch cat /proc/mdstat
- Stop an array:
sudo mdadm --stop /dev/md0
- Assemble an array:
sudo mdadm --assemble /dev/md0
- Fail and remove a device:
sudo mdadm --manage /dev/md0 --fail /dev/sdX1 --remove /dev/sdX1
Miscellaneous:
- Check RAID metadata:
sudo mdadm --examine /dev/sdX1
- Zero out superblock on a device:
sudo mdadm --zero-superblock /dev/sdX1
- Create RAID 0 (striping):
sudo mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdX1 /dev/sdY1
Remember to replace /dev/md0
, /dev/sdX1
, /dev/sdY1
, etc., with your actual RAID device and disk names.
Feel free to adapt these commands based on your specific RAID setup and requirements. Always take precautions, backup data, and understand the implications before making changes to your RAID configuration.