Editing
Linux RAID Array
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Creating a new RAID array == If it isn't already installed, load the mdadm package: yum -y install mdadm Get the list of disks in the system and identify the ones that you want to include: fdisk -l | grep GB Identify if any arrays are already in place: cat /proc/mdstat Create the array -- generally, <mdevice> will start with /dev/md0 mdadm --create <mdevice> --chunk=64K --level=5 --raid-devices=<count> <list of drive devices> If you get I/O errors, try chunk sizes in powers of 2 starting at 4K -- larger is better, but exactly divides the available space (i.e. you may waste space on each device that is less than a chunk). The errors may not come when creating the array; creating the filesystem is where the errors could occur. mdadm --create <mdevice> --chunk=<chunksize> --level=5 --raid-devices=<count> <list of drive devices> Check the status of the array: cat /proc/mdstat If you'll be mounting it directly, then create a filesystem on it: mkfs -t xfs <mdevice> == Replacing a failing disk == Identify the disks involved: * /dev/sdY - new disk (or partition /dev/sdY1) * /dev/sdX - old failing disk If replacing with a partition of a disk mdadm /dev/mdN --add /dev/sdY1 --replace /dev/sdX --with /dev/sdY1 If replacing with a whole disk mdadm /dev/mdN --add /dev/sdY1 --replace /dev/sdX --with /dev/sdY == Removing an MDADM Raid Array == Find out your arrays (md0, md1, etc..) using sudo fdisk -l Query your arrays to find out what disks are contained using sudo mdadm --detail /dev/md0 ... using the appropriate /dev/md* device ... Unmount the array first, otherwise it fails with "device is busy". sudo umount /dev/md0 Shut down the array using sudo mdadm --stop /dev/md0 And here's the magic key: zero the superblock FOR EACH drive so it doesn't try to rebuild the array sudo mdadm --zero-superblock /dev/sdX Repeat for each drive in the array ...
Summary:
Please note that all contributions to WilliamsNet Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
WilliamsNet Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Commons
Architecture
How-To
Systems
Hardware
SysAdmin
Kubernetes
OpenSearch
Special
Pages to create
All pages
Recent changes
Random page
Help about MediaWiki
Formatting Help
Tools
What links here
Related changes
Special pages
Page information