Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
admin_grundlagen:software_raid [2013/07/05 17:14] ingo_wichmann |
— (aktuell) | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Bestehendes System auf Sofrware RAID 1 migrieren ====== | ||
- | ===== Vorraussetzung ===== | ||
- | Laufendes Linuxsystem auf einer Festplatte, zusätzliche mindestens gleich große zweite neue Festplatte. | ||
- | |||
- | Zum Testen können die Partitionen auch auf der selben Festplatte liegen. | ||
- | |||
- | ===== Partitionierung ===== | ||
- | Große Partition für RAID und kleine für Swap auf der zweiten Festplatte anlegen. | ||
- | |||
- | ==== RAID Partition taggen ==== | ||
- | parted /dev/sda4 set raid on | ||
- | |||
- | fdisk -l | grep 'Linux raid autodetect' | ||
- | <file> | ||
- | /dev/sda4 63500288 126414847 31457280 fd Linux raid autodetect | ||
- | </file> | ||
- | |||
- | ===== Pakete installieren ===== | ||
- | === Debian 7 ==== | ||
- | apt-get install mdadm | ||
- | |||
- | Autoerkennung auf ''ALL'' stellen. | ||
- | |||
- | ===== RAID 1 anlegen ===== | ||
- | mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sda4 | ||
- | |||
- | ===== Dateien übertragen ====== | ||
- | mkfs.ext4 /dev/md0 | ||
- | mkdir /mnt/md0 | ||
- | mount /dev/md0 /mnt/md0 | ||
- | |||
- | mkdir /mnt/system | ||
- | mount --bind / /mnt/system | ||
- | mount --bind /boot /mnt/system/boot/ | ||
- | |||
- | cp -a /mnt/system/. /mnt/md0 | ||
- | (( oder alternativ: | ||
- | rsync -a --del /mnt/system/ /mnt/md0 | ||
- | )) | ||
- | umount /mnt/system/boot | ||
- | umount /mnt/system | ||
- | rmdir /mnt/system | ||
- | |||
- | cd /tmp/md0 | ||
- | mount --rbind /dev dev | ||
- | mount --bind /proc proc | ||
- | mount --bind /sys sys | ||
- | chroot . | ||
- | | ||
- | ''/etc/fstab'' anpassen: | ||
- | <file> | ||
- | /dev/md0 / ext3 defaults,errors=remount-ro 0 1 | ||
- | /dev/sda2 swap swap sw 0 0 | ||
- | </file> | ||
- | watch cat /proc/mdstat | ||
- | |||
- | cp -a /etc/grub.d/40_custom /etc/grub.d/09_raid_md0 | ||
- | cat <<GRUB >> /etc/grub.d/09_raid_md0 | ||
- | <file> | ||
- | |||
- | menuentry 'Debian GNU/Linux, with Linux $(uname -r)' --class debian --class gnu-linux --class gnu --class os { | ||
- | insmod raid | ||
- | insmod mdraid | ||
- | insmod part_msdos | ||
- | insmod ext2 | ||
- | set root='(md/0)' | ||
- | echo 'Loading Linux $(uname -r) ...' | ||
- | linux /vmlinuz-$(uname -r) root=/dev/md2 ro quiet | ||
- | echo 'Loading initial ramdisk ...' | ||
- | initrd /initrd.img-$(uname -r) | ||
- | } | ||
- | </file> | ||
- | |||
- | |||
- | ====== Doku ====== | ||
- | http://www.thomas-krenn.com/de/wiki/Linux_Software_RAID | ||