initial commit
This commit is contained in:
179
README.mdadm
Normal file
179
README.mdadm
Normal file
@ -0,0 +1,179 @@
|
||||
# ---
|
||||
# - Speedup rebuilding and re-syncing linux software raid
|
||||
# ---
|
||||
|
||||
## - http://www.cyberciti.biz/tips/linux-raid-increase-resync-rebuild-speed.html
|
||||
## -
|
||||
echo 200000 > /proc/sys/dev/raid/speed_limit_max
|
||||
echo 200000 > /proc/sys/dev/raid/speed_limit_min
|
||||
|
||||
|
||||
## - swap device /dev/md0 (auto.read-only)
|
||||
## -
|
||||
swapoff -a
|
||||
mkswap /dev/md0
|
||||
swapon -a
|
||||
|
||||
|
||||
# ---
|
||||
# - (Re)activate inactiv array /dev/md0
|
||||
# ---
|
||||
|
||||
mdadm --manage /dev/md0 --run
|
||||
|
||||
|
||||
# ---
|
||||
# - Completely removing a mdadm raid array
|
||||
# ---
|
||||
|
||||
## - # cat /proc/mdstat
|
||||
## - Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]
|
||||
## - md1 : active raid1 sda3[0] sdb3[1]
|
||||
## - 80533504 blocks super 1.2 [2/2] [UU]
|
||||
## - ...
|
||||
## -
|
||||
|
||||
# - See details
|
||||
# -
|
||||
mdadm --detail /dev/md1
|
||||
|
||||
# - Unmount raid array if mounted
|
||||
# -
|
||||
umount /dev/md1
|
||||
|
||||
# - Completly remove /dev/md2
|
||||
# -
|
||||
mdadm --stop /dev/md1
|
||||
mdadm --remove /dev/md1
|
||||
|
||||
|
||||
# - zero the superblock FOR EACH drive
|
||||
# -
|
||||
mdadm --zero-superblock /dev/sda3
|
||||
mdadm --zero-superblock /dev/sda6
|
||||
|
||||
# - Make the changes known to initramfs
|
||||
# -
|
||||
update-initramfs -u -k all
|
||||
|
||||
|
||||
# ---
|
||||
# - Create an array with ONLY 1 DEVICE
|
||||
# ---
|
||||
|
||||
## - This can be useful, if having a harddisk previosly configured/used
|
||||
## - in a raid 1 array.
|
||||
## -
|
||||
## - Create raid 1 array with onlx device /dev/sda1
|
||||
## -
|
||||
mdadm --create /dev/md0 -l 1 -n 2 /dev/sda1 missing
|
||||
|
||||
## - Complte the raid array:
|
||||
## -
|
||||
## - Adding device /dev/sb1 into array /dev/md0
|
||||
## -
|
||||
mdadm -a /dev/md0 /dev/sdb1
|
||||
|
||||
|
||||
# ---
|
||||
# - Create an new raid1 array on /dev/sdb1 /dev/sdc1
|
||||
# ---
|
||||
|
||||
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sd[bc]1
|
||||
|
||||
# - write out confile - so the mdadm daemon can read it at startup and
|
||||
# - mount the devices
|
||||
# -
|
||||
cd /tmp
|
||||
echo 'DEVICE /dev/sdb1 /dev/sdc1' > mdadm.conf
|
||||
mdadm --examine --scan --config=mdadm.conf >> mdadm.conf
|
||||
echo 'MAILADDR ckubu@so36.net' >> mdadm.conf
|
||||
cp mdadm.conf /etc/mdadm/mdadm.conf
|
||||
rm /tmp/mdadm.conf
|
||||
|
||||
# - Make the changes known to initramfs
|
||||
# -
|
||||
update-initramfs -u -k all
|
||||
|
||||
## - !! IMPORTANT !!
|
||||
## - make sure do format the md device NOT the devices included
|
||||
## - in the array
|
||||
## -
|
||||
## - Notice - Lazy Initialization:
|
||||
## -
|
||||
## - For creation of an ext4-filesystem, cleaning up (initializing) inode tables
|
||||
## - and also initializing journal file are needed. Eanabling lazy
|
||||
## - initialization speeds up the creation, and do that after mounting first
|
||||
## - time. This is enabled by default.
|
||||
## -
|
||||
## - to disable lazy initialation use:
|
||||
## -
|
||||
## - mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/md0
|
||||
## -
|
||||
## - Die "-m" Option reserviert soviel Prozent (hier: 0 Prozent) des Speichers
|
||||
## - für den Superuser. Vergisst man die Option anzugeben, werden standardmäßig 5%
|
||||
## - des Speicherplatzers für den Superuser reserviert.
|
||||
## -
|
||||
mkfs.ext4 -m0 -E lazy_itable_init=0,lazy_journal_init=0 /dev/md0
|
||||
mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/md0
|
||||
|
||||
mkfs.ext4 /dev/md0
|
||||
|
||||
|
||||
# ---
|
||||
# - Verschiedene 'mdadm' Operationen..
|
||||
# ---
|
||||
|
||||
## - stop md device /dev/md0
|
||||
## -
|
||||
mdadm --stop /dev/md0
|
||||
|
||||
## - start md device /dev/md0
|
||||
## -
|
||||
## - -A = --assemble
|
||||
## - -s = --scan
|
||||
## -
|
||||
mdadm -As /dev/md0
|
||||
|
||||
## - als defekt markieren. Damit stoppt die Verwendung:
|
||||
## -
|
||||
mdadm -f <md-device> <partition-device>
|
||||
|
||||
## - remove device fom raid-array
|
||||
## -
|
||||
mdadm -r <md-device> <partition-device>
|
||||
|
||||
## - (re)add device to raid-array
|
||||
## -
|
||||
mdadm -a <md-device> <partition-device>
|
||||
|
||||
## - Raid Array ist im auto-read-only status
|
||||
## -
|
||||
## - Ändern durch:
|
||||
## -
|
||||
mdadm --readwrite /dev/md<n>
|
||||
|
||||
## - send a testmessage
|
||||
## -
|
||||
mdadm --monitor --test -1 --scan
|
||||
## - or just for one md-array
|
||||
## -
|
||||
mdadm --monitor --test -1 </dev/md?>
|
||||
|
||||
|
||||
## - Print detail
|
||||
## -
|
||||
mdadm -D </dev/md?>
|
||||
|
||||
|
||||
# ---
|
||||
# - MBR-Partitionstabelle sichern und wiederherstellen
|
||||
# ---
|
||||
|
||||
## - Save partitiontable
|
||||
## -
|
||||
sfdisk -d /dev/sdb > partitions.sdb.txt
|
||||
|
||||
## - Rrestore partitiontable
|
||||
## -
|
||||
cat partitions.sdb.txt | sfdisk /dev/sdb
|
Reference in New Issue
Block a user