How to Set Up Software RAID1 on a Running System (Incl. GRUB Configuration) (Debian Etch)

Please download to get full document.

View again

of 31
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report
Category:

Documents

Published:

Views: 4 | Pages: 31

Extension: PDF | Download: 0

Share
Related documents
Description
Set Up Software RAID1 on a Running System (Incl. GRUB Configuration) (Debian Etch)
Transcript
   English  | Deutsch On this page How To Set Up Software RAID1 On A Running System(Incl. GRUB Configuration) (Debian Etch)1 Preliminary Note2 Installing mdadm3 Preparing /dev/sdb How ToSet UpSoftwareRAID1 On A RunningSystem(Incl. GRUB Configuration) (Debian Etch)  Version 1.0  Author: Falko Timme This guide explains how to set up software RAID1 on an already running Debian Etchsystem. The GRUB bootloader will be configured in such a way that the system willstill be able to boot if one of the hard drives fails (no matter which one). I do not issue any guarantee that this will work for you!  1 Preliminary Note In this tutorial I'm using a Debian Etch system with two hard drives, / d ev/sda  and /dev/sdb  which are identical in size. /dev/sdb  is currently unused, and /dev/sda has the following partitions: /dev/sda1 : /boot  partition, ext3; /dev/sda2 : swap; /dev/sda3 : /   partition, ext3In the end I want to have the following situation: /dev/md0  (made up of /dev/sda1  and /dev/sdb1 ): /boot  partition, ext3; /dev/md1  (made up of /dev/sda2  and /dev/sdb2 ): swap; /dev/md2  (made up of /dev/sda3  and /dev/sdb3 ): /   partition, ext3This is the current situation: df -h server1:~# df -hFilesystem Size Used Avail Use% Mounted on/dev/sda3 4.4G 729M 3.4G 18% / tmpfs 126M 0 126M 0% /lib/init/rw udev 10M 56K 10M 1% /dev tmpfs 126M 0 126M 0% /dev/shm/dev/sda1 137M 12M 118M 10% /bootserver1:~# fdisk -l    Author:falkoTags:debian, storage Sign up now!   !! Tutorial InfoTutorial Info Share This PageShare This Page Tweet !! Tutorials ## Tutorial searchTutorial searchTagsForumsContributeSubscribeISPConfigNewsTutorialsTutorials How To Set Up Software RAID1 On A RunningHow To Set Up Software RAID1 On A Running…… Log in or Sign up Search...Search... Recommend  7  server1:~# fdisk -lDisk /dev/sda: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 18 144553+ 83 Linux /dev/sda2 19 80 498015 82 Linux swap / Solaris/dev/sda3 81 652 4594590 83 Linux Disk /dev/sdb: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdb doesn't contain a valid partition tableserver1:~#   2 Installing mdadm The most important tool for setting up RAID is mdadm . Let's install it like this: apt-get install initramfs-tools mdadm  You will be asked the following question: MD arrays needed for the root filesystem:   <-- all  Afterwards, we load a few kernel modules (to avoid a reboot): modprobe md modprobe linear modprobe multipathmodprobe raid0modprobe raid1modprobe raid5modprobe raid6 modprobe raid10 Now run cat /proc/mdstat The output should look as follows: server1:~# cat /proc/mdstatPersonalities : [linear] [multipath] [raid0] [raid1] [raid6][raid5] [raid4] [raid10]unused devices: <none> server1:~#   3 Preparing /dev/sdb To create a RAID1 array on our already running system, we must prepare the /dev/sdb  hard drive for RAID1, then copy the contents of our /dev/sda  hard driveto it, and finally add /dev/sda  to the RAID1 array.First, we copy the partition table from /dev/sda  to /dev/sdb  so that both diskshave exactly the same layout:  sfdisk -d /dev/sda | sfdisk /dev/sdb The output should be as follows: server1:~# sfdisk -d /dev/sda | sfdisk /dev/sdbChecking that no-one is using this disk right now ...OK Disk /dev/sdb: 652 cylinders, 255 heads, 63 sectors/tracksfdisk: ERROR: sector 0 does not have an msdos signature /dev/sdb: unrecognized partition table typeOld situation:No partitions found New situation:Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System/dev/sdb1 * 63 289169 289107 83 Linux /dev/sdb2 289170 1285199 996030 82 Linux swap / Solaris/dev/sdb3 1285200 10474379 9189180 83 Linux /dev/sdb4 0 - 0 0 Empty Successfully wrote the new partition tableRe-reading the partition table ...If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1(See fdisk(8).)server1:~# The command fdisk -l should now show that both HDDs have the same layout: server1:~# fdisk -lDisk /dev/sda: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 18 144553+ 83 Linux /dev/sda2 19 80 498015 82 Linux swap / Solaris/dev/sda3 81 652 4594590 83 Linux Disk /dev/sdb: 5368 MB, 5368709120 bytes255 heads, 63 sectors/track, 652 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sdb1 * 1 18 144553+ 83 Linux /dev/sdb2 19 80 498015 82 Linux swap / Solaris/dev/sdb3 81 652 4594590 83 Linux server1:~# Next we must change the partition type of our three partitions on /dev/sdb  to Linux raid autodetect : fdisk /dev/sdb server1:~# fdisk /dev/sdb  Command (m for help):   <-- m Command action a toggle a bootable flag  b edit bsd disklabel c toggle the dos compatibility flag  d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id  u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)Command (m for help):   <-- t Partition number (1-4):   <-- 1 Hex code (type L to list codes):   <-- L   0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot 1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris 2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT- 5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx  6 FAT16 42 SFS 86 NTFS volume set da Non-FS data 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / . 8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility  9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O  c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor  e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT 10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/ 11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT 1c Hidden W95 FAT3 75 PC/IX Hex code (type L to list codes):   <-- fd
Recommended
View more...
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks