电竞比分网-中国电竞赛事及体育赛事平台

分享

Useful Mdadm Commands | Excalibur Partners, LLC | IT Consulting

 豆芽愛尚閱 2016-01-09

Below is a collection of commands for mdadm that I have found useful. Use these at your own risk.

Create RAID

mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sd[bcde]1
mkfs.ext3 /dev/md0

Remove disk from RAID

mdadm --fail /dev/md0 /dev/sda1
mdadm --remove /dev/md0 /dev/sda1

Copy the partition structure (when replacing a failed drive)

sfdisk -d /dev/sda | sfdisk /dev/sdb 
mdadm --zero-superblock /dev/sdb

Force the kernel to reread the partition table

partprobe

Add a disk to a RAID array (to replace a removed failed drive)

mdadm --add /dev/md0 /dev/sdf1

Check RAID status

cat /proc/mdstat
mdadm --detail /dev/md0

Reassemble a group of RAID disks

mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

Steps to emulate mdrun (which has been depreciated)

mdadm --examine --scan --config=partitions > /tmp/mdadm.conf
mdadm --assemble --scan --config=/tmp/mdadm.conf

Convert a RAID 1 array to RAID 5 (follow the steps to add a disk after running this command)

mdadm --create /dev/md0 --level=5 -n 2 /dev/sda1 /dev/sdb1

Add a disk to an existing RAID and resize the filesystem

mdadm --add /dev/md0 /dev/sdg1
mdadm --grow /dev/md0 -n 5
fsck.ext3 -f /dev/md0
resize2fs /dev/md0

Stop and remove the RAID device

mdadm --stop /dev/md0
mdadm --remove /dev/md0

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多