I am on Linux Mint 18.1 with 4.8 kernel.
Question is: How to check (mdadm
) software RAID array, if the e.g. the swap file is on it?
I need the correct procedure before and after calling the checkarray
script to define proper alias.
I am on Linux Mint 18.1 with 4.8 kernel.
Question is: How to check (mdadm
) software RAID array, if the e.g. the swap file is on it?
I need the correct procedure before and after calling the checkarray
script to define proper alias.
In this example the array is called md0
and it's mounted in /raid1
.
Check array alias:
Supposing a swap file is located on the array, we need to turn it off first. If that is the only swap area on the system, we can do:
sudo swapoff --all
The array needs to be unmounted in order for it to be checked properly:
sudo umount /raid1
After this preparation took place, we may call the checkarray
script, I chose fast priority, but you may choose any priority option:
sudo /usr/share/mdadm/checkarray --fast /dev/md0
If you wish to watch the progress of the array check every second:
watch -n 1 cat /proc/mdstat
So the complete bash
check array alias
located e.g. in your personal .bash_aliases
file would look something like:
alias checkarray='sudo swapoff --all && \
sudo umount /raid1 && \
sudo /usr/share/mdadm/checkarray --fast /dev/md0 && \
watch -n 1 cat /proc/mdstat'
Make sure you close all open files on the array before calling it.
After-Check array alias:
I think no further comments needed:
alias checkarray-after='sudo mount /dev/md0 /raid1 && \
sudo swapon --all'