cat /proc/mdstat
smartctl -H /dev/sdX
smartctl -i /dv/sdX
mdadm --stop /dev/md1
mdadm --zero-superblock /dev/sdX1
gdisk /dev/sdX
Command (m for help): d
Command (m for help): d Command (m for help): n Command (m for help): t,fd00
mdadm /dev/md0 --add /dev/sdc1
echo 1000000 > /proc/sys/dev/raid/speed_limit_max
Before doing this check the current sync speed:
cat /proc/sys/dev/raid/speed_limit_max
mdadm /dev/md0 --replace /dev/sdX1 --with /dev/sdc1
sdX1 is the device you want to replace, sdc1 is the preferred device to do so and must be declared as a spare on your array. The –with
option is optional, if not specified, any available spare will be used. After resyncing the RAID the replaced drive will be marked as failed.
mdadm --manage /dev/md0 --remove /dev/sdX1
mdadm -Es
to the contents of /etc/mdadm/mdadm/conf
mdadm -Es >> /etc/mdadm/mdadm.conf
mount free -m -t
blkid ls -la /dev/disk/by-uuid cat /etc/fstab
/etc/fstab
with the ones found in /dev/disk
. Make sure you copy the correct uuid (md0, md1) to the respective entry in fstab.vim /etc/fstab
Most Debian and Debian-derived distributions create a cron job which issues an array check at 0106 hours each first Sunday of the month in /etc/cron.d/mdadm. This task appears as resync in /proc/mdstat and syslog. So if you suddenly see RAID-resyncing for no apparent reason, this might be a place to take a look.
Normally the kernel will throttle the resync activity (c.f. nice) to avoid impacting the raid device performance.
However, it is a good idea to manage the resync parameters to get optimal performance.
sudo sysctl dev.raid.speed_limit_min sudo sysctl dev.raid.speed_limit_max
dev.raid.speed_limit_min = 1000 dev.raid.speed_limit_max = 200,000
sudo sysctl -w dev.raid.speed_limit_min=10,000 sudo sysctl -w dev.raid.speed_limit_max=100,000
blockdev --getra /dev/mdX
blockdev --setra 65536 /dev/mdX
cat /sys/block/sdX/device/queue_depth
echo 1 > /sys/block/sdX/device/queue_depth
It records the size (in pages per device) of the stripe cache which is used for synchronising all write operations to the array and all read operations if the array is degraded. The default is 256 which equals to 3MB memory consumption. Valid values are 17 to 32768. Make sure your system has enough memory available: memory_consumed = system_page_size * nr_disks * stripe_cache_size.
getconf PAGESIZE
sudo echo 32768> /sys/block/md0/md/stripe_cache_size
mdadm --stop /dev/md1 mdadm --remove /dev/md1
mdadm --zero-superblock /dev/sdX1
fdisk /dev/sdX
Linux RAID
sudo fdisk /dev/sdX Command (m for help): d Command (m for help): n Command (m for help): t,29
mdadm --create /dev/mdX --level=raid1 --raid-devices=2 /dev/sdX1 missing
cat /proc/mdstat ls /dev/md*
mdadm --manage /dev/mdX --add /dev/sdX1
sudo mdadm --assemble --scan
blkid sudo mount /dev/md0 /mnt
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
update-initramfs -u
mdadm --grow /dev/md5 -z max
watch -d cat /proc/mdstat
pvdisplay
pvresize /dev/mdX
lvextend -l +100%FREE /dev/<volume_group>/<logical_volume>
cryptsetup resize /dev/mapper/<volume_group>/<logical_volume>_crypt
resize2fs -p /dev/mapper/<volume_group>/<logical_volume>_crypt