# Creating RAID and mounting it

Is \[[\[Formatting - Drives\]\] ](https://wiki.danicus.net/books/hardware/page/formatting-a-drive-in-linux "Formatting a drive in linux")needed? Do that first, then come back.

See if mdadm is installed or not  
`mdadm`

 If not, install it  
 `apt install mdadm`

Check for all storage drives in system  
`lsblk`

Create the RAID with the drive you are going to use  
`mdadm --create /dev/md111((create your own file name)) --level=5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1`

Check to see if the array is in progress

```bash
cat /proc/mdstat
```

This is going to take a while... Once it is completed:

Check the block ID for the new virtual drive/s  
`blkid`  
  
Make a File System on that new drive  
`mkfs.ext4 /dev/md111` (find your own disk location)

mkfs.ext4 - .ext4 means the "type" of file. shown on "sudo blkin" then state locate of the file its going to be

Create a location to mount the new virtual drive/s  
"/" is a good place to start

Mount the RAID to the storage location  
`mount /dev/md111 /sirstorage`

Check to see if the RAID is in the location you created  
`df -h`  
`sudo mdadm --detail /dev/md111` &lt;----Local RAID location

Add array to the fstab file | this will mount the array every time the computer starts up. You can do this with as many mounts/drives as you like.   
`nano /etc/fstab`  
 look at the headers and include this under the correct header  
 File system: `/dev/md111` mount point: `/storage/location` type: `ext4` options: `errors=remount-ro` put zeros on the rest.

[![image.png](https://wiki.danicus.net/uploads/images/gallery/2023-03/scaled-1680-/YNaimage.png)](https://wiki.danicus.net/uploads/images/gallery/2023-03/YNaimage.png)

Test to see if array mount worked  
`umount /storage/location`  
`mount -a`

\*\*Reboot!!\*\*  
 Reboot the system, just in case. Make sure the array is still mounting after reboot. If its there, you are good to go son!

Need to extend your RAID? Go find that one. "Extending RAID"